在树莓派的使用过程中,我们常常需要ssh登入或者搭建各种服务器,如果这个时候不能固定IP是非常尴尬的一件事情,网上固定IP的方式非常的多,我在这里找了一个非常好用的方法。
1.打开配置文件
sudo vim /etc/dhcpcd.conf
2.在结尾加入以下内容
interface wlan0(如果你用的不是wifi这个地方是eth0)
static ip_address=192.168.1.209
static routers=192.168.1.1
static domain_name_servers=114.114.114.114
3.重启服务
systemctl restart networking
4.重启
reboot 查看效果
网友评论