1
2
3
4
5
6
|
# vim /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
# 表示默认使用DHCP分配IP
|
1
2
3
4
5
6
7
8
9
10
|
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.250
netmask 255.255.255.0
gateway 192.168.1.1
|
1
2
3
4
5
|
root@localhost:~
# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
|
1
2
3
4
5
|
# vim /etc/resolv.conf
# 添加如下内容
nameserver 192.168.1.1
nameserver 223.5.5.5
|
1
2
3
|
# vim /etc/resolvconf/resolv.conf.d/base
nameserver 192.168.1.1
nameserver 223.5.5.5
|
1
|
sudo
/etc/init
.d
/networking
restart
|