Score:0

Why brctl stp cannot prevent the loop?

cn flag

Even the STP is enabled through brctl stp switch on on a looped network, the packets cannot be forwarded successfully. Please note that if there is no loop in the network, then everything is ok. The problem is described as followed.

I have three Linux boards (i.e., SW1, SW2, SW3) with the ring topology as shown:

               SW1  
             /     \
           SW2 ———— SW3  

The IP configurations are:

SW1:192.168.20.2
SW2:192.168.20.3
SW3:192.168.20.4

Each Linux board has 4 physical ports, and the connections are:

SW1.swp2 <---> SW2.swp2
SW1.swp0 <---> SW3.swp1
SW2.swp3 <---> SW3.swp3

The bridge configuration of SW1 is as shown below, the others are as same as this one except for the IP address of "switch".

    ifconfig switch 192.168.20.2 # the "192.168.20.2" is the IP of SW1, 
    ip link set switch up
    ip link set swp0 master switch && ip link set swp0 up
    ip link set swp1 master switch && ip link set swp1 up
    ip link set swp2 master switch && ip link set swp2 up
    ip link set swp3 master switch && ip link set swp3 up
    route add default gw 192.168.20.1
    brctl stp switch on
    ip link set up dev switch

The STP is enabled successfully:

brctl show switch 
 bridge name     bridge id               STP enabled     interfaces
 switch          8000.06f5bc4466d2       yes             swp0
                                                    swp1
                                                    swp2
                                                    swp3

The STP status for SW1:

    brctl showstp switch
switch
 bridge id              8000.06f5bc4466d2
 designated root        8000.067b22fa77a2
 root port                 1                    path cost                  4
 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.00                 tcn timer                  0.00
 topology change timer     0.00                 gc timer                 239.55
 flags


swp0 (1)
 port id                8001                    state                forwarding
 designated root        8000.067b22fa77a2       path cost                  4
 designated bridge      8000.067b22fa77a2       message age timer         19.82
 designated port        8002                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags

swp1 (2)
 port id                8002                    state                  disabled
 designated root        8000.06f5bc4466d2       path cost                100
 designated bridge      8000.06f5bc4466d2       message age timer          0.00
 designated port        8002                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags

swp2 (3)
 port id                8003                    state                forwarding
 designated root        8000.067b22fa77a2       path cost                  4
 designated bridge      8000.06f5bc4466d2       message age timer          0.00
 designated port        8003                    forward delay timer        0.00
 designated cost           4                    hold timer                 1.41
 flags

swp3 (4)
 port id                8004                    state                  disabled
 designated root        8000.06f5bc4466d2       path cost                100
 designated bridge      8000.06f5bc4466d2       message age timer          0.00
 designated port        8004                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00

The STP status for SW2:

brctl showstp switch
switch
 bridge id              8000.9a32d1ec24fe
 designated root        8000.067b22fa77a2
 root port                 4                    path cost                  4
 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.00                 tcn timer                  0.00
 topology change timer     0.00                 gc timer                  58.07
 flags


swp0 (1)
 port id                8001                    state                  disabled
 designated root        8000.9a32d1ec24fe       path cost                100
 designated bridge      8000.9a32d1ec24fe       message age timer          0.00
 designated port        8001                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags

swp1 (2)
 port id                8002                    state                  disabled
 designated root        8000.9a32d1ec24fe       path cost                100
 designated bridge      8000.9a32d1ec24fe       message age timer          0.00
 designated port        8002                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags

swp2 (3)
 port id                8003                    state                  blocking
 designated root        8000.067b22fa77a2       path cost                  4
 designated bridge      8000.06f5bc4466d2       message age timer         19.43
 designated port        8003                    forward delay timer        0.00
 designated cost           4                    hold timer                 0.00
 flags

swp3 (4)
 port id                8004                    state                forwarding
 designated root        8000.067b22fa77a2       path cost                  4
 designated bridge      8000.067b22fa77a2       message age timer         19.43
 designated port        8004                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags

The STP status for SW3:

brctl showstp switch
switch
 bridge id              8000.067b22fa77a2
 designated root        8000.067b22fa77a2
 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.62                 tcn timer                  0.00
 topology change timer     0.00                 gc timer                  98.80
 flags


swp0 (1)
 port id                8001                    state                forwarding
 designated root        8000.067b22fa77a2       path cost                  4
 designated bridge      8000.067b22fa77a2       message age timer          0.00
 designated port        8001                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags

swp1 (2)
 port id                8002                    state                forwarding
 designated root        8000.067b22fa77a2       path cost                  4
 designated bridge      8000.067b22fa77a2       message age timer          0.00
 designated port        8002                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags

swp2 (3)
 port id                8003                    state                forwarding
 designated root        8000.067b22fa77a2       path cost                 19
 designated bridge      8000.067b22fa77a2       message age timer          0.00
 designated port        8003                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags

swp3 (4)
 port id                8004                    state                forwarding
 designated root        8000.067b22fa77a2       path cost                  4
 designated bridge      8000.067b22fa77a2       message age timer          0.00
 designated port        8004                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags

In SW1, I ping SW2:

ping 192.168.20.3
PING 192.168.20.3 (192.168.20.3): 56 data bytes
64 bytes from 192.168.20.3: seq=9 ttl=64 time=0.330 ms
64 bytes from 192.168.20.3: seq=37 ttl=64 time=0.291 ms
64 bytes from 192.168.20.3: seq=63 ttl=64 time=0.289 ms
64 bytes from 192.168.20.3: seq=90 ttl=64 time=0.310 ms
64 bytes from 192.168.20.3: seq=117 ttl=64 time=0.305 ms
64 bytes from 192.168.20.3: seq=145 ttl=64 time=0.286 ms
64 bytes from 192.168.20.3: seq=172 ttl=64 time=0.311 ms

As we can see, the ping packets can not be transmitted continually. Is there any good idea? Again, when I disconnected the loop, the ping is ok.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.