{"id":14,"date":"2017-08-29T12:00:00","date_gmt":"2017-08-29T12:00:00","guid":{"rendered":""},"modified":"2021-02-22T01:13:45","modified_gmt":"2021-02-22T01:13:45","slug":"enable-tuntap-in-proxmox-4-lxc","status":"publish","type":"post","link":"https:\/\/www.tech-and-dev.com\/blog\/2017\/08\/enable-tuntap-in-proxmox-4-lxc.html","title":{"rendered":"Enable Tun\/Tap in Proxmox 4 LXC Containers"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left;\">\n<div style=\"clear: both; text-align: center;\"><a style=\"margin-left: 1em; margin-right: 1em;\" href=\"https:\/\/www.tech-and-dev.com\/blog\/wp-content\/uploads\/2017\/08\/proxmox-logo.png\"><img decoding=\"async\" src=\"https:\/\/www.tech-and-dev.com\/blog\/wp-content\/uploads\/2017\/08\/proxmox-logo.png\" border=\"0\" data-original-height=\"250\" data-original-width=\"250\" \/><\/a><\/div>\n<h2 style=\"text-align: left;\">In your host server (Where Proxmox is installed)<\/h2>\n<p>Replace all the below &#8220;<span style=\"color: magenta;\">$ID<\/span>&#8221; with your container ID (CT id)<\/p>\n<p>Shutdown your container:<\/p>\n<pre>pct shutdown $ID<\/pre>\n<p><a name=\"more\"><\/a><br \/>\nEdit the LXC configuration file<\/p>\n<pre>vim \/etc\/pve\/lxc\/$ID.conf<\/pre>\n<p>Add the following 2 lines at the end of the file<\/p>\n<pre>lxc.hook.autodev: \/var\/lib\/lxc\/$ID\/tuntap\r\nlxc.cgroup.devices.allow = c 10:200 rwm<\/pre>\n<p>Create the tuntap file in \/var\/lib\/lxc\/$ID<\/p>\n<pre>vi \/var\/lib\/lxc\/$ID\/tuntap<\/pre>\n<p>and paste the following in it:<\/p>\n<pre>#!\/bin\/bash\r\ncd ${LXC_ROOTFS_MOUNT}\/dev\r\nmkdir net\r\nmknod net\/tun c 10 200\r\nchmod 0666 net\/tun<\/pre>\n<p>Make the tuntap file executable<\/p>\n<pre>chmod +x \/var\/lib\/lxc\/$ID\/tuntap<\/pre>\n<p>Start your container:<\/p>\n<pre>pct start $ID<\/pre>\n<p>&nbsp;<\/p>\n<h2 style=\"text-align: left;\">In your container, check that Tun\/Tap is enabled:<\/h2>\n<p>&nbsp;<\/p>\n<pre>cat \/dev\/net\/tun<\/pre>\n<p>If Tun\/Tap is enabled and active you will see the following message:<\/p>\n<pre>cat: \/dev\/net\/tun: File descriptor in bad state<\/pre>\n<p><b>Questions or Comments? Leave them below!<\/b><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In your host server (Where Proxmox is installed) Replace all the below &#8220;$ID&#8221; with your container ID (CT id) Shutdown your container: pct shutdown $ID Edit the LXC configuration file vim \/etc\/pve\/lxc\/$ID.conf Add the following 2 lines at the end of the file lxc.hook.autodev: \/var\/lib\/lxc\/$ID\/tuntap lxc.cgroup.devices.allow = c 10:200 rwm Create the tuntap file in [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[6,19,20],"tags":[],"class_list":["post-14","post","type-post","status-publish","format-standard","hentry","category-linux","category-proxmox","category-virtualization"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/posts\/14","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/comments?post=14"}],"version-history":[{"count":3,"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/posts\/14\/revisions"}],"predecessor-version":[{"id":386,"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/posts\/14\/revisions\/386"}],"wp:attachment":[{"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/media?parent=14"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/categories?post=14"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/tags?post=14"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}