Jails: do not break network on start when cable unplugged

Phil1295

Explorer
Joined
Sep 20, 2020
Messages
79
Hi,

I am wondering how to get this to work:
When a jail is started and the "default router" is not reachable (router offline, cable unplugged...), the jail will fail on start in two ways:
- manual setup: the jail starts but any network service on the jail will fail to properly be accessible
- DHCP: jail will fail to start instead of starting and then wait / retry for a DHCP lease when DHCP server is back online

My issue is that if the main TrueNAS system is restarted while the DHCP server or gateway router is down, the jails will need a manual restart to make the network services available

I really did not figure out the issue. I tried editing the /etc/resolv.conf to manually set a DNS server without luck

In a windows machine or the main TrueNAS system, this issue is not present when a manual IP/router are set. In TrueNAS host however, if DHCP config is set, and DHCP server is down on system boot, TrueNAS will need a manual reset of the network interfaces

Hope some one can help me fix this issue, unless it is a bug ?
 
Last edited:

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Hope some one can help me fix this issue, unless it is a bug ?
I'm not sure you're going to get to a good solution other than making sure that your default router doesn't go offline. Perhaps a UPS to ensure power cuts don't disrupt it? Don't unplug the cables?
 

Phil1295

Explorer
Joined
Sep 20, 2020
Messages
79
I'm not sure you're going to get to a good solution other than making sure that your default router doesn't go offline. Perhaps a UPS to ensure power cuts don't disrupt it? Don't unplug the cables?

I just got it to work:
- found a fix to the DNS server issue when manually setting the IP for jails instead of DHCP

I read about the DNS server issue in many threads and it was mentioned as a "not to be fixed bug".
The issue is that the jail /etc/resolv.conf file is alway imported from the main host when IP mode is set to manual

I finally went through TrueNAS options and found a small hint on this:
Capture.PNG


The resolver is the DNS server and as you see, the whole contents of the file must be manually entered. Else, on jail boot, the DNS server is always populated from the /etc/resolv.conf file of the host. Specifying another path doesn't work, only file contents. When jail starts with the wrong DNS server, it must be restarted, or its DNS settings changed after it starts.

Shame that on the bug tracker, the issue was labeled as "Not to be fixed" instead of hinting to a fix. I never found any info on this specific feature about the jails setup GUI in TrueNAS

Hope this can help other people that like me, need a different DNS resolver in some jails than in main host, OpenDNS in my case.

By the way, this still doesn't fix starting the jail in DHCP mode with an offline gateway. The simpler fix would be cronjob to start the jail once the gateway is online after boot
 
Top