Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to bind multiple IP to the next network card of CentOS

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the "CentOS next network card how to bind multiple IP", the article explains the content is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "CentOS next network card how to bind multiple IP" bar!

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

The binding of IP only needs to change the file.

The files related to the network card are located in the directory: / etc/sysconfig/network-scripts

Query 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

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

Restart the network card:

Service network restart

At this point, check 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:

On other machines, ping the above several IP.

Thank you for your reading, the above is the content of "how to bind multiple IP on the next network card of CentOS". After the study of this article, I believe you have a deeper understanding of the problem of how to bind multiple IP to the next network card of CentOS, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report