Commit 5e0eddea authored by Kirill Smelkov's avatar Kirill Smelkov Committed by Léo-Paul Géneau

.

parent f2a6886c
#!/bin/bash #!/bin/bash -ex
# topo B-A-C creates the following network topology: # topo B-A-C creates the following network topology:
# #
# #
# netns=B netns=A netns=C # netns:B netns:A netns:C
# #
# B --- br0 --- A --- br1 --- C # B --- br0 --- A --- br1 --- C
# b1 a1 a2 c1 # b1 a1 a2 c1
...@@ -13,17 +13,53 @@ ...@@ -13,17 +13,53 @@
# #
# Based on https://github.com/troglobit/smcroute/tree/master/test # Based on https://github.com/troglobit/smcroute/tree/master/test
rm -f A B C
touch A B C touch A B C
PID=$$ PID=$$
unshare --net=B -- ip link set lo up
nsenter --net=B -- ip link add b1 type veth peer B1
nsenter --net=B -- ip link set B1 netns $PID
nsenter --net=B -- ip link set b1 up
ip link set B1 up
unshare --net=A -- ip link set lo up
nsenter --net=A -- ip link add a1 type veth peer A1
nsenter --net=A -- ip link set A1 netns $PID
nsenter --net=A -- ip link set a1 up
ip link set A1 up
ip link add br0 type bridge # vlan_filtering 1 mcast_snooping 0
ip link set B1 master br0
ip link set A1 master br0
ip link set br0 up
nsenter --net=B -- ip addr add 10.0.0.1/24 dev b1
nsenter --net=A -- ip addr add 10.0.0.2/24 dev a1
nsenter --net=B -- ip route add 224.0.0.0/4 dev b1
nsenter --net=A -- ip route add 224.0.0.0/4 dev a1
nsenter --net=B -- xfce4-terminal --title=B &
nsenter --net=A -- xfce4-terminal --title=A &
exit 0
ip link add br0 type bridge # vlan_filtering 1 mcast_snooping 0 ip link add br0 type bridge # vlan_filtering 1 mcast_snooping 0
ip link add type a1 veth peer b1 ip link add a1 type veth peer b1
ip link set b1 master br0 ip link set b1 master br0
ip link set a1 up ip link set a1 up
ip link set b1 up ip link set b1 up
ip link set br0 up ip link set br0 up
unshare --net=B -- ip link set lo up unshare --net=B -- ip link set lo up
nsenter --net=B -- ip link add B1 type veth peer B nsenter --net=B -- ip link add B1 type veth peer B
nsenter --net=B -- ip link set B netns $PID nsenter --net=B -- ip link set B netns $PID
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment