1simp destroy ".*" 2simp create -o sw1:rocker:sw1 tut tut.dot 3simp start tut 4sleep 10 5while ! simp ssh tut sw1 --cmd "ping -c 1 localhost >/dev/null"; do sleep 1; done 6while ! simp ssh tut h1 --cmd "ping -c 1 localhost >/dev/null"; do sleep 1; done 7while ! simp ssh tut h2 --cmd "ping -c 1 localhost >/dev/null"; do sleep 1; done 8 9# configure a 2-port bridge 10 11simp ssh tut sw1 --cmd "sudo /sbin/ip link add name br0 type bridge" 12simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev swp1 master br0" 13simp ssh tut sw1 --cmd "sudo /sbin/ip link set dev swp2 master br0" 14 15# turn off vlan default_pvid on br0 16# turn on vlan filtering on br0 17 18simp ssh tut sw1 --cmd "echo 0 | sudo dd of=/sys/class/net/br0/bridge/default_pvid 2> /dev/null" 19simp ssh tut sw1 --cmd "echo 1 | sudo dd of=/sys/class/net/br0/bridge/vlan_filtering 2> /dev/null" 20 21# add both ports to VLAN 57 22 23simp ssh tut sw1 --cmd "sudo /sbin/bridge vlan add vid 57 dev swp1 master" 24simp ssh tut sw1 --cmd "sudo /sbin/bridge vlan add vid 57 dev swp2 master" 25 26# turn off learning and flooding in SW 27 28simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 learning off" 29simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 learning off" 30 31simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 flood off" 32simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 flood off" 33 34# turn on learning in HW 35 36simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp1 learning on self" 37simp ssh tut sw1 --cmd "sudo /sbin/bridge link set dev swp2 learning on self" 38 39# bring up bridge and ports 40 41simp ssh tut sw1 --cmd "sudo ifconfig br0 up" 42simp ssh tut sw1 --cmd "sudo ifconfig swp1 up" 43simp ssh tut sw1 --cmd "sudo ifconfig swp2 up" 44 45# config IP on host VLANs 46 47simp ssh tut h1 --cmd "sudo vconfig add swp1 57 >/dev/null 2>&1" 48simp ssh tut h1 --cmd "sudo ifconfig swp1 up" 49simp ssh tut h1 --cmd "sudo ifconfig swp1.57 11.0.0.1/24" 50 51simp ssh tut h2 --cmd "sudo vconfig add swp1 57 >/dev/null 2>&1" 52simp ssh tut h2 --cmd "sudo ifconfig swp1 up" 53simp ssh tut h2 --cmd "sudo ifconfig swp1.57 11.0.0.2/24" 54 55# test... 56 57simp ssh tut h1 --cmd "ping -c10 11.0.0.2 >/dev/null" 58