具有单个 IP 的多个 VLAN 桥

具有单个 IP 的多个 VLAN 桥

编辑。

[internet]
    |
  [G/W] //ip=192.168.0.1 /24
    |
[switch1] //ip=192.168.0.248, vlan10 G/W =192.168.10.1, vlan20 G/W =192.168.20.1]
    |
 (Tagged)
    |-eno3
 [linux]
    |-eno4
 (Tagged)
    |
[switch2]
    |
  [PCs]

switch1 是 VLAN(vlan10, vlan20) (192.168.10.1, 192,168.20.1) 的网关。

Linux(CentOS7)有接口eno3和eno4。

eno3是互联网端,eno4是客户端。

我发现桥接vlan就像2ways一样。

第一名

ip link add br0 type bridge vlan_filtering 1
ip link set br0 up
for trunk in 3 4; do
    for vlan in 10 20; do
        ip link add link eno$trunk name eno$trunk.$vlan type vlan id $vlan
        ip link set eno$trunk.$vlan master br0
        bridge vlan add vid $vlan pvid untagged dev eno$trunk.$vlan
        bridge vlan del vid 1 dev eno$trunk.$vlan
        ip link set eno$trunk.$vlan up
    done
done
bridge vlan del vid 1 dev br0 self

第二名

ip link add br0 type bridge vlan_filtering 1
ip link set br0 up
for trunk in 3 4; do
    ip link set eno$trunk master br0
    for vlan in 10 20; do
        bridge vlan add vid $vlan tagged dev eno$trunk
    done
    bridge vlan del vid 1 dev eno$trunk
    ip link set eno$trunk up
done
bridge vlan del vid 1 dev br0 self

与上述两种情况或类似,是否可以通过Linux设备的br0接口与各个vlan band进行通信,而不消耗真实IP或仅使用一个IP?

相关内容