Scott Feldman | 63d2ada | 2015-03-13 21:09:31 -0700 | [diff] [blame] | 1 | simp destroy ".*" |
| 2 | simp create -o sw1:rocker:sw1 tut tut.dot |
| 3 | simp start tut |
| 4 | sleep 10 |
| 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 |
| 8 | |
| 9 | # configure a 2-port bridge |
| 10 | |
| 11 | simp ssh tut sw1 --cmd "sudo /sbin/ip link add name br0 type bridge" |
Scott Feldman | 73da023 | 2015-06-10 18:21:19 -0700 | [diff] [blame] | 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" |
Scott Feldman | 63d2ada | 2015-03-13 21:09:31 -0700 | [diff] [blame] | 14 | |
| 15 | # turn off vlan default_pvid on br0 |
| 16 | |
| 17 | simp ssh tut sw1 --cmd "echo 0 | sudo dd of=/sys/class/net/br0/bridge/default_pvid 2> /dev/null" |
| 18 | |
| 19 | # turn off learning and flooding in SW |
| 20 | |
Scott Feldman | 73da023 | 2015-06-10 18:21:19 -0700 | [diff] [blame] | 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" |
Scott Feldman | 63d2ada | 2015-03-13 21:09:31 -0700 | [diff] [blame] | 23 | |
Scott Feldman | 73da023 | 2015-06-10 18:21:19 -0700 | [diff] [blame] | 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" |
Scott Feldman | 63d2ada | 2015-03-13 21:09:31 -0700 | [diff] [blame] | 26 | |
| 27 | # bring up bridge and ports |
| 28 | |
| 29 | simp ssh tut sw1 --cmd "sudo ifconfig br0 up" |
Scott Feldman | 73da023 | 2015-06-10 18:21:19 -0700 | [diff] [blame] | 30 | simp ssh tut sw1 --cmd "sudo ifconfig sw1p1 up" |
| 31 | simp ssh tut sw1 --cmd "sudo ifconfig sw1p2 up" |
Scott Feldman | 63d2ada | 2015-03-13 21:09:31 -0700 | [diff] [blame] | 32 | simp ssh tut sw1 --cmd "sudo ifconfig br0 11.0.0.3/24" |
| 33 | |
| 34 | # config IP on hosts |
| 35 | |
Scott Feldman | 73da023 | 2015-06-10 18:21:19 -0700 | [diff] [blame] | 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" |
Scott Feldman | 63d2ada | 2015-03-13 21:09:31 -0700 | [diff] [blame] | 38 | |
| 39 | # test... |
| 40 | |
| 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" |