系统:ubuntu14.04
命令:sudo vim /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
#The primay network interface
auto eth0
iface eth0 inet static
address 192.168.1.88
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 202.96.128.68 8.8.8.8
解析:
auto lo
iface lo inet loopback
回环测试,实现ping通本机
auto eth0
iface eth0 inet static
打开eth0网卡并配置为静态
address 192.168.1.88
静态ip地址,不要跟局域网中的其他设备ip相同,否则都不能上网
netmask 255.255.255.0
广播地址,配置所处网段
gateway 192.168.1.1
网关,这个和广播地址可以在windows下搜索网络连接,找到后右键状态,详细信息里面找到
dns-nameservers 202.96.128.68 8.8