3
2
I'd like to create a LAN on Linux to run some experiments. This is primarily a learning exercise so I don't want to use real Ethernet interfaces or the like. It looks like I can create dummy interfaces and connect them to a bridge interface to do this. Each dummy interface would be an endpoint on the LAN and the bridge would act like an Ethernet switch. Here's how I'm creating the LAN:
ip link add dummy1 type dummy
ip link add dummy2 type dummy
ip link add br0 type bridge
ip link set dummy1 arp on
ip link set dummy2 arp on
ip link set dev dummy1 master br0
ip link set dev dummy2 master br0
ip address add 10.0.2.1/24 broadcast + dev br0
ip address add 10.0.2.2/24 broadcast + dev dummy1
ip address add 10.0.2.3/24 broadcast + dev dummy2
ip link set dummy1 up
ip link set dummy2 up
ip link set br0 up
I can see that the links are up (googling says that the "state UNKNOWN" is expected):
$ ip link
...
6: dummy1: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UNKNOWN mode DEFAULT group default qlen 1000
link/ether fa:b9:0e:8e:a7:1f brd ff:ff:ff:ff:ff:ff
7: dummy2: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UNKNOWN mode DEFAULT group default qlen 1000
link/ether 7a:5d:8e:2b:76:d6 brd ff:ff:ff:ff:ff:ff
8: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 7a:5d:8e:2b:76:d6 brd ff:ff:ff:ff:ff:ff
And that the addresses are expected. However ping
and arping
do not work. In other words, none of the following report a response:
ping -I dummy1 10.0.2.3
arping -I dummy1 10.0.2.3
ping -I dummy2 10.0.2.2
arping -I dummy2 10.0.2.2
Running wireshark on the dummy interfaces shows ping
and arping
generating packets, but that's it.
It looks like the bridge knows the MAC addresses:
$ brctl showmacs br0
port no mac addr is local? ageing timer
2 7a:5d:8e:2b:76:d6 yes 0.00
2 7a:5d:8e:2b:76:d6 yes 0.00
1 fa:b9:0e:8e:a7:1f yes 0.00
1 fa:b9:0e:8e:a7:1f yes 0.00
However, I don't think that the bridge is forwarding frames from dummy1
to dummy2
and vice versa.
What should I do to make the bridge forward frames or is there a different way of building out this LAN virtually other than by using dummy interfaces?