Задать вопрос
Bermut
@Bermut
Жертва домашней лаборатории

Почему образуется петля на linux bridge?

Хочу организвать мини-маршрутизатор на debian 12, требуется создать мост с 50 vlan, создал скрипт -
скрипт
vlanidstart=900
vlanidend=950
vlan=$vlanidstart
ip l s up ens18
brctl addbr br-servers
brctl stp br-servers on
addvlans () {
        if ! [[ $vlan > $vlanidend ]]; then
                ip l a l ens18 name ens18.$vlan type vlan id $vlan
                ip l s ens18.$vlan master br-servers
                ip l s up ens18.$vlan
                vlan=$((vlan+1))
                addvlans
        fi
}
addvlans

При поднятии этого моста он уходит в петлю, при этом корреляции между состояниями stp не заметил, в dmesg такие сообщения -
spoiler
[ 405.716723] br-servers: received packet on ens18.900 with own address as source address (addr:b6:31:cb:6f:93:db, vlan:0)
[ 405.720718] br-servers: received packet on ens18.907 with own address as source address (addr:b6:31:cb:6f:93:db, vlan:0)
[ 405.724638] br-servers: received packet on ens18.909 with own address as source address (addr:b6:31:cb:6f:93:db, vlan:0)
[ 405.728135] br-servers: received packet on ens18.906 with own address as source address (addr:b6:31:cb:6f:93:db, vlan:0)
[ 405.731889] br-servers: received packet on ens18.905 with own address as source address (addr:b6:31:cb:6f:93:db, vlan:0)
[ 405.735874] br-servers: received packet on ens18.904 with own address as source address (addr:b6:31:cb:6f:93:db, vlan:0)
[ 405.739637] br-servers: received packet on ens18.900 with own address as source address (addr:b6:31:cb:6f:93:db, vlan:0)
[ 405.743871] br-servers: received packet on ens18.907 with own address as source address (addr:b6:31:cb:6f:93:db, vlan:0)
[ 405.747251] br-servers: received packet on ens18.911 with own address as source address (addr:b6:31:cb:6f:93:db, vlan:0)
[ 405.750568] br-servers: received packet on ens18.906 with own address as source address (addr:b6:31:cb:6f:93:db, vlan:0

Данный мак используется только на этом бридже.
Как правильно создать мост без сетевой петли?
ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute
       valid_lft forever preferred_lft forever
2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 1a:d2:5c:1e:db:1f brd ff:ff:ff:ff:ff:ff
    altname enp0s18
    inet6 fe80::18d2:5cff:fe1e:db1f/64 scope link
       valid_lft forever preferred_lft forever
3: ens19: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 4a:14:c8:18:2b:83 brd ff:ff:ff:ff:ff:ff
    altname enp0s19
    inet 172.20.0.0/31 scope global ens19
       valid_lft forever preferred_lft forever
    inet6 fe80::4814:c8ff:fe18:2b83/64 scope link
       valid_lft forever preferred_lft forever
4: br-servers: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether b6:31:cb:6f:93:db brd ff:ff:ff:ff:ff:ff
    inet6 fe80::b431:cbff:fe6f:93db/64 scope link tentative
       valid_lft forever preferred_lft forever
5: ens18.900@ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-servers state UP group default qlen 1000
    link/ether 1a:d2:5c:1e:db:1f brd ff:ff:ff:ff:ff:ff
    inet6 fe80::18d2:5cff:fe1e:db1f/64 scope link
       valid_lft forever preferred_lft forever
6: ens18.901@ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-servers state UP group default qlen 1000
    link/ether 1a:d2:5c:1e:db:1f brd ff:ff:ff:ff:ff:ff
    inet6 fe80::18d2:5cff:fe1e:db1f/64 scope link
       valid_lft forever preferred_lft forever
7: ens18.902@ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-servers state UP group default qlen 1000
    link/ether 1a:d2:5c:1e:db:1f brd ff:ff:ff:ff:ff:ff
    inet6 fe80::18d2:5cff:fe1e:db1f/64 scope link
       valid_lft forever preferred_lft forever
8: ens18.903@ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-servers state UP group default qlen 1000
    link/ether 1a:d2:5c:1e:db:1f brd ff:ff:ff:ff:ff:ff
    inet6 fe80::18d2:5cff:fe1e:db1f/64 scope link
       valid_lft forever preferred_lft forever
9: ens18.904@ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-servers state UP group default qlen 1000
    link/ether 1a:d2:5c:1e:db:1f brd ff:ff:ff:ff:ff:ff
    inet6 fe80::18d2:5cff:fe1e:db1f/64 scope link
       valid_lft forever preferred_lft forever
10: ens18.905@ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-servers state UP group default qlen 1000
    link/ether 1a:d2:5c:1e:db:1f brd ff:ff:ff:ff:ff:ff
    inet6 fe80::18d2:5cff:fe1e:db1f/64 scope link
       valid_lft forever preferred_lft forever
11: ens18.906@ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-servers state UP group default qlen 1000
    link/ether 1a:d2:5c:1e:db:1f brd ff:ff:ff:ff:ff:ff
    inet6 fe80::18d2:5cff:fe1e:db1f/64 scope link
       valid_lft forever preferred_lft forever
12: ens18.907@ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-servers state UP group default qlen 1000
    link/ether 1a:d2:5c:1e:db:1f brd ff:ff:ff:ff:ff:ff
    inet6 fe80::18d2:5cff:fe1e:db1f/64 scope link
       valid_lft forever preferred_lft forever
13: ens18.908@ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-servers state UP group default qlen 1000
    link/ether 1a:d2:5c:1e:db:1f brd ff:ff:ff:ff:ff:ff
    inet6 fe80::18d2:5cff:fe1e:db1f/64 scope link
       valid_lft forever preferred_lft forever
14: ens18.909@ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-servers state UP group default qlen 1000
    link/ether 1a:d2:5c:1e:db:1f brd ff:ff:ff:ff:ff:ff
    inet6 fe80::18d2:5cff:fe1e:db1f/64 scope link
       valid_lft forever preferred_lft forever
15: ens18.910@ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-servers state UP group default qlen 1000
    link/ether 1a:d2:5c:1e:db:1f brd ff:ff:ff:ff:ff:ff
    inet6 fe80::18d2:5cff:fe1e:db1f/64 scope link
       valid_lft forever preferred_lft forever
(обрезано, так как превышало лимит 10000 символов)

Должен отметить, все это делалось в виртуалке на pve, интерфейс ens18 - находиться так же в бридже с физическим интерфейсом на самом хосте
  • Вопрос задан
  • 231 просмотр
Подписаться 2 Простой Комментировать
Решения вопроса 1
Bermut
@Bermut Автор вопроса
Жертва домашней лаборатории
Как подсказали на lor, требовалось включить vlan-filter на мосту, командой ip l s br-servers type bridge vlan_filtering 1
Так же в моем случае еще помогло отключение stp на мосту.
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы