comleft и comright выступают в топологии в роли сетевых мостов — сетевых устройств, позволяющих обеспечивать целевую маршрутизацию данных не выше интерфейсного уровня.
bridge, через которые с помощью команды связывания интерфейсов :new: ip link set <interface> master <master-interface> будут объединяться интерфейсы разных каналов. Данные сетевые интерфейсы также будут обеспечивать фильтрацию фреймов по тегам VLAN, для этого при их создании необходимо указать параметр vlan_filtering.
bridge с указанием параметра vlan_filtering и свяжите с ними все используемые физические интерфейсы.
[root@comleft ~]# ip link add dev br0 type bridge vlan_filtering 1[root@comleft ~]# ip link set eth1 master br0[root@comleft ~]# ip link set eth2 master br0[root@comleft ~]# ip link set eth3 master br0
[root@comright ~]# ip link add dev br0 type bridge vlan_filtering 1[root@comright ~]# ip link set eth1 master br0[root@comright ~]# ip link set eth2 master br0[root@comright ~]# ip link set eth3 master br0
bridge vlan add vid <vlan-id> dev <interface> необходимо указать, какой интерфейс будет обрабатывать фреймы с указанным тегом:
[root@comleft ~]# bridge vlan add vid 2 dev eth3 pvid untagged[root@comleft ~]# bridge vlan add vid 4 dev eth2 pvid untagged[root@comleft ~]# bridge vlan add vid 2 dev eth1[root@comleft ~]# bridge vlan add vid 3 dev eth1[root@comleft ~]# bridge vlan add vid 4 dev eth1
[root@comright ~]# bridge vlan add vid 3 dev eth3 pvid untagged[root@comright ~]# bridge vlan add vid 4 dev eth2 pvid untagged[root@comright ~]# bridge vlan add vid 2 dev eth1[root@comright ~]# bridge vlan add vid 3 dev eth1[root@comright ~]# bridge vlan add vid 4 dev eth1
неиспользуемые ).
[root@comleft ~]# for I in `ls /sys/class/net`; do ip link set $I up; done
[root@comright ~]# for I in `ls /sys/class/net`; do ip link set $I up; done
bridge vlan show.
comleft.
[root@comleft ~]# bridge vlan show
port vlan-id
eth1 1 PVID Egress Untagged
2
3
4
eth2 1 Egress Untagged
4 PVID Egress Untagged
eth3 1 Egress Untagged
2 PVID Egress Untagged
br0 1 PVID Egress Untagged
[root@comleft ~]#
pc1 и pc4 будет проходить соединение, между любой другой парой абонентов — нет.
ping -c5 <dstIP> отправьте пять ICMP‑пакетов с PC3 на PC2 и пять ICMP‑пакетов с PC3 на PC1.
[root@pc3 ~]# ping -c5 10.0.0.2PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data. From 10.0.0.3 icmp_seq=1 Destination Host Unreachable ping: sendmsg: No route to host From 10.0.0.3 icmp_seq=2 Destination Host Unreachable From 10.0.0.3 icmp_seq=3 Destination Host Unreachable From 10.0.0.3 icmp_seq=5 Destination Host Unreachable --- 10.0.0.2 ping statistics --- 5 packets transmitted, 0 received, +4 errors, 100% packet loss, time 4105ms pipe 3[root@pc3 ~]# ping -c5 10.0.0.1PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data. 64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.948 ms 64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=0.792 ms 64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=0.663 ms 64 bytes from 10.0.0.1: icmp_seq=4 ttl=64 time=1.08 ms 64 bytes from 10.0.0.1: icmp_seq=5 ttl=64 time=1.28 ms --- 10.0.0.1 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4064ms rtt min/avg/max/mdev = 0.663/0.953/1.282/0.217 ms [root@pc3 ~]#
ping -c5 <dstIP> отправьте пять ICMP‑пакетов с PC4 на PC1.
[root@pc4 ~]# ping -c5 10.0.0.1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.948 ms
64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=0.792 ms
64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=0.663 ms
64 bytes from 10.0.0.1: icmp_seq=4 ttl=64 time=1.08 ms
64 bytes from 10.0.0.1: icmp_seq=5 ttl=64 time=1.28 ms
--- 10.0.0.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4064ms
rtt min/avg/max/mdev = 0.663/0.953/1.282/0.217 ms
[root@pc4 ~]#
comleft команду tcpdump -xx -i eth1, которая будет отслеживать трафик на интерфейсе eth1.
comleft сканирование интерфейса eth1 c выводом кода пакета.
[root@comleft ~]# tcpdump -xx -i eth1
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), snapshot length 262144 bytes
ping -c3 <dstIP> отправьте три ICMP‑пакета с PC3 на PC1.
[root@pc3 ~]# ping -c3 10.0.0.1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
From 10.0.0.3 icmp_seq=1 Destination Host Unreachable
From 10.0.0.3 icmp_seq=2 Destination Host Unreachable
From 10.0.0.3 icmp_seq=3 Destination Host Unreachable
--- 10.0.0.1 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2077ms
pipe 3
[root@pc3 ~]#
[root@comleft ~]# tcpdump -xx -i eth1
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), snapshot length 262144 bytes
22:18:47.881650 ARP, Request who-has 10.0.0.1 tell 10.0.0.3, length 46
0x0000: ffff ffff ffff 0800 27cc 8f19 8100 0003
0x0010: 0806 0001 0800 0604 0001 0800 27cc 8f19
0x0020: 0a00 0003 0000 0000 0000 0a00 0001 0000
0x0030: 0000 0000 0000 0000 0000 0000 0000 0000
22:18:48.933866 ARP, Request who-has 10.0.0.1 tell 10.0.0.3, length 46
0x0000: ffff ffff ffff 0800 27cc 8f19 8100 0003
0x0010: 0806 0001 0800 0604 0001 0800 27cc 8f19
0x0020: 0a00 0003 0000 0000 0000 0a00 0001 0000
0x0030: 0000 0000 0000 0000 0000 0000 0000 0000
22:18:49.957684 ARP, Request who-has 10.0.0.1 tell 10.0.0.3, length 46
0x0000: ffff ffff ffff 0800 27cc 8f19 8100 0003
0x0010: 0806 0001 0800 0604 0001 0800 27cc 8f19
0x0020: 0a00 0003 0000 0000 0000 0a00 0001 0000
0x0030: 0000 0000 0000 0000 0000 0000 0000 0000