了解Linux内核虚拟网桥端口编号


9

我有一个Linux内核虚拟桥,其中包含接口eth1tap0

# brctl show br0
bridge name     bridge id               STP enabled     interfaces
br0             8000.00016c404fa3       no              eth1
                                                        tap0
# 

现在,当我查看虚拟交换机的MAC地址表时,它显示端口号2tap0接口)和3eth1接口):

# brctl showmacs br0
port no mac addr                is local?       ageing timer
  3     00:00:5e:00:01:c9       no                 0.11
  3     00:01:6c:40:2d:94       no                 0.53
  3     00:01:6c:40:4f:a3       yes                0.00
  3     00:01:6c:55:3a:72       no                55.33
  3     00:02:b3:8d:48:a7       no                 0.53
  3     00:0a:e4:2f:53:bb       no                 0.59
  3     00:0b:82:0a:bc:cc       no                16.98
  3     00:0c:29:07:3e:de       no                 9.12
  3     00:0c:29:94:95:39       no               156.77
  3     00:11:25:8c:7a:1a       no                16.50
  3     00:11:5c:13:af:51       no                 0.42
  3     00:15:60:5f:73:ee       no                84.73
  3     00:16:3e:4b:8e:2f       no               175.61
  3     00:19:e2:94:0b:f0       no                 7.48
  3     00:19:e2:9e:df:f0       no                 0.00
  3     00:1c:c0:61:20:a9       no                68.12
  3     00:23:7d:83:c8:9f       no                26.35
  3     00:25:9c:6e:74:e1       no               157.58
  3     00:90:fb:47:d0:8c       no                 0.46
  3     08:00:23:97:d0:87       no                14.62
  3     24:be:05:1f:71:82       no                 0.56
  3     24:be:05:1f:71:85       no                 0.51
  3     24:be:05:25:95:8f       no                 0.55
  3     4c:11:bf:98:ea:4f       no                 6.18
  3     4c:11:bf:9c:60:52       no                32.01
  3     78:24:af:37:10:70       no                51.89
  3     78:24:af:37:11:06       no                50.89
  3     88:51:fb:ec:45:1e       no                 7.12
  2     f6:b8:99:06:0b:65       yes                0.00
# 

什么是虚拟网桥端口号1

Answers:


8

这是我的一台桥接Linux机器的输出:使用brctl showstp,您可以打印与桥接有关的接口列表及其生成树参数。在括号中,您会找到组成接口的接口索引-这是在中引用的brctl showmacs

# brctl show
bridge name     bridge id               STP enabled     interfaces
br0             3000.0a32fb000000       yes             tap0
                                                        tap1
                                                        tap14
                                                        tap3
                                                        tap4
                                                        tap5
                                                        tap8
                                                        tap9
# brctl showstp br0
br0
 bridge id              3000.0a32fb000000
 designated root        3000.0a32fb000000
 root port                 0                    path cost                  0   
 max age                  20.00                 bridge max age            20.00
 hello time                2.00                 bridge hello time          2.00
 forward delay            15.00                 bridge forward delay      15.00
 ageing time             300.00
 hello timer               0.06                 tcn timer                  0.00
 topology change timer     0.00                 gc timer                 139.36
 flags  


tap0 (1)
 port id                8001                    state                forwarding
 designated root        3000.0a32fb000000       path cost                100
 designated bridge      3000.0a32fb000000       message age timer          0.00
 designated port        8001                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags  

tap1 (2)
 port id                8002                    state                forwarding
 designated root        3000.0a32fb000000       path cost                100
 designated bridge      3000.0a32fb000000       message age timer          0.00
 designated port        8002                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags  

tap14 (12)
 port id                800c                    state                forwarding
 designated root        3000.0a32fb000000       path cost                100
 designated bridge      3000.0a32fb000000       message age timer          0.00
 designated port        800c                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags  

tap3 (3)
 port id                8003                    state                forwarding
 designated root        3000.0a32fb000000       path cost                100
 designated bridge      3000.0a32fb000000       message age timer          0.00
 designated port        8003                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags  

tap4 (4)
 port id                8004                    state                forwarding
 designated root        3000.0a32fb000000       path cost                100
 designated bridge      3000.0a32fb000000       message age timer          0.00
 designated port        8004                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags  

tap5 (5)
 port id                8005                    state                forwarding
 designated root        3000.0a32fb000000       path cost                100
 designated bridge      3000.0a32fb000000       message age timer          0.00
 designated port        8005                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags  

tap8 (6)
 port id                8006                    state                forwarding
 designated root        3000.0a32fb000000       path cost                100
 designated bridge      3000.0a32fb000000       message age timer          0.00
 designated port        8006                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags  

tap9 (8)
 port id                8008                    state                forwarding
 designated root        3000.0a32fb000000       path cost                100
 designated bridge      3000.0a32fb000000       message age timer          0.00
 designated port        8008                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags  

# brctl showmacs br0
port no mac addr                is local?       ageing timer
  8     00:00:00:16:d7:28       yes                0.00
 12     00:00:00:23:4c:3b       yes                0.00
  1     00:00:00:24:fb:74       yes                0.00
  8     00:00:00:54:20:b5       no                44.91
  2     00:00:00:5b:14:3d       yes                0.00
  6     00:00:00:6b:dc:8c       no                45.22
  4     00:00:00:81:6d:8d       no                45.03
  1     00:00:00:81:6d:92       no                45.00
  2     00:00:00:a2:4f:16       no                 7.24
  8     00:00:00:a2:4f:7e       no                53.66
  2     00:00:00:a2:4f:9e       no                25.54
  2     00:00:00:b1:8a:35       no                44.86
  3     00:00:00:b8:14:87       yes                0.00
  5     00:00:00:c2:7b:d2       no                16.28
 12     00:00:00:d4:6c:ea       no                45.02
  4     00:00:00:ee:25:9f       yes                0.00 
  5     00:00:00:ef:01:b2       no                 0.57

您可能会问为什么接口索引编号不连续。好吧,最初,当您启动网桥并向其添加接口时,它就是。然后,如果删除接口,则桥中剩下的接口将不会重新编号。但是,当您再次开始向网桥添加接口时,这些漏洞将被填补。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.