> For the complete documentation index, see [llms.txt](https://liujinye.gitbook.io/openshift-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://liujinye.gitbook.io/openshift-docs/raspberry-pi/shu-mei-pai-raspberrypios-she-zhi-jing-tai-ip.md).

# 树莓派Raspberry Pi OS 设置静态ip

## 方法一（旧版本Raspberry Pi OS）

编辑 /etc/network/interfaces ，修改eth0 网卡相关配置如下：

```
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address 192.168.0.101
    netmask 255.255.255.0
    network 192.168.0.1
    gateway 192.168.0.1
```

## 方法二（新版本Raspberry Pi OS）

编辑 /etc/dhcpcd.conf， 添加eth0 网卡相关配置如下：

```
interface eth0
static ip_address=192.168.0.103/24
static routers=192.168.0.103
```

## 重启

```
reboot
```
