In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
            
                    
                
2025-11-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
A bridge is a software configuration that connects two or more different network segments. The bridge behaves like a virtual network switch, working in transparent mode (that is, other machines do not have to pay attention to the existence of the bridge). Any real physical device (such as eth0) and virtual device (such as tap0) can be connected to the bridge. Bridging: "connecting" several network interfaces on a machine. As a result, messages received by one of the network ports are copied to the other network ports and sent out. So that the messages between the network ports can be forwarded to each other. A bridge is such a device, it has several network ports, and these ports are bridged. Hosts connected to the bridge can communicate with each other by forwarding messages from the switch.
As shown in the following figure: the message sent by host An is sent to the eth0 port of switch S1. Because eth0 is bridged with eth2 and eth3, the message is copied to eth2 and eth3, sent, and then received by host B and switch S2. And S2 will forward the message to hosts C and D
Create a bridge
It can be implemented in a variety of ways, which is described here through nmcli and bridge.
Through nmcli
1) add a bridge named br0 and manually specify the ip as 192.168.8.100
[root@CentOS7 ~] # brctl show bridge name bridge id STP enabled interfaces [root@CentOS7 ~] # nmcli con add con-name br0 type bridge ifname br0Connection 'br0' (77a81012-0760-441a-a90a-8f4b357c5dfb) successfully added. [root@CentOS7 ~] # nmcli con modify br0 ipv4.addresses 192.168.100 nmcli con modify br0 ipv4.addresses 24 ipv4.method manual
2) add eth0 and eth2 devices to the bridge br0
[root@CentOS7] # nmcli con add con-name br0-port0 type bridge-slave ifname eth0 master br0Connection 'br0-port0' (60961b5d-312c-49dd-b9ff-287f8236436b) successfully added. [root@CentOS7 ~] # nmcli con add con-name br0-port1 type bridge-slave ifname eth2 master br0Connection' br0-port1' (e4b436f2-8bc5-4696-ad6d-bdcb3ec40a0f) successfully added.
3) start the bridge and view the information
[root@CentOS7 ~] # nmcli con up br0Connection successfully activated (master waiting for slaves) (D-Bus active path: / org/freedesktop/NetworkManager/ActiveConnection/32 [root@CentOS7 ~] # nmcli device show br0GENERAL.DEVICE: br0GENERAL.TYPE: bridgeGENERAL.HWADDR: E6:CF:41:C0:93:74GENERAL.MTU: 1500GENERAL.STATE: 100 (connected) GENERAL.CONNECTION: br0GENERAL.CON-PATH: / org/freedesktop/NetworkManager/ActiveConnection/32IP4.ADDRESS [1]: 192.168.8.100/24IP4.GATEWAY:-- IP4.ROUTE [1] : dst = 192.168.8.0 take 24 Nh = 0.0.0.0, mt = 425IP6.GATEWAY:--
4) View the generated configuration file
[root@CentOS7 ~] # cat / etc/sysconfig/network-scripts/ifcfg-br0 [root@CentOS7 ~] # cat / etc/sysconfig/network-scripts/ifcfg-br0-port0 [root@CentOS7 ~] # cat / etc/sysconfig/network-scripts/ifcfg-br0-port1 through brctl
The tool needs to install the bridge-utils package
[root@CentOS7 ~] # rpm-qf `which brctl`bridge-utils-1.5-9.el7.x86_64 [root@CentOS7 ~] # yum-y install bridge-utils
1) create a new bridge named br0
[root@CentOS7 ~] # brctl addbr br0
2) add eth0 and eth2 devices to the br0 bridge
[root@CentOS7 ~] # brctl addif br0 eth0 [root@CentOS7 ~] # brctl addif br0 eth2
3) display the existing bridges and the network ports to which they are connected:
[root@CentOS7 network-scripts] # brctl showbridge name bridge id STP enabled interfacesbr0 8000.000c29082a73 no eth0 eth2
4) start the bridge
[root@CentOS7 network-scripts] # ip link set up dev br0
5) to delete the bridge, you need to close it first.
[root@CentOS7 network-scripts] # ip link set dev br0 down [root@CentOS7 network-scripts] # brctl delbr br0 [root@CentOS7 network-scripts] # brctl showbridge name bridge id STP enabled interfaces
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.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





            
            About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.