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/c38854460e8713b0bc6dbf467daeedf0 to your computer and use it in GitHub Desktop.
Save larsch/c38854460e8713b0bc6dbf467daeedf0 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 link add veth-ns1 type veth peer name veth-ns2
ip link set veth-ns1 netns ns1
ip -n ns1 link set veth-ns1 up
ip link set veth-ns2 up
ip -n ns1 address add 10.0.0.1/30 dev veth-ns1
ip address add 10.0.0.2/30 dev veth-ns2
ip netns exec ns1 ping -c 1 10.0.0.2
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