jail with static IP failed with an error "add net default: gateway 10.0.0.1 fib 0: Network is unreachable"

Janus Ng

Explorer
Joined
Apr 10, 2016
Messages
63
I have created a jail with plugin Nextcloud.

It was running with VNET and DHCP fine.

I edited the configurations with WebUI. I disabled DCHP and put a static IP on it. The values I changed on the Basic properties from the old settings are:

DHCP Autoconfigure IPv4Unchecked
IPv4 Interfacevnet0:bridge0
IPv4 Address10.0.0.27
IPv4 Mask24
IPv4 Default Router10.0.0.1
The rest was unchanged.


I cannot start the jail afterwards. It throws the following error when I tried to start it.
Code:
% sudo iocage start nextcloud
* Ruleset 6 does not exist, using defaults
No default gateway found for ipv6.
* Starting nextcloud
  + Started OK
  + Using devfs_ruleset: 6
  + Configuring VNET FAILED
  route: writing to routing socket: Network is unreachable
add net default: gateway 10.0.0.1 fib 0: Network is unreachable

It worked fine if I enabled DHCP again.

How can I fix the error on static IP?
Many thanks!

FreeNAS version 11.3-RELEASE
The host IP is 10.0.0.30.
Jail Release is 11.3-RELEASE-p6
 
Joined
Jan 7, 2015
Messages
1,155
Do you have 2 NICs in the machine with different IP schemes? Please post ifconfig from a terminal on the host and the jail (if possible).
 

Janus Ng

Explorer
Joined
Apr 10, 2016
Messages
63
Thanks for your reply. Yes, there are 2 NICs on the FreeNAS box. I have just plugged one of them.

The ifconfig output from host:
Code:
freenas% ifconfig -a
bge0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
    description: Primary
    options=c0099<RXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,VLAN_HWTSO,LINKSTATE>
    ether b0:5a:da:87:77:08
    hwaddr b0:5a:da:87:77:08
    inet 10.27.0.21 netmask 0xffffff00 broadcast 10.27.0.255
    nd6 options=9<PERFORMNUD,IFDISABLED>
    media: Ethernet autoselect (1000baseT <full-duplex>)
    status: active
bge1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    description: Secondary
    options=c019b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,VLAN_HWTSO,LINKSTATE>
    ether b0:5a:da:87:77:09
    hwaddr b0:5a:da:87:77:09
    inet 10.27.0.31 netmask 0xffffff00 broadcast 10.27.0.255
    nd6 options=9<PERFORMNUD,IFDISABLED>
    media: Ethernet autoselect (none)
    status: no carrier
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
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
    groups: lo
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether 02:8c:bd:cd:fc:00
    nd6 options=1<PERFORMNUD>
    groups: bridge
    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
    member: vnet0.3 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 7 priority 128 path cost 2000
    member: vnet0.2 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 6 priority 128 path cost 2000
    member: vnet0.1 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 5 priority 128 path cost 2000
    member: bge0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 1 priority 128 path cost 20000
vnet0.1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
    description: associated with jail: plex_2 as nic: epair0b
    options=8<VLAN_MTU>
    ether 02:ff:60:38:24:6b
    hwaddr 02:bb:d0:00:05:0a
    nd6 options=1<PERFORMNUD>
    media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>)
    status: active
    groups: epair
vnet0.2: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
    description: associated with jail: nextcloud as nic: epair0b
    options=8<VLAN_MTU>
    ether 02:ff:60:ba:b5:81
    hwaddr 02:bb:d0:00:06:0a
    nd6 options=1<PERFORMNUD>
    media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>)
    status: active
    groups: epair
vnet0.3: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
    description: associated with jail: tautulli as nic: epair0b
    options=8<VLAN_MTU>
    ether 02:ff:70:00:06:0b
    hwaddr 02:bb:d0:00:07:0a
    nd6 options=1<PERFORMNUD>
    media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>)
    status: active
    groups: epair


ifconfig from the jail with DHCP Autoconfigure IPv4 enabled
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
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
    groups: lo
epair0b: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=8<VLAN_MTU>
    ether 02:ff:60:ba:b5:82
    hwaddr 02:bb:d0:00:07:0b
    inet 10.27.0.23 netmask 0xffffff00 broadcast 10.27.0.255
    nd6 options=1<PERFORMNUD>
    media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>)
    status: active
    groups: epair


On the Jail Edit pane, with both "DHCP Autoconfigure IPv4" unchecked and "VNET" checked, the only option available in "IPv4 Interface" is
"vnet0:bridge0".
Screen Shot 2020-02-27 at 4.09.09 pm.png
 
