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 realize the binding of double Network Card under linux

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

Share

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

How to achieve double network card binding under linux, many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.

Click (here) to collapse or open

Binding of dual network cards under Linux

Bind eth0,eth2 to bond0 for internal communication between nodes, using the 192.168.1.0 network segment.

Bind eth3,eth4 to bond1 for external service, and use the network segment 10.12room.room.0. Be careful to replace * with the actual IP address.

Determine which network card is available

Ethtool eth0

Ifup eth0

Ifdown eth0

Operating system version: Red Hat Enterprise Linux AS release 4 (Nahant Update 7)

Bind eth0,eth2 to bond0

Vi / etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0

BOOTPROTO=none

ONBOOT=yes

TYPE=Ethernet

USERCTL=no

IPADDR=192.168.1.2

NETMASK=255.255.255.0

NETWORK=192.168.1.0

BROADCAST=192.168.1.255

Vi / etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

BOOTPROTO=none

ONBOOT=yes

USERCTL=no

MASTER=bond0

SLAVE=yes

Note: do not have the MAC address of the actual network card.

Vi / etc/sysconfig/network-scripts/ifcfg-eth2

DEVICE=eth2

BOOTPROTO=none

ONBOOT=yes

USERCTL=no

MASTER=bond0

SLAVE=yes

Bind eth3,eth4 to bond1

Vi / etc/sysconfig/network-scripts/ifcfg-bond1

DEVICE=bond1

BOOTPROTO=none

ONBOOT=yes

TYPE=Ethernet

USERCTL=no

IPADDR=10.12*.*.61

NETMASK=255.255.255.0

NETWORK=10.12*.*.0

BROADCAST=10.12*.*.255

GATEWAY=10.12*.*.254

Vi / etc/sysconfig/network-scripts/ifcfg-eth3

DEVICE=eth3

BOOTPROTO=none

ONBOOT=yes

USERCTL=no

MASTER=bond1

SLAVE=yes

Vi / etc/sysconfig/network-scripts/ifcfg-eth4

DEVICE=eth4

BOOTPROTO=none

ONBOOT=yes

USERCTL=no

MASTER=bond1

SLAVE=yes

Add kernel modules:

Vi / etc/modprobe.conf

Add

# BONDING

Install bond0 / sbin/modprobe bonding-o bond0 mode=1 miimon=100

Install bond1 / sbin/modprobe-- ignore-install bonding-o bond1 mode=1 miimon=100

Note:

Mode=0: load balancing (round-robin)

Mode=1: fault-tolerance (active-backup)

Add startup item

Vi / etc/rc.d/rc.local

Ifenslave bond0 eth0 eth2

Ifenslave bond1 eth3 eth4

Start the network card

Ifconfig bond0 192.168.1.2 up

Ifenslave bond0 eth0 eth2

Ifconfig bond1 10.12 room.room.61 up

Ifenslave bond1 eth3 eth4

Restart a network service or system:

Service network restart

Check the working status of the bound Nic:

Cat / proc/net/bonding/bond0

Cat / proc/net/bonding/bond1

* * *

On linux4.7, use the following configuration. When setting two or more bond, the working mode of the bond Nic will be problematic, and the second bond configuration will not work:

Vi / etc/modprobe.conf

Add

# BONDING

Alias bond1 bonding

Options bond1 mode=1 miimon=100

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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