linux网络配置

/etc/network/interfaces

静态ip

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.0.101
netmask 255.255.255.0

动态ip

dhclient重启网卡
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
pre-up ifconfig eth0 hw ether 40:8d:5c:e7:24:57
gateway 172.16.80.254
netmask 255.255.255.0
broadcast 172.16.80.255
dns-nameservers 114.114.114.11

留下评论