Ubuntu
版本:ubuntu 12.04
1 . 打开vim etc/network/interfaces
2 . 添加网卡配置(静态获取IP和DHCP获取IP选一个配置即可)
静态获取IP
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.31.99
netmask 255.255.255.0
gateway 192.168.31.1
dns-nameservers 211.136.20.203
DHCP获取IP
auto eth0
iface eth0 inet dhcp
3 . 重启网卡或up网卡
su ifup eth0
sudo /etc/init.d/networking restart