Ubuntu
编辑配置文件:/etc/network/interfaces
动态获取
auto eth0
iface eth0 inet dhcp
静态地址
auto eth0
iface eth0 inet static
address 192.168.1.5
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254
CentOS
编辑配置文件:/etc/sysconfig/network-scripts/ifcfg-eth0
动态获取
DEVICE = eth0
ONBOOT = yes
BOOTPROTO = dhcp
静态地址
DEVICE= eth0
BOOTPROTO= static
BROADCAST= 192.168.0.255
IPADDR= 192.168.0.100
NETMASK= 255.255.255.0
GATEWAY = 192.168.0.254
ONBOOT= yes