ubuntu设置固定IP

 

首先设置IP

sudo gedit /etc/network/interfaces

 

将其内容删除

 

加上一下内容

 

auto lo

iface lo inet loopback

 

 

auto eth0

iface eth0 inet static

address 192.168.1.47

netmask 255.255.255.0

network 192.168.1.0

broadcast 192.168.1.255

gateway 192.168.1.1

 

保存

 

然后修改DNS

sudo gedit /etc/resolv.conf

 

将内容修改为

 

nameserver 202.112.14.151

nameserver 218.6.200.139

nameserver 61.139.2.69

 查看dns

less /etc/resolv.conf

保存

 

重启网络连接

sudo /etc/init.d/networking stop

sudo /etc/init.d/networking start

sudo /etc/init.d/networking restart

 

查看路由相关信息:route -n

你可能感兴趣的:(ubuntu)