Joined
Jan 7, 2015
Messages
1,155
I think the main issue is you are trying to specify a gateway IP that is out of your scope no? You are specifying 10.0.0.1 for a gateway when you should be specifying 10.27.0.1. Same thing for the ip. You are trying to specify 10.0.0.27 for an IP
inet 10.27.0.23 netmask 0xffffff00 broadcast 10.27.0.255
when it should in all likelihood be 10.27.0.27 255.255.255.0 10.27.0.1
 

Janus Ng

Explorer
Joined
Apr 10, 2016
Messages
63
Thanks for pointing out. I was just trying to illustrate my problem with a make up setting that similar to mine.

I have set with your suggested settings. It still does not work. :(

Code:
freenas% sudo iocage start nextcloud
Password:
* Ruleset 6 does not exist, using defaults
No default gateway found for ipv6.
* Starting nextcloud
  + Started OK
  + Using devfs_ruleset: 6
  + Configuring VNET FAILED
  route: writing to routing socket: Network is unreachable
add net default: gateway 10.27.0.1 fib 0: Network is unreachable

Stopped nextcloud due to VNET failure

Screen Shot 2020-02-28 at 2.17.42 pm.png
Screen Shot 2020-02-28 at 2.21.33 pm.png
 
Joined
Jan 7, 2015
Messages
1,155
Hmm.. Doent make much sense does it? Does it do the same thing when you give it the exact ip it gets via DHCP?
 

Janus Ng

Explorer
Joined
Apr 10, 2016
Messages
63
No, as stated in the iocage output, it fails with "Network is unreachable" error.
 

chelby

Dabbler
Joined
May 12, 2019
Messages
14
I just wanted to check to see if a solution had been found for this issue
 

lan

Cadet
Joined
Apr 4, 2020
Messages
2
I have the same issue, fresh install of FreeNAS, trying to create jail with VNET:

Code:
# iocage start sogo
No default gateway found for ipv6.
* Starting sogo
  + Started OK
  + Using devfs_ruleset: 6
  + Configuring VNET FAILED
  route: writing to routing socket: Network is unreachable
add net default: gateway 192.168.101.100 fib 0: Network is unreachable

Stopped sogo due to VNET failure


host system is re0:192.168.101.222/24, trying to make jail with VNET:192.168.101.244/24.

ifconfig:

Code:
# ifconfig
re0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: lan
        options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
        ether 10:78:d2:21:b3:b4
        hwaddr 10:78:d2:21:b3:b4
        inet 192.168.101.222 netmask 0xffffff00 broadcast 192.168.101.255
        nd6 options=9<PERFORMNUD,IFDISABLED>
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
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 0x2
        inet 127.0.0.1 netmask 0xff000000
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        groups: lo
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 02:92:82:2c:a8:00
        nd6 options=1<PERFORMNUD>
        groups: bridge
        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
        member: re0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 1 priority 128 path cost 20000


iocage settings for jail:
Code:
# iocage get -a sogo
CONFIG_VERSION:26
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:1
children_max:0
cloned_release:11.3-RELEASE
comment:none
compression:lz4
compressratio:readonly
coredumpsize:off
count:1
cpuset:off
cputime:off
datasize:off
dedup:off
defaultrouter:192.168.101.100
defaultrouter6:auto
depends:none
devfs_ruleset:4
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:sogo
host_hostuuid:sogo
host_time:1
hostid:edf2aec3-580f-11ea-bd0f-1078d221b3b4
hostid_strict_check:0
interfaces:vnet0:bridge0
ip4:new
ip4_addr:vnet0:bridge0|192.168.101.244/24
ip4_saddrsel:1
ip6:new
ip6_addr:none
ip6_saddrsel:1
ip_hostname:0
jail_zfs:0
jail_zfs_dataset:iocage/jails/sogo/data
jail_zfs_mountpoint:none
last_started:none
localhost_ip:none
login_flags:-f root
mac_prefix:1078d2
maxproc:off
memorylocked:off
memoryuse:off
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:11.3-RELEASE-p7
reservation:none
resolver:/etc/resolv.conf
rlimits:off
rtsold:0
securelevel:2
shmsize:off
stacksize:off
state:down
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:none
vnet1_mac:none
vnet2_mac:none
vnet3_mac:none
vnet_default_interface:auto
vnet_interfaces:none
wallclock:off
writebps:off
writeiops:off
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
How does this behave if you leave the Interface setting blank?
 
Top