Created
November 30, 2016 09:34
-
-
Save larsch/87f47a4eb95bf0fa0ad07453b54a1583 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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