# vnet  + openvpn



## Sebastian (Sep 11, 2018)

Hello ,

I woud like to move my vpn server from my router to a jail.

After reading a lot of stuff , I could finally make it work  ! 

But openvpn does only work until I restart the jail .

I can restart and stop the openvpn service and the service comes back after a few seconds.

I'm using cbsd , after doing a cbsd jstop 'jailname' . The jail stops .

If I start the jail again. The tun interface inside the jail is not generated. I don't know why and how this is implemented... Would like to dig deeper , but I could not find anything.

Without a tun interface openvpn can't work .


```
Sep 11 21:18:46 vpn openvpn[15992]: ROUTE_GATEWAY 192.168.10.1/255.255.255.0 IFACE=eth0 HWADDR=00:a0:98:e3:62:64
Sep 11 21:18:46 vpn openvpn[15992]: Cannot open TUN/TAP dev /dev/tun1: No such file or directory (errno=2)
Sep 11 21:18:46 vpn openvpn[15992]: Exiting due to fatal error
```


I could find a lot of threads about this topic , but none of the provided solutions fixed my problem .

On my host systems where the tun interfaces were generated I found something special .

I tried to create a new tun interface just for testing .

#ifconfig tun create

This worked out of the box . If I do the command again. tun2 is genereated and not tun1 .

So , normally there should be a tun1 interface , but there is no one.

freebsd% ifconfig tun1
ifconfig: interface tun1 does not exist

Ok , lets create it.

freebsd% sudo ifconfig tun1 create
ifconfig: SIOCIFCREATE2: File exists

What ????

freebsd% sudo ifconfig tun1 destroy
ifconfig: interface tun1 does not exist

Hmm, at this point I don't know how to go further, I hope something can give me a hint.

Possible Workaround : Reboot the host  , problem is fixed until restarting the jail .

best regards, sebastian


----------

