Created
July 30, 2017 15:15
-
-
Save Stary2001/5451d8f0e708d532266b0254333d0230 to your computer and use it in GitHub Desktop.
when you really want to be someone else just for a second
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/bash | |
function cleanup { | |
brctl delif 9net-bridge vethgw0 | |
#ip netns exec blue ip link del vethgw1 type veth | |
ip link del vethgw0 type veth | |
ip netns del blue | |
} | |
trap cleanup EXIT | |
gw=$1 | |
shift | |
ip netns add blue | |
ip link add vethgw0 type veth peer name vethgw1 | |
ip link set vethgw0 up | |
ip link set vethgw1 netns blue | |
ip netns exec blue ip addr add 172.31.0.238/16 dev vethgw1 | |
ip netns exec blue ip link set vethgw1 up | |
ip netns exec blue ip r add default via $gw | |
brctl addif 9net-bridge vethgw0 | |
ip netns exec blue "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment