Last active
August 29, 2015 14:26
-
-
Save flashvoid/ef023101213aa0729a4f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
==terminal 1=== | |
ip netns add space-a | |
ip netns add space-b | |
ip link add veth0 type veth peer name veth1 | |
ip link set veth1 netns space-a | |
ip link add veth2 type veth peer name veth3 | |
ip link set veth3 netns space-b | |
ifconfig veth0 10.0.0.0/31 up | |
ifconfig veth2 10.0.0.2/31 up | |
route add -host 10.0.0.1 dev veth0 | |
route add -host 10.0.0.3 dev veth2 | |
dnsmasq --no-daemon --dhcp-range=10.0.0.1,10.0.0.1,4h --dhcp-range=10.0.0.3,10.0.0.3,4h --log-dhcp --dhcp-leasefile=/tmp/test.lease | |
===terminal 2=== | |
ip netns exec space-a ifconfig veth1 up | |
ip netns exec space-a dhclient -v veth1 | |
ip netns exec space-a ping 8.8.8.8 #assuming you have masquerade from 10.0.0.1 | |
===terminal 3=== | |
ip netns exec space-b ifconfig veth3 up | |
ip netns exec space-b dhclient -v veth3 | |
ip netns exec space-b ping 8.8.8.8 #assuming you have masquerade from 10.0.0.3 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment