There are two common ways that Linux systems configure VIPs for network cards : Alias IP, and secondary IP
The IP alias is created and maintained by the ifconfig command of the Linux system , and the alias IP is the second and higher IP that is bound on the NIC device.
Description: Alias The IP configuration will be abandoned in future Linux systems because there will be no more ifconfig commands in future systems.
①. methods for manually configuring aliases for VIPs
Ifconfig eth0:1 10.0.0.100 netmask 255.255.255.224 uproute add-host 10.0.0.100 Dev eth0 # # #---Add a host route, optional configuration
Description: The IP alias configuration is temporary and is lost once the NIC is restarted
②. How to manually view VIP aliases
Ifconfig
③. How to manually delete an alias VIP
Ifconfig eth0:1 10.0.0.100 netmask 255.255.255.224 downifconfig eth0:1 down
④. method for permanent alias IP
write to the NIC configuration file to allow aliases IP Permanent, name can be ifcfg-eth0:x,x for 0-255 any number,IP and other content format and Ifcfg-eth0 consistent
vim/etc/sysconfig/network-scripts/ifcfg-eth0:1device=eth0:1ipaddr=10.0.0.100
Auxiliary IP is created and maintainedby the IP command of the Linux system , the IP addr add is created by the secondary IPand cannot be viewed through ifconfig ,
but the alias IP created by ifconfig can be viewed in the IP addr show command
Description: Need to focus on the master ※
①. methods for manually configuring aliases for VIPs
IP addr Add 10.0.0.100/24 dev Eth0ip addr add 10.0.0.101/24 broadcast 10.0.0.255 dev eth0ip addr Add 10.0.0.101/24 BROADCA St 10.0.0.255 Dev eth0 label eth0:0
②. How to manually view VIP aliases
IP addr
③. How to manually delete an alias VIP
IP addr del 10.0.0.100/24 dev Eth0ip addr del 10.0.0.101/24 broadcast 10.0.0.255 Dev eth0
1. heartbeat2.1.4 and previously used alias IP,heartbeat2.1.4 later use is the secondary IP, provide VIP services
2. keepalived has always been used as an auxiliary IP service
This article is from the "Lee blog" blog, make sure to keep this source http://lidao.blog.51cto.com/3388056/1914598
Old boy Education Daily-March 16, 2017: How to add multiple IP addresses to a NIC in a Linux network configuration