How to configure multiple IPs for Linux Centos 71 NICs

Source: Internet
Author: User
Tags aliases

Because the author recently encountered such a situation, the number of servers to do networking planning, the client side gives a limited amount of IP,

Not enough for each host to be assigned to IP, but I think again, not necessarily every service must use the DCN network address,

So I think I can configure the network card that must use the DCN network address two IP, a DCN network address, a private IP address we define ourselves

The author takes the operating system under VMware Virtual machine: Centos 7 As an example, the specific configuration process is as follows:

"Method One: Add multiple ips through the configuration file of the network card"

1, edit eno16777736 network card configuration file/etc/sysconfig/network-scripts/ifcfg-eno16777736, add in the format as follows

 type=ethernetbootproto  =nonename  =eno16777736device  =eno16777736onboot  =yesipaddr0  =137.66  prefix0  =27  gateway0  =10.91 . 137.65   #################### #IPADDR1  =192.168  . 100.2   PREFIX1  =24  Span style= "color: #008000;" >//  

2, the use of systemctl restart Network.service command restart the Network service after the effective, view network card information, as shown in

===========================================================

"Method Two: Add by IP alias of network card"

In a Linux system, we can configure multiple IP addresses on a physical network card to implement sub-interface-like functions, which we call IP aliases.

IP aliases allow us to configure multiple IP addresses on a physical network card. The implementation process is as follows:

1, such as eno16777736 network card configuration file ifcfg-eno16777736 content as follows, here we also only set up an IP

Type=Ethernetbootproto=nonename=Eno16777736device=eno16777736onboot=  Yesipaddr=10.91. 137.66 NETMASK=255.255. 255.0 GATEWAY=10.91. 137.65

2, Next we create the NIC alias file/etc/sysconfig/network-scripts/ifcfg-eno16777736:0 file , add the following content

Type=Ethernetbootproto=nonename=eno16777736:0DEVICE=eno16777736:0 onboot=yesipaddr=192.168. 100.3 NETMASK=255.255. 255.0          #这里也可以写成PREFIX =

3, finally we use systemctl restart Network.service command to restart the Network service after the effective, and then view the network card information, the results are as follows:

[[Email protected]5201351~]# IP addr Show eno167777362: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU theQdisc Pfifo_fast State up Qlen +Link/etherxx: 0c: in: 5b:b2: ,BRD ff:ff:ff:ff:ff:ff inet10.91.137.66/ -Brd10.91.137.95scope Global eno16777736 Valid_lft forever Preferred_lft Forever inet192.168.100.3/ -Brd192.168.100.255Scope Global eno16777736:0Valid_lft Forever Preferred_lft forever Inet6 fe80::20c:29ff:fe5b:b208/ -scope link Valid_lft forever Preferred_lft forever

Respect for the work of others reproduced please be sure to indicate the source: http://www.cnblogs.com/5201351/p/4937953.html

How to configure multiple IPs for Linux Centos 71 NICs

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.