Entender a numeração de porta de ponte virtual do kernel do Linux

7

Eu tenho uma ponte virtual do kernel Linux que contém as interfaces eth1 e tap0 :

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

Agora, quando vejo a tabela de endereços MAC do comutador virtual, ele mostra os números de porta 2 ( tap0 interface) e 3 ( eth1 interface):

# 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
# 

O que está conectado ao número da porta virtual da bridge 1 ?

    
por Martin 29.04.2015 / 12:34

1 resposta

5

Aqui está a saída de uma das minhas máquinas Linux de bridge: Com brctl showstp , você pode imprimir a lista de interfaces e seus parâmetros de spanning tree envolvidos na ponte. Lá, entre parênteses, você encontrará o índice de interface das interfaces constituintes - isso é o que é referenciado em 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

Você pode perguntar por que a numeração do índice da interface não é consecutiva. Bem, originalmente, quando você inicia sua ponte e adiciona interfaces a ela, é. Então, se você remover uma interface, as interfaces deixadas na bridge não terão seus números reordenados. No entanto, esses buracos são preenchidos quando você começa novamente a adicionar interfaces à ponte.

    
por 18.06.2015 / 21:34