"Linux operational Dimension-Clustering technology advanced" CentOS7 add virtual IP (VIP) __linux

Source: Internet
Author: User

This blog is written because it needs to be used later when using keepalived to implement Nginx high availability. The role of virtual IP in high availability is followed. Today to see how to configure the server virtual IP, in fact, is to allocate more IP address.

① first check the IP address of the existing network card and run the following command with root privileges:

IP addr

Sample output:

From the above details, you can see that the server's NIC name is Eno16777736,ip address is 192.168.22.227.

The configuration file for the network card is stored in the/etc/sysconfig/network-scripts/directory. The details of each NIC will be stored in different names, such as ifcfg-eno16777736.

② Open this profile and add an additional IP address

Edit File/etc/sysconfig/network-scripts/ifcfg-eno16777736:

vi/etc/sysconfig/network-scripts/ifcfg-eno16777736

Add an additional IP address as follows.

This adds an IP address: ipaddr1= "192.168.22.231″ of course, you can also add more IP addresses.
Ipaddr2= "192.168.22.232″ ...

Finally, save and exit the file. Shortcut keys: shift+z+z

Restart the network service for the changes to take effect.

Systemctl Restart Network

③ Check to see if the IP address has been added.

Enter command:

IP addr

Sample output:

As you can see, a single NIC already has 2 IP addresses.

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.