Last active
December 17, 2017 12:52
-
-
Save pottedplant/6e7f6fa3caa0a348dd0093943c030437 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/bash -xe | |
IFNAME=vei_`date +'%s'` | |
unshare --mount -- bash -e -c \ | |
" | |
mount -t tmpfs none /etc/isolation_redirects/net | |
touch /etc/isolation_redirects/net/ns | |
unshare --net -- bash -e -c \\ | |
\" | |
ip link add veth0 type veth peer name $IFNAME | |
ip link set $IFNAME netns /proc/1/ns/net | |
mount -o bind /proc/\\$\\$/ns/net /etc/isolation_redirects/net/ns | |
\" | |
ip link set $IFNAME up | |
brctl addif lxd.sandbox $IFNAME | |
touch /etc/isolation_redirects/net/resolv.conf | |
nsenter --net=/etc/isolation_redirects/net/ns -- bash -e -c \\ | |
\" | |
busybox udhcpc -i veth0 | |
echo 'success, spawning shell' | |
/bin/bash -l | |
\" | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment