Skip to content

Instantly share code, notes, and snippets.

@larsch
Created November 30, 2016 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save larsch/87f47a4eb95bf0fa0ad07453b54a1583 to your computer and use it in GitHub Desktop.
Save larsch/87f47a4eb95bf0fa0ad07453b54a1583 to your computer and use it in GitHub Desktop.
#!/bin/sh -exu
ip netns delete ns1
ip netns delete ns2
ip netns add ns1
ip netns add ns2
ip link add veth-ns1 type veth peer name veth-ns2
ip link set veth-ns1 netns ns1
ip link set veth-ns2 netns ns2
ip -n ns1 link set veth-ns1 up
ip -n ns2 link set veth-ns2 up
ip -n ns1 address add 10.0.0.1/30 dev veth-ns1
ip -n ns2 address add 10.0.0.2/30 dev veth-ns2
ip netns exec ns1 ping -c 1 10.0.0.2
ip netns exec ns2 ping -c 1 10.0.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment