CentOS 7 网卡配置多个IP地址
2016-12-05 by dongnan
目标
centos 7.2
单个网卡,配置多个IP地址,例如 58.XX.XX.41 - 58.XX.XX.50
。
步骤
网卡配置文件
cat /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
# ...省略
NAME=eth0
DEVICE=eth0
BOOTPROTO="static"
GATEWAY="58.XX.XX.33"
IPADDR="58.XX.XX.41"
NETMASK="255.255.255.224"
DNS1=202.106.0.20
DNS2=202.106.46.151
# ...省略
创建 range 配置文件
cat /etc/sysconfig/network-scripts/ifcfg-eth0-range0
IPADDR_START=58.XX.XX.42
IPADDR_END=58.XX.XX.50
CLONENUM_START=0
NETMASK=255.255.255.224
验证
ip addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 9a:23:40:2f:ce:XX brd ff:ff:ff:ff:ff:ff
inet 58.XX.XX.41/27 brd 58.XX.XX.63 scope global eth0
valid_lft forever preferred_lft forever
inet 58.XX.XX.42/27 brd 58.XX.XX.63 scope global secondary eth0:0
# ...省略
valid_lft forever preferred_lft forever
inet 58.XX.XX.50/27 brd 58.XX.XX.63 scope global secondary eth0:8
valid_lft forever preferred_lft forever
inet6 fe80::9823:40ff:fe2f:ce75/64 scope link
valid_lft forever preferred_lft forever
参考
- https://www.globo.tech/learning-center/bind-multiple-ip-centos-7-linux-server/