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 with one Network Card in LINUX system

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

Share

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

This article mainly explains "how to bind multiple IP with one network card in LINUX system". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "LINUX system how to bind multiple IP with a network card"!

A network card is bound to multiple IP

Linux's network device configuration file is stored in / etc/sysconfig/network-scripts

For the first network device on Ethernet, the configuration file name is generally ifcfg-eth0.

If you need to bind more than one IP address for the first network device, you only need to bind it in the

Create a file called ifcfg-eth0:0 in the / etc/sysconfig/network-scripts directory

Sample content is as follows:

DEVICE= "eth0:0"

IPADDR= "211.100.10.119"

NETMASK= "255.255.255.0"

ONBOOT= "yes"

Where DEVICE is the name of the device

IPADDR the IP address of this device

NETMASK is the subnet mask

ONBOOT means to start automatically when the system starts.

If you need to bind one more IP address

Just add the file name and the eth0:x in the DEVICE in the file.

LINUX can support up to 255IP aliases

Multiple network cards are bound to one IP

Use multiple network cards to become a virtual network card with the same IP address.

This technology already exists in sun and cisco, called Trunking and etherchannel technology, respectively.

In linux, this technique is called bonding.

Because bonding is already included in kernel 2.4.x

You just need to select Bonding driver support in the network device options at compile time.

Then, recompile the core, restart the computer, and execute the following command:

Ismod bonding

Ifconfig eth0 down

Ifconfig eth2 down

Ifconfig bond0 ipaddress

Ifenslave bond0 eth0

Ifenslave bond0 eth2

Now the two network cards are working as one, which can improve the data transmission between the cluster nodes.

You'd better write these sentences into a script and then be called by / etc/rc.d/rc.local

So that it will take effect as soon as it is turned on.

Bonding is a good choice for servers, when there is no gigabit network card

Using two or three 100 megabit network cards as bonding can greatly increase the bandwidth between the server and the switch.

However, you need to set up on the switch that the two ports connected to the bonding Nic are mapped to the same virtual interface.

At this point, I believe you have a deeper understanding of "how the LINUX system binds multiple IP with one network card". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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