jails Trying to figure out vnet

Hi, Kind of new to freebsd, and im trying to create a jail that has networking, but the ip of the jail is set inside of the jail itself, instead of in the host system. i did some research and found this guide:

https://wiki.freebsd.org/Jails#VNET-based_networking_for_jails
however i just couldnt get it to work at all.

So, im going to share some of my config so maybe someone can see where ive gone wrong.

This is what i see when i type ifconfig on the host:
Code:
vmx0: flags=8822<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=4e403bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6,NOMAP>
        ether 00:50:56:91:12:76
        media: Ethernet autoselect
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
vmx1: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=4e403bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6,NOMAP>
        ether 00:50:56:91:0f:63
        inet 10.8.0.31 netmask 0xffffff00 broadcast 10.8.0.255
        media: Ethernet autoselect
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
vmx3: flags=8822<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=4e403bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6,NOMAP>
        ether 00:50:56:91:e1:c6
        media: Ethernet autoselect
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x5
        inet 127.0.0.1 netmask 0xff000000
        groups: lo
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 58:9c:fc:10:af:10
        id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
        root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
        groups: bridge
        nd6 options=9<PERFORMNUD,IFDISABLED>

i dont think that bridge is doing anything so you can just ignore that i suppose, i dont even remember putting it there lol.
This is the rc.conf of the host:


Code:
ifconfig_vmx1="inet 10.8.0.31 netmask 255.255.255.0"
ifconfig_vmx2="inet 10.1.0.148 netmask 255.255.255.0"
defaultrouter="10.8.0.1"
hostname="abz-host-bsd-1"
sshd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
gateway_enable="YES"
zfs_enable="YES"
jail_enable="YES"

and here is my jail.conf:


Code:
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.clean;
mount.devfs;
allow.raw_sockets = 1;

test {
    path = /usr/local/jails/test;
    host.hostname = "test";
    vnet;
    vnet.interface = vmx2;
}

oh also the rc.conf of the jail.

Code:
ifconfig_vmx2="inet 10.1.0.40 netmask 255.255.255.0"
defaultrouter="10.8.0.1"
sshd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"

so yeah, im not too sure where ive gone wrong, but if somebody could have a look and find any mistakes that would be much appreciated. Im on FreeBSD 13.2 i believe.
 
Have a look in the handbook, it has a good example of a VNET jail:


Your jail.conf is missing some crucial settings.
 
Have a look in the handbook, it has a good example of a VNET jail:


Your jail.conf is missing some crucial settings.
i was expecting to get some errors to be honest but no, it actually ran. so, inside the jail, i still cant ping 1.1.1.1, its just giving no route to host. so do you know if theres something i need to put inside of the jails rc.conf?
 
its just giving no route to host.

Code:
ifconfig_vmx2="inet 10.1.0.40 netmask 255.255.255.0" 
defaultrouter="10.8.0.1"
Your gateway is outside of your 10.1.0.0/24 subnet. How's it supposed to reach that? The gateway address must be within the same subnet or you won't be able to get out of it.
 
Back
Top