Skip to content

Instantly share code, notes, and snippets.

@lmlsna
Last active October 17, 2017 18:16
Show Gist options
  • Select an option

  • Save lmlsna/1af94ab3e29a8980c1c4e0e3b5b8d857 to your computer and use it in GitHub Desktop.

Select an option

Save lmlsna/1af94ab3e29a8980c1c4e0e3b5b8d857 to your computer and use it in GitHub Desktop.
Enable a lxc container to use a tuntap device
# Add these lines to the container's config
lxc.cgroup.devices.allow = c 10:200
lxc.hook.start /usr/local/bin/mktun
#!/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