当前位置:网站首页>Tcp/ip explanation (version 2) notes / 3 link layer / 3.4 bridge and switch

Tcp/ip explanation (version 2) notes / 3 link layer / 3.4 bridge and switch

2022-06-23 06:02:00 M rookie M

Catalog 、 reference


3.4 Bridges and switches

IEEE 802.1d The standard specifies the operation of the bridge , It also specifies the operation of the switch ( In essence, a switch is a high-performance bridge )
Bridges or switches are used to connect multiple physical link layer networks ( Such as : A pair of physical Ethernet segments ) Or multiple site groups
The most basic setup involves connecting two switches to form an extended LAN , Pictured 3-8 Shown

Figure 3-8
chart 3-8
Simple extended Ethernet LAN with two switches
Each switch port has a reference number , Each site ( Including switches ) All have their own MAC Address

The switch in the figure A and B Already connected to each other , An extended LAN is formed
In this example , The client system is connected to the switch A, The server is connected to the switch B, And the ports are numbered for reference
Please note that , Each network element , Including switches , All have their own MAC Address
as time goes on , Every bridge will “ Study ” Non local MAC Address , Each switch eventually knows which port it needs to pass to reach each site
This information is provided on a per port basis ( It may also be based on each VLAN) Tables stored in each switch ( be called Filter database filtering databases)) in
After each switch knows the location of each site , These databases will contain as shown in Figure 3-9 Information shown

Figure 3-9
chart 3-9
chart 3-8 Switches in A and B Filter database on , It's over time , Created by observing the source address on the frame seen on the switch port (“ Study of the ”)

When a switch ( bridge ) The first time you open it , Its database is empty , So it doesn't know the location of any site except itself
Whenever the switch ( bridge ) When a frame sent to a station other than itself is received , It makes a copy of each port, not the port where the frame arrives , And send a copy of the frame from each port
If the switch ( bridge ) Never know where the site is , Then each frame will be transmitted on each network segment , This leads to unnecessary overhead
Learning ability is a standard function of switches and bridges , It can significantly reduce the cost

Now , Most operating systems support the ability to bridge between network interfaces , This means that a standard computer with multiple interfaces can be used as a bridge
For example, in Windows in , You can access the network connection menu from the control panel , Select the interface to bridge , Right click the mouse and select bridge connection to bridge the interfaces together
After completion , A new icon will appear , Used to represent the bridge itself , Most of the common network attributes on the interface have disappeared , These properties will appear on the bridge device ( See the picture 3-10)

Figure 3-10
chart 3-10
stay Windows in , The network bridge device selects the network interface to be bridged 、 Right click and select “ Bridge network interface ” Function to create
Once the bridge is established , The bridge equipment needs to be further modified

chart 3-10 It shows Windows 7 Internet bridge virtual device “ attribute ” panel
The properties of bridge devices include the list of underlying devices to be bridged and the set of services running on the bridge ( Such as :Microsoft Network client 、 File and printer sharing, etc )
Linux The system uses command line parameters , Work in a similar way

Figure 3-11
chart 3-11
In this simple topology , be based on Linux Of PC Is configured as a bridge , Used to connect two Ethernet network segments
As a learning bridge , It will gradually accumulate a table , This table is used to record which port should be used to connect to a system on the extended LAN

chart 3-11 The simple network in uses a Linux With two Ethernet ports PC As a bridge
port 2 Connected to a single site , port 1 Connecting the rest of the network
The following command can open the bridge :

Linux# brctl addbr br0
Linux# brctl addif br0 eth0 
Linux# brctl addif br0 eth1 
Linux# ifconfig eth0 up
Linux# ifconfig eth1 up
Linux# ifconfig br0 up

These commands create a bridge device br0 And interface eth0 and eth1 Add to bridge
It can be used brctl delif Command delete interface
After the interface is established , have access to brctl showmacs Command to view the filter database ( stay Linux It's called in the term forwarding databases or fdbs):

Linux# brctl show
bridge name   bridge id           STP enabled   interfaces 
br0           8000.0007e914a9c1   no            eth0 eth1

Linux# brctl showmacs br0 
port no   mac addr            is local?   ageing timer 
1         00:04:5a:9f:9e:80   no          0.79 
2         00:07:e9:14:a9:c1   yes         0.00 
1         00:08:74:93:c8:3c   yes         0.00 
2         00:14:22:f4:19:5f   no          0.81 
1         00:17:f2:e7:6d:91   no          2.53 
1         00:90:f8:00:90:b7   no          17.13 

Because the site may move 、 Replace the network card 、 change MAC Address or other change , So when the bridge finds that it can access a through a port MAC Address time , You cannot assume that this information will never change
To solve this problem , After learning an address each time , Will start a timer for it ( The general default is 5 minute )
stay Linux in , A fixed time associated with the bridge is applied to each learned item
If at specified ageing The address in the entry is not seen again within the time , Delete the entry :

Linux# brctl setageing br0 1
Linux# brctl showmacs br0
port no   mac addr            is local?   ageing timer 
1         00:04:5a:9f:9e:80   no          0.76 
2         00:07:e9:14:a9:c1   yes         0.00 
1         00:08:74:93:c8:3c   yes         0.00 
2         00:14:22:f4:19:5f   no          0.78 
1         00:17:f2:e7:6d:91   no          0.00

Here's a demonstration , take ageing The value of is set lower
When an entry is deleted due to expiration
Subsequent frames of the deleted destination will be sent again from each port except the receiving port ( be called flooding flooding)), The entry is then re added to the filter database
Using filtering databases and learning capabilities is just a performance optimization , Even if the database table is empty, it will not affect the normal operation of the network , But there will be more expenses
Next, we will study the interconnection of more than two bridges through redundant links
under these circumstances , Frame flooding may cause flooding “ disaster ”, The frame will loop indefinitely


Catalog 、 reference

原网站

版权声明
本文为[M rookie M]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206230405228963.html