Slow start of jail (ezjail)

I have created a jail using sysutils/ezjail.

#ezjail-admin create jailname 'em0|192.168.1.22'

In order to get internet connection from the jail I copied the host resolv.conf to the jail. After I did that, it takes a very long time to start the jail. If I remove resolv.conf from the jail, then there is no delay. The host's resolv.conf looks like this:
Code:
# Generated by resolvconf
nameserver 194.168.4.100
nameserver 194.168.8.100
Also if I change the resolv.conf of the jail to use a Google server, then I have no problems
Code:
#Google Public DNS
nameserver 8.8.8.8
nameserver 8.8.4.4
I am happy to use a Google server, but am not sure if it is advisable. Is there any reason why my jail takes so long to start when using host's resolv.conf?
 
After the jail started you can resolve domain names easily/fast?

You had a look at the logfiles of your DNS?
 
Make sure the jail can resolve itself (hostname and IP address) either with a hosts file or DNS. That's usually the biggest delay.
 
Thanks for the suggestions. I entered the hostname of the jail in the etc/hosts of the jail. This solved the problem. The jail starts without any delays while still using host's etc/resolv.conf

However, I don't understand why Google's DNS server would not face the same problem as the host details.
 
DNS isn't something dynamic, although it can be it's not on the Internet. So hostnames need to be registered. If the hostname isn't registered there's no way for any Internet DNS server to resolve the hostname to its IP address.

When starting the system Sendmail tries to figure out who it is by using DNS and looking at the hostname of the system. If that fails it will cause a delay.
 
SirDice said:
When starting the system Sendmail tries to figure out who it is by using DNS and looking at the hostname of the system. If that fails it will cause a delay.
Thanks. I now understand why there was a delay.
SirDice said:
So hostnames need to be registered. If the hostname isn't registered there's no way for any internet DNS server to resolve the hostname to it's IP address.
But I am struggling to understand why it would work without any delays when using Google public DNS in etc/resolv.conf although the hostname was not added in etc/hosts. So how was the hostname registered to its IP in this case? Is the hostname registered to Google's IP?

It's not a big deal, as it is all sorted now. I just want to learn a bit more.
 
It now works because it's able to resolve the hostname through /etc/hosts. Name resolving follows the order set in nsswitch.conf(5) and the default order for hosts is files (refers to /etc/hosts), then DNS.

Maybe Google has a few default names set for various IP addresses. As long as the hostname corresponds to that the resolving would appear to magically work.
 
SirDice said:
Maybe Google has a few default names set for various IP addresses. As long as the hostname corresponds to that the resolving would appear to magically work.
My guess was that the firewall treats the Google address and the 192.168. addresses differently, causing the former to fail immediately and the latter to time out.

Kevin Barry
 
I had no firewall in my machine. Only if my ADSL/router which does DNS and firewall did what you say.
 
blazingice said:
I had no firewall in my machine. Only if my ADSL/router which does DNS and firewall did what you say.
Are 194.168.4.100 and 194.168.8.100 on different machines than the jail? To access the network you at least need NAT set up for the jail (I don't use ezjail, so I don't know if it automatically sets that up.) The rules used for NAT (or lack of rules) could cause the different behavior.

Kevin Barry
 
Back
Top