临时设置子接口eth0:0
ifconfig eth0:0 10.1.77.87 netmask 255.255.255.0 up
永久设置子接口,修改配置文件
例如为eth0设置子接口eth0:0
vim /etc/sysconfig/network-script/ifcfg-eth0:0
DEVICE=eth0:0
IPADDR=10.1.1.1
PREFIX=24
BOOTPROTO=none
ONPARENT=yes
ONBOOT=yes
重启网络服务
ifconfig eth0:0 10.1.77.87 netmask 255.255.255.0 up
例如为eth0设置子接口eth0:0
vim /etc/sysconfig/network-script/ifcfg-eth0:0
DEVICE=eth0:0
IPADDR=10.1.1.1
PREFIX=24
BOOTPROTO=none
ONPARENT=yes
ONBOOT=yes
重启网络服务