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 use double Network Card bond and screwdriver Interface in Linux

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

Share

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

This article mainly introduces Linux how to use double network card bond, screwdriver interface, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to understand it.

What is bond?

The network card bond is bound into a logical network card through multiple network cards to achieve local network card redundancy, bandwidth expansion and load balancing. It is a commonly used technology in production scenarios.

Applicable scenario

Two network cards of the server need to do bond, and after bond, the network card needs to be configured with addresses of different network segments to take different traffic. At this time, the screwdriver interface can be used.

Experimental scene

Equipment

Server: Server_A

Core switches: Switch_A, Switch_B

Switch connection method: stacking

Server network card: enp176s0f0, enp176s0f1 do bond

IP segment division

Business section

VLAN 201:10.10.51.0/24

Public network

VLAN 401:111.20.200.88/27

Request

The two core switches Switch_A and Switch_B connected to the server Server_A are stacked. The enp176s0f0 and enp176s0f1 optical ports of Server_A interconnect Switch_A and Switch_B; respectively. Now enp176s0f0 and enp176s0f1 are required to do bond, the address 10.10.51.16 goes through the business traffic, the address 111.20.200.90 goes through the public network traffic, and the switch port bundles eth-trunk and transmits VLAN201 and VLAN401.

Nic configuration script

# stop NetworkManager service systemctl stop NetworkManager.service systemctl disable NetworkManager.service# backup cp / etc/sysconfig/network-scripts/ifcfg-enp176s0f0 {, .bak} cp / etc/sysconfig/network-scripts/ifcfg-enp176s0f1 {, .bak} # change the network card protocol to none and start the device without booting And make a dual network card configuration sed-I's BOTPROTOBUBITUD hcp, BOTPROTOBUBITE none,'/ etc/sysconfig/network-scripts/ifcfg-enp176s0f0sed-I', ONBOOTPROTOBUBYERS'/ etc/sysconfig/network-scripts/ifcfg-enp176s0f0echo "MASTER=bond0" > / etc/sysconfig/network-scripts/ifcfg-enp176s0f0echo "SLAVE=yes" > > / etc/sysconfig/network-scripts/ifcfg-enp176s0f0sed-I', BOTPROTOBUBITE hcpand BOTPROTOBUBITUBER noneBUBY'/ etc/sysconfig/network-scripts/ifcfg-enp176s0f1sed-I's / etc/sysconfig/network-scripts/ifcfg-enp176s0f1echo "MASTER=bond0" > > / etc/sysconfig/network-scripts/ifcfg-enp176s0f1echo "SLAVE=yes" > > / etc/sysconfig/network-scripts/ifcfg-enp176s0f1# configuration network card bond0echo "DEVICE=bond0TYPE=EthernetONBOOT=yesBOOTPROTO=static" > / etc/sysconfig/network-scripts/ifcfg-bond0# write module file Bond mode is mode 0echo "alias bond0 bondingoptions bond0 miimon=100 mode=0" > / etc/modprobe.d/bond.conf# load module modprobe bonding# screwdriver interface bond0.201echo "DEVICE=bond0.201TYPE=VlanPHYSDEV=bond0ONBOOT=yesBOOTPROTO=staticREORDER_HDR=yesIPADDR=10.10.51.16GATEWAY=10.10.51.1NETMASK=255.255.255.0DNS1=114.114.114.114DNS2=8.8.8.8VLAN=yesVLAN_ID=201" > / etc/sysconfig/network-scripts/ifcfg-bond0.201# screwdriver subinterface bond0.401echo "DEVICE=bond0.401TYPE=VlanPHYSDEV=bond0ONBOOT=yesBOOTPROTO=staticREORDER_HDR=yesIPADDR=111.20.200.90GATEWAY=111.20. 200.89NETMASK=255.255.255.0DNS1=114.114.114.114DNS2=8.8.8.8VLAN=yesVLAN_ID=401 "> / etc/sysconfig/network-scripts/ifcfg-bond0.401# load module and restart host modprobe 8021qreboot

Key points

If there is eth-trunk on the switch side, then the server side must have a sub-interface

Either the switch side and the server side have lacp negotiation or neither, otherwise the ports will be different.

Example of switch-side eth-trunk port configuration

[HH2B108-H01-2-HW9006X-SW001-Eth-Trunk12] display this # interface Eth-Trunk12port link-type trunkport trunk allow-pass vlan 201 401#return

The lacp protocol on the server side uses bond mode 4. The example is as follows

# more / etc/modprobe.d/bond.conf alias bond0 bonding options bond0 miimon=100 mode=4 lacp_rate=1

The VLAN number in "DEVICE=bond0.401" in the subinterface configuration file must be consistent with the VLAN number that needs to be transmitted through.

After configuring the subinterface, the server must be restarted to take effect!

Thank you for reading this article carefully. I hope the article "how to use Linux with double network cards bond and screwdriver interface" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you 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