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

.

parent bfe4dc52
...@@ -75,6 +75,8 @@ def main(): ...@@ -75,6 +75,8 @@ def main():
G = G4 G = G4
if "6" in action: if "6" in action:
G = G6 G = G6
if G is None:
raise RuntimeError("4/6 must be specified")
wg = sync.WorkGroup(context.background()) wg = sync.WorkGroup(context.background())
if "tx" in action: if "tx" in action:
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
# 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 B1 A1 a1 a2 A2 C1 c1
# B1 A1 A2 C1 #
# #
# should be run under unshare -mrun . # should be run under unshare -mrun .
# use nsenter --net={A,B,C} to enter into network namespace of A/B/C. # use nsenter --net={A,B,C} to enter into network namespace of A/B/C.
...@@ -36,17 +36,38 @@ ip link set A1 master br0 ...@@ -36,17 +36,38 @@ ip link set A1 master br0
ip link set br0 up ip link set br0 up
# A-br1-C # A-br1-C
nsenter --net=A -- ip link add a2 type veth peer A2
nsenter --net=A -- ip link set A2 netns $PID
nsenter --net=A -- ip link set a2 up
ip link set A2 up
unshare --net=C -- ip link set lo up
nsenter --net=C -- ip link add c1 type veth peer C1
nsenter --net=C -- ip link set C1 netns $PID
nsenter --net=C -- ip link set c1 up
ip link set C1 up
ip link add br1 type bridge # vlan_filtering 1 mcast_snooping 0
ip link set C1 master br1
ip link set A2 master br1
ip link set br1 up
# addresses
nsenter --net=B -- ip addr add 10.0.0.1/24 dev b1 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=A -- ip addr add 10.0.0.2/24 dev a1
nsenter --net=C -- ip addr add 20.0.0.1/24 dev c1
nsenter --net=A -- ip addr add 20.0.0.2/24 dev a2
# multicast routing
nsenter --net=B -- ip route add 224.0.0.0/4 dev b1 nsenter --net=B -- ip route add 224.0.0.0/4 dev b1
nsenter --net=C -- ip route add 224.0.0.0/4 dev c1
nsenter --net=A -- ip route add 224.0.0.0/4 dev a1 nsenter --net=A -- ip route add 224.0.0.0/4 dev a1 # NOTE on A 224.0.0.0/4 is routed
# XXX append route to a2 nsenter --net=A -- ip route append 224.0.0.0/4 dev a2 # to _both_ a1 and a2
# open terminals in A B C for play # open terminals in A B C for play
nsenter --net=B -- xfce4-terminal --title=B & nsenter --net=B -- xfce4-terminal --title=B &
nsenter --net=C -- xfce4-terminal --title=C &
nsenter --net=A -- xfce4-terminal --title=A & nsenter --net=A -- xfce4-terminal --title=A &
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