CentOS the next card to bind multiple IP methods

Source: Internet
Author: User
Tags bind centos

All the devices in the CentOS are files. The NIC is also defined in the file.

The binding of IP also requires only changes to the file.

Network card related files in directory:/etc/sysconfig/network-scripts

Querying Current IP information:

Ifconfig

Eth0 Link encap:ethernet hwaddr 00:50:56:ac:6b:0f

inet addr:42.51.135.206 bcast:42.51.135.255 mask:255.255.255.0

Inet6 ADDR:FE80::250:56FF:FEAD:6B0F/64 Scope:link

Up broadcast RUNNING multicast mtu:1500 metric:1

RX packets:374772 errors:0 dropped:0 overruns:0 frame:0

TX packets:35165 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:28759089 (27.4 MiB) TX bytes:4779278 (4.5 MiB)

There are files in the current directory:

Ifcfg-eth0

To create a new file in the directory:

Ifcfg-eth0:1

The contents are as follows:

Device=eth0:1

ipaddr=42.51.138.1

netmask=255.255.255.0

hwaddr=00:50:56:ac:6b:0f

Nm_controlled=yes

Onboot=yes

Bootproto=dhcp

Type=ethernet

Ipv6init=no

Userctl=no

Ifcfg-eth0:2

Device=eth0:2

ipaddr=42.51.138.2

netmask=255.255.255.0

hwaddr=00:50:56:ac:6b:0f

Nm_controlled=yes

Onboot=yes

Bootproto=dhcp

Type=ethernet

Ipv6init=no

Userctl=no

Ifcfg-eth0:3

Device=eth0:3

ipaddr=42.51.138.3

netmask=255.255.255.0

hwaddr=00:50:56:ac:6b:0f

Nm_controlled=yes

Onboot=yes

Bootproto=dhcp

Type=ethernet

Ipv6init=no

Userctl=no

To reboot the network card:

Service Network restart

Then look at the IP:

Eth0 Link encap:ethernet hwaddr 00:50:56:ac:6b:0f

inet addr:42.51.135.206 bcast:42.51.135.255 mask:255.255.255.0

Inet6 ADDR:FE80::250:56FF:FEAD:6B0F/64 Scope:link

Up broadcast RUNNING multicast mtu:1500 metric:1

RX packets:384344 errors:0 dropped:0 overruns:0 frame:0

TX packets:35241 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:29462159 (28.0 MiB) TX bytes:4791402 (4.5 MiB)

Eth0:1 Link encap:ethernet hwaddr 00:50:56:ac:6b:0f

inet addr:42.51.138.1 bcast:42.51.138.255 mask:255.255.255.0

Up broadcast RUNNING multicast mtu:1500 metric:1

Eth0:2 Link encap:ethernet hwaddr 00:50:56:ac:6b:0f

inet addr:42.51.138.2 bcast:42.51.138.255 mask:255.255.255.0

Up broadcast RUNNING multicast mtu:1500 metric:1

Eth0:3 Link encap:ethernet hwaddr 00:50:56:ac:6b:0f

inet addr:42.51.138.3 bcast:42.51.138.255 mask:255.255.255.0

Up broadcast RUNNING multicast mtu:1500 metric:1

Test:

Ping the above several IP on the other machine separately.

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.