Create tap device within jail for qemu

SanPollo

Cadet
Joined
Jun 6, 2021
Messages
2
Hi there,

I am running qemu in a FreeNAS 11.3 jail because I need to emulate a different architecture. I want to create a tap device to give the qemu VM access to the internet, but I'm quite new to jails, so I may be looking at this the wrong way.

The first thing I did was to check ifconfig within the jail to find its network device. It showed up as epair0b.

Then I tried to create a tap interface, a bridge, and then to add the tap device, and epair0b to the bridge. This didn't work:

# ifconfig tap0 create # ifconfig bridge0 create # ifconfig bridge0 addm tap0 epair0b ifconfig: epair0b: bad value #

tap0 appears in the jail's interface list but not in /dev
tap0 appears in the host's /dev but not in its interface list

When I ran ifconfig tap0 destroy within the jail its /dev/tap0 disappeared from the host. I didn't think jails were supposed to be able to affect the host like this.

Does anyone have a workaround for this? I'm quite new to jails so I might just be doing something silly. :smile:

Many thanks in advance.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Jails dont's own /dev, they map it to the host via a devfs_ruleset.

Depending on the ruleset, the jail can see and/or impact the host's devs.

 

SanPollo

Cadet
Joined
Jun 6, 2021
Messages
2
Many thanks for your reply. I created the jail in the FreeNAS UI with default settings. Do you have any idea how I can create a tap device that’s accessible by the jail and that qemu can therefore use?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Do you have any idea how I can create a tap device that’s accessible by the jail and that qemu can therefore use?
Not really. I have never personally needed to do that in a jail (I think what you're doing is a fairly unique thing).

I would suggest looking into the threads which deal with VPN services like OpenVPN in a jail, which I think may give you the right hints as they tend to deal with tap interfaces.

Again, I have never needed to use those either, so can't recommend a good one that works, unfortunately, but I'm sure that there are some in the forum.
 
Top