Advertisement
teknoraver

ovs dec_ttl

Nov 4th, 2019
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.87 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. PATH=/mnt/host/src/redhat/ovs/utilities:$PATH
  4.  
  5. sysctl -qw net.ipv6.conf.all.disable_ipv6=1
  6.  
  7. ovs-dpctl add-dp dp
  8.  
  9. ip -b - <<'EOF'
  10. netns add ns
  11. netns exec ns sysctl -qw net.ipv6.conf.all.disable_ipv6=1
  12. link add type veth
  13. link add type veth peer name veth0 netns ns
  14. link set veth0 up
  15. link set veth1 up
  16. link set veth2 up
  17. addr add 192.168.0.1/24 dev veth0
  18. link set veth0 up
  19. EOF
  20.  
  21. ip -b - -n ns <<'EOF'
  22. addr add 192.168.0.2/24 dev veth0
  23. link set veth0 up
  24. EOF
  25.  
  26. ovs-dpctl add-if dp veth1
  27. ovs-dpctl add-if dp veth2
  28. ovs-dpctl add-flow 'in_port(1),eth(),eth_type(0x806),arp()' 2
  29. ovs-dpctl add-flow 'in_port(2),eth(),eth_type(0x806),arp()' 1
  30. ovs-dpctl add-flow 'in_port(1),eth(),eth_type(0x800),ipv4()' dec_ttl,2
  31. ovs-dpctl add-flow 'in_port(2),eth(),eth_type(0x800),ipv4()' dec_ttl,1
  32.  
  33. ip netns exec ns tcpdump -tvnni veth0 ip &
  34. ping -qc1 -w1 -t 42 192.168.0.2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement