Last active
October 17, 2017 18:16
-
-
Save lmlsna/1af94ab3e29a8980c1c4e0e3b5b8d857 to your computer and use it in GitHub Desktop.
Enable a lxc container to use a tuntap device
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
| # Add these lines to the container's config | |
| lxc.cgroup.devices.allow = c 10:200 | |
| lxc.hook.start /usr/local/bin/mktun |
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
| #!/bin/bash | |
| # Put this shell script in the container rootfs (in $PATH) | |
| if [[ ! -d /dev/net ]]; then | |
| mkdir /dev/net | |
| fi | |
| if [[ ! -c /dev/net/tun ]]; then | |
| mknod /dev/net/tun c 10 200 | |
| chmod 775 /dev/net/tun | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment