Problem with networking in vnet jail

173 views
Skip to first unread message

Fery Schwartz

unread,
Feb 27, 2021, 5:49:41 PM2/27/21
to iocage

Hello All,
I would like too set up an iocage jail with vnet but can't make my way forward with it. I have closely followed the iocage documentation but have the following problem.
The jail in on the host with IP 192.168.1.1 which faces the LAN and acts as gateway. There is another physical interface on the host which faces WAN.

The jail starts but there is no access to LAN from it or to the internet from the jail. The  jail doesn't respond to ping from host.

Example of command from inside of the jail
Code:
root@emby2:~ # drill google.com
Error: error sending query: Error creating socket


root@emby2:~ # pkg upgrade
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:12:amd64/quarterly, please wait...
pkg: Error fetching http://pkg.FreeBSD.org/FreeBSD:12:amd64/quarterly/Latest/pkg.txz: No address record
Address resolution failed for http://pkg.FreeBSD.org/FreeBSD:12:amd64/quarterly.
Consider changing PACKAGESITE.


I have noticed this error in dmesg when the jail is starting
Code:
epair0a: Ethernet address: 02:c8:1d:b4:5c:0a
epair0b: Ethernet address: 02:c8:1d:b4:5c:0b
epair0a: link state changed to UP
epair0b: link state changed to UP
epair0a: changing name to 'vnet0.28'
ng_ether_ifnet_arrival_event: can't re-name node epair0b
igb0: link state changed to DOWN
vnet0.28: promiscuous mode enabled
lo0: link state changed to UP
igb0: link state changed to UP


This is ifconfig on the host
Code:
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500      options=81249b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LRO,WOL_MAGIC,VLAN_HWFILTER>
        ether 90:1b:0e:89:41:e9
        inet 172.20.1.0 netmask 0xfffffff8 broadcast 172.20.1.7
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
igb0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500      options=a520b9<RXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,WOL_MAGIC,VLAN_HWFILTER,VLAN_HWTSO,RXCSUM_IPV6>
        ether 90:1b:0e:6b:c6:d4
        inet 192.168.1.1 netmask 0xffffff00 broadcast 192.168.1.255
        inet 192.168.1.103 netmask 0xffffff00 broadcast 192.168.1.255
        inet 192.168.1.101 netmask 0xffffff00 broadcast 192.168.1.255
        inet 192.168.1.100 netmask 0xffffff00 broadcast 192.168.1.255
        inet 192.168.1.102 netmask 0xffffff00 broadcast 192.168.1.255
        media: Ethernet autoselect (1000baseT <full-duplex>)
        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 0x3
        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 02:e3:8d:a8:06:00
        id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto stp-rstp maxaddr 2000 timeout 1200
        root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
        member: vnet0.28 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 6 priority 128 path cost 2000
        member: igb0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 2 priority 128 path cost 2000000
        groups: bridge
        nd6 options=9<PERFORMNUD,IFDISABLED>
tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1492
        options=80000<LINKSTATE>
        inet X.X.X.X --> Y.Y.Y.Y netmask 0xffffffff
        groups: tun
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        Opened by PID 742
vnet0.28: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: associated with jail: emby2 as nic: epair0b
        options=8<VLAN_MTU>
        ether 02:ff:60:77:9d:9f
        hwaddr 02:c8:1d:b4:5c:0a
        inet6 fe80::ff:60ff:fe77:9d9f%vnet0.28 prefixlen 64 scopeid 0x6
        groups: epair
        media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>)
        status: active
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>


This is ifconfig inside the jail
Code:
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 0x1
       inet 127.0.0.1 netmask 0xff000000
       groups: lo
       nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
epair0b: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
       options=8<VLAN_MTU>
       ether 02:ff:60:77:9d:a0
       hwaddr 02:c8:1d:b4:5c:0b
       inet 192.168.1.104 netmask 0xffffff00 broadcast 192.168.1.255
       inet6 fe80::ff:60ff:fe77:9da0%epair0b prefixlen 64 scopeid 0x2
       groups: epair
       media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>)
       status: active
       nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>



This is /etc/sysctl.conf

