Advertisement
Guest User

Untitled

a guest
Oct 10th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.64 KB | None | 0 0
  1. #working configuration
  2. ip netns add h1
  3. ip netns add h2
  4.  
  5. ovs-vsctl add-br s2
  6.  
  7. ip link add h1-eth0 type veth peer name s2-eth2
  8. ip link add h2-eth0 type veth peer name s2-eth3
  9.  
  10. ovs-vsctl add-port s2 s2-eth2
  11. ovs-vsctl add-port s2 s2-eth3
  12.  
  13. ip link set h1-eth0 netns h1
  14. ip link set h2-eth0 netns h2
  15.  
  16. ovs-vsctl set-controller s2 tcp:127.0.0.1
  17.  
  18. controller ptcp: &
  19.  
  20. ip netns exec h1 ip addr add 10.0.0.1/8 dev h1-eth0
  21. ip netns exec h2 ip addr add 10.0.0.2/8 dev h2-eth0
  22.  
  23. ip netns exec h1 ip link set h1-eth0 up
  24. ip netns exec h2 ip link set h2-eth0 up
  25.  
  26. ip link set s2-eth2 up
  27. ip link set s2-eth3 up
  28.  
  29. ip netns exec h1 ping -c1 10.0.0.2
  30. ip netns exec h2 ping -c1 10.0.0.1
  31.  
  32. #remove all netns and stop all controllers
  33. ip netns | xargs -I {} sudo ip netns delete {}
  34. mn -c
  35.  
  36. # nonworking configuration
  37.  
  38. ip netns add h1
  39. ip netns add h2
  40. ip netns add sw2
  41.  
  42. ovs-vsctl add-br s2
  43.  
  44. ip link add h1-eth0 type veth peer name s2-eth2
  45. ip link add h2-eth0 type veth peer name s2-eth3
  46.  
  47. ovs-vsctl add-port s2 s2-eth2
  48. ovs-vsctl add-port s2 s2-eth3
  49.  
  50. ip link set h1-eth0 netns h1
  51. ip link set h2-eth0 netns h2
  52.  
  53. ip link set s2-eth2 netns sw2
  54. ip link set s2-eth3 netns sw2
  55. ip link set s2 netns sw2
  56.  
  57. ip netns exec sw2 ovs-vsctl set-controller s2 tcp:127.0.0.1
  58.  
  59. ip netns exec sw2 controller ptcp: &
  60.  
  61. ip netns exec h1 ip addr add 10.0.0.1/8 dev h1-eth0
  62. ip netns exec h2 ip addr add 10.0.0.2/8 dev h2-eth0
  63.  
  64. ip netns exec h1 ip link set h1-eth0 up
  65. ip netns exec h2 ip link set h2-eth0 up
  66.  
  67. ip netns exec sw2 ip link set s2-eth2 up
  68. ip netns exec sw2 ip link set s2-eth3 up
  69.  
  70. ip netns exec h1 ping -c1 10.0.0.2
  71. ip netns exec h2 ping -c1 10.0.0.1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement