配置如下:
[root@test-8c8g network-scripts]# cat ifcfg-eth0
# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0
GATEWAY=192.168.121.1
IPADDR=192.168.121.170
NETMASK=255.255.255.0
IPADDR2=192.168.121.171
NETMASK2=255.255.255.0
IPADDR3=192.168.121.172
NETMASK3=255.255.255.0
NM_CONTROLLED=no
ONBOOT=yes
STARTMODE=auto
TYPE=Ethernet
USERCTL=no
重启网络或者重启网卡即可生效。注意,辅助IP在ifconfig
中不显示。