Old boy Education Daily-March 16, 2017: How to add multiple IP addresses to a NIC in a Linux network configuration

Source: Internet
Author: User
Tags aliases

There are two common ways that Linux systems configure VIPs for network cards : Alias IP, and secondary IP

    • aliases IP(alias 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(secondary IP address)

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
    • VIP Configuration Summary:

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.