[IOT] - 为树莓派 Raspbian 设置固定 IP
背景
Raspberry Pi 4 + Raspbian Buster
配置步骤
1. 检查一下树莓派 dhcpcd 服务状态
sudo service dhcpcd status
2. 设置开机时默认启用 dhcpcd 服务
sudo service dhcpcd start
sudo systemctl enable dhcpcd
3. 打开文件 "/etc/dhcpcd.conf" 进行配置。
4. 有线网卡配置固定IP
interface eth0 static ip_address=192.168.0.110 static routers=192.168.0.1 static domain_name_servers=192.168.0.1
5. 无线网卡配置固定IP
interface wlan0 static ip_address=192.168.0.110 static routers=192.168.0.1 static domain_name_servers=192.168.0.1
预览
参考资料
https://www.raspberrypi.org/forums/posting.php?mode=quote&f=36&p=1499911
https://www.ionos.com/digitalguide/server/configuration/provide-raspberry-pi-with-a-static-ip-address/