Linux Setup Static IP with NetworkManager解决手动设置ip无效

问题现象:手动设置静态ip地址:sudo vi /etc/network/interfaces发现dns无效,怎么配置都无法上网

问题原因:/etc/resolv.conf是旧时生成文件,重启之后失效

问题解决:使用NetworkManager设置静态ip,方法如下:

1、Check netowrk connection:

pi@Smart4418SDK:~$ sudo nmcli connection show
NAME                UUID                                  TYPE            DEVICE 
Wired connection 1  cffa785e-0425-3777-b670-092c79328a1f  802-3-ethernet  eth0

2、The above messages show that there is a wired connection named "Wired connection 1". You can set a static IP for "Wired connection 1" by running the following commands:

sudo nmcli connection modify 'Wired connection 1' connection.autoconnect yes ipv4.method manual ipv4.address 192.168.2.199/24 ipv4.gateway 192.168.2.1 ipv4.dns 192.168.2.1
sudo reboot

3、If this is successful the connection will be assigned a static IP with IP address to be 192.168.2.199 and both gateway and DNS to be 192.168.2.1

PS:the ‘/24’ represents the number of subnetwork bits active in the mask.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值