2 simp create -o sw1:rocker:sw1 tut tut.dot
5 while ! simp ssh tut sw1 --cmd "ping -c 1 localhost >/dev/null"; do sleep 1; done
6 while ! simp ssh tut h1 --cmd "ping -c 1 localhost >/dev/null"; do sleep 1; done
7 while ! simp ssh tut h2 --cmd "ping -c 1 localhost >/dev/null"; do sleep 1; done
9 # configure a 2-port bridge
11 simp ssh tut sw1 --cmd "sudo /sbin/ip link add name br0 type bridge"
12 simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev sw1p1 master br0"
13 simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev sw1p2 master br0"
15 # turn off vlan default_pvid on br0
17 simp ssh tut sw1 --cmd "echo 0 | sudo dd of=/sys/class/net/br0/bridge/default_pvid 2> /dev/null"
19 # turn off learning and flooding in SW
21 simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p1 learning off"
22 simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p2 learning off"
24 simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p1 flood off"
25 simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev sw1p2 flood off"
27 # bring up bridge and ports
29 simp ssh tut sw1 --cmd "sudo ifconfig br0 up"
30 simp ssh tut sw1 --cmd "sudo ifconfig sw1p1 up"
31 simp ssh tut sw1 --cmd "sudo ifconfig sw1p2 up"
32 simp ssh tut sw1 --cmd "sudo ifconfig br0 11.0.0.3/24"
36 simp ssh tut h1 --cmd "sudo ifconfig sw1p1 11.0.0.1/24"
37 simp ssh tut h2 --cmd "sudo ifconfig sw1p1 11.0.0.2/24"
41 simp ssh tut h1 --cmd "ping -c10 11.0.0.2 >/dev/null"
42 if [ $? -ne 0 ]; then exit 1; fi
43 simp ssh tut h1 --cmd "ping -c10 11.0.0.3 >/dev/null"