Ubuntu14.04 设置静态IP

此方法为永久性设置静态IP,举例说明我们想将IP地址固定为192.168.1.107

1. 查询当前IP地址:ifconfig,

2. 修改 /etc/network/interfaces

增加以下内容:

auto eth0
iface eth0 inet static
address 192.168.1.107
netmask 255.255.255.0
gateway 192.168.1.1

3.修改DNS配置

  sudo vim /etc/resolvconf/resolv.conf.d/base

  添加DNS地址:

nameserver 211.162.66.66
nameserver 211.162.77.77

4.重启网卡或者系统

4.1 重启网卡 sudo /etc/init.d/networking restart

4.2 重启电脑 sudo init 6  或者sudo reboot

4.3 重启网卡sudo ifdown eth0

                     sudo ifup eth0

猜你喜欢

转载自blog.csdn.net/ccr1001ccr1001/article/details/88259486