Code:
net.inet.ip.forwarding=1
net.link.bridge.pfil_onlyip=0
net.link.bridge.pfil_bridge=0
net.link.bridge.pfil_member=0


This are the relevant bit in /etc/rc.conf

Code:
# Network configuration
ifconfig_em0="172.20.1.0/29 up"
ifconfig_igb0="inet 192.168.1.1 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
cloned_interfaces="bridge0"
ifconfig_bridge0="addm igb0 up"

# Start ssh and time sync
sshd_enable="YES"
ntpd_enable="YES"

# Needed for firewall and NAT
gateway_enable="YES"

Can you help me find out what is going on?



Fery Schwartz

unread,
Feb 27, 2021, 5:53:22 PM2/27/21
to iocage
$ sudo iocage get all emby2
CONFIG_VERSION:27
allow_chflags:0
allow_mlock:0
allow_mount:0
allow_mount_devfs:0
allow_mount_fusefs:0
allow_mount_nullfs:0
allow_mount_procfs:0
allow_mount_tmpfs:0
allow_mount_zfs:0
allow_quotas:0
allow_raw_sockets:0
allow_set_hostname:1
allow_socket_af:0
allow_sysvipc:0
allow_tun:0
allow_vmm:0
assign_localhost:0
available:readonly
basejail:0
boot:0
bpf:0
children_max:0
cloned_release:12.2-RELEASE
comment:none
compression:lz4
compressratio:readonly
coredumpsize:off
count:1
cpuset:off
cputime:off
datasize:off
dedup:off
defaultrouter:192.168.1.1
defaultrouter6:auto
depends:none
devfs_ruleset:1001
dhcp:0
enforce_statfs:2
exec_clean:1
exec_created:/usr/bin/true
exec_fib:0
exec_jail_user:root
exec_poststart:/usr/bin/true
exec_poststop:/usr/bin/true
exec_prestart:/usr/bin/true
exec_prestop:/usr/bin/true
exec_start:/bin/sh /etc/rc
exec_stop:/bin/sh /etc/rc.shutdown
exec_system_jail_user:0
exec_system_user:root
exec_timeout:60
host_domainname:none
host_hostname:emby2
host_hostuuid:emby2
host_time:1
hostid:ca2ad479-05c4-11e7-ad91-901b0e8941e9
hostid_strict_check:0
interfaces:vnet0:bridge0
ip4:new
ip4_addr:vnet0|192.168.1.104/24
ip4_saddrsel:1
ip6:disable
ip6_addr:none
ip6_saddrsel:1
ip_hostname:0
jail_zfs:0
jail_zfs_dataset:iocage/jails/emby2/data
jail_zfs_mountpoint:none
last_started:2021-02-27 22:27:39
localhost_ip:none
login_flags:-f root
mac_prefix:02ff60
maxproc:off
memorylocked:off
memoryuse:off
min_dyn_devfs_ruleset:1000
mount_devfs:1
mount_fdescfs:1
mount_linprocfs:0
mount_procfs:0
mountpoint:readonly
msgqqueued:off
msgqsize:off
nat:0
nat_backend:ipfw
nat_forwards:none
nat_interface:none
nat_prefix:172.16
nmsgq:off
notes:none
nsem:off
nsemop:off
nshm:off
nthr:off
openfiles:off
origin:readonly
owner:root
pcpu:off
plugin_name:none
plugin_repository:none
priority:99
pseudoterminals:off
quota:none
readbps:off
readiops:off
release:12.2-RELEASE-p2
reservation:none
resolver:/etc/resolv.conf
rlimits:off
rtsold:0
securelevel:2
shmsize:off
stacksize:off
state:up
stop_timeout:30
swapuse:off
sync_state:none
sync_target:none
sync_tgt_zpool:none
sysvmsg:new
sysvsem:new
sysvshm:new
template:0
type:jail
used:readonly
vmemoryuse:off
vnet:1
vnet0_mac:02ff60779d9f 02ff60779da0
vnet1_mac:none
vnet2_mac:none
vnet3_mac:none
vnet_default_interface:auto
vnet_interfaces:none
wallclock:off
writebps:off
writeiops:off

Reply all
Reply to author
Forward
0 new messages