Centos7 单网卡绑定多个IP的方法
测试Centos6同样生效
[root@wptest network-scripts]# cat ifcfg-em1
DEVICE=em1
HWADDR=78:2B:CB:57:58:42
TYPE=Ethernet
UUID=757bc692-bb73-4b34-9423-6765fc42086d
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR1=192.168.1.206
IPADDR2=192.168.1.209
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
重启网卡
重点:
IPADDR1=192.168.1.206
IPADDR2=192.168.1.209
效果
[root@wptest network-scripts]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 78:2b:cb:57:58:42 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.206/24 brd 192.168.1.255 scope global em1
inet 192.168.1.209/24 brd 192.168.1.255 scope global secondary em1
inet6 fe80::7a2b:cbff:fe57:5842/64 scope link
valid_lft forever preferred_lft forever
3: em2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 78:2b:cb:57:58:43 brd ff:ff:ff:ff:ff:ff
4: p1p1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 2c:53:4a:02:bc:fa brd ff:ff:ff:ff:ff:ff
网友评论