ubuntu12.04配置网络
命令:sudo vim /etc/network/interfaces
静态IP地址
auto lo
iface lo inet loopback #loopback虚拟网络设备,使TCP/IP能以127.0.0.1这个IP地址访问你电脑本身
auto eth0
iface eth0 inet static #配置静态IP
address 10.112.18.106 #IP地址
#network 10.112.18.0
netmask 255.255.255.0 #子网掩码
#broadcast 10.112.18.255
gateway 10.112.18.254 #网关
dns-nameservers 10.112.18.1 #DNS服务器
auto eth1 #继续添加第二块网卡,与上面相同
....
DHCP动态IP地址
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
重启网络
sudo /etc/init.d/networking restart