设置方法如下:
cd /etc/sysconfig/network-scripts
cp ifcfg-eth0 ifcfg-eth0:1
vi ifcfg-eth0:1
然后改动相应的地方,一般有两个
1. device=eth0——–>device=eth0:1
2. IP地址
完成后 service network restart 就生效了
NETMASK 子网掩码 参考表:
/29 (5 usable) NETMASK = 255.255.255.248
/28 (13 usable) NETMASK = 255.255.255.240
/27 (29 usable) NETMASK = 255.255.255.224
/26 (61 usable) NETMASK = 255.255.255.192
/25 (125 usable) NETMASK = 255.255.255.128
/24 (253 usable) NETMASK = 255.255.255.0