Solved Can't create tun interface in jail

I'm trying to create a jail with the capability to create tun interfaces, no success so far :(, Here is the method I'm using to create a jail:
Code:
host# uname -a
FreeBSD host 12.1-RELEASE-p3 FreeBSD 12.1-RELEASE-p3 GENERIC amd64

host# mkdir /root/my_jail
host# bsdinstall jail /root/my_jail
host# freebsd-update -b /root/my_jail fetch install

host# vi /etc/devfs.rules
[devfsrules_my_jail=10]
add include $devfsrules_jail
add path 'tun*' unhide

host# [cmd]service devfs restart[/cmd]
host# [cmd]devfs rule -s 10 show[/cmd]
100 include 4
200 path tun* unhide

host# vi /etc/jail.conf
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.clean;

host.hostname = $name;
path = "/root/$name";

allow.mount;
allow.mount.devfs;
allow.chflags;
allow.raw_sockets;
mount.devfs;

my_jail {
devfs_ruleset = "10";
}

host# service jail onestart
Starting jails: my_jail.

host# jexec 1 /bin/sh
in my_jail# hostname
my_jail
in my_jail# uname -a
FreeBSD vpn1 12.1-RELEASE-p3 FreeBSD 12.1-RELEASE-p3 GENERIC amd64
in my_jail# ifconfig tun create
ifconfig: socket(family 2,SOCK_DGRAM): Protocol not supported
my_jail#
There is something missing here, but what?

Thanks
 
Hello again,
I think you need a vnet jail to create interfaces from inside the jail.
You can confirm this by adding "vnet;" to your jail's config.
Code:
my_jail {
    vnet;
    devfs_ruleset = "10";
}
 
Back
Top