1、Centos设置

copy
icon/buttons/copy
##配置文件模板
cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.100
NETMASK=255.255.255.0

注意:

确认网卡配置中"ONBOOT=yes",以及设定了静态IP

2、Ubuntu设置

copy
icon/buttons/copy
##配置文件模板
sudo nano /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1