1. 程式人生 > >Ubuntu14配置IP地址和DNS

Ubuntu14配置IP地址和DNS

1. dmesg | grep eth檢視網絡卡資訊,有時eth0會被改成eth1,如果改成eth1,則下面的配置中有eth0的地方要做相應調整

2. sudo vim /etc/network/interfaces

auto eth0
iface eth0 inet static #dhcp或static
address 192.168.7.2
netmask 255.255.255.0
gateway 192.168.7.1


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

nameserver 192.168.7.1 #閘道器

nameserver 114.114.114.114 #DNS

然後/etc/init.d/networking restart重啟伺服器即可。