Losing jail IPs nightly

This is probably just me who didn't RTFM, but I have a few jails, and one of them's now a Samba server where I decided to keep all my stuff after a nasty stint with Windows, and Microsoft cloud services.

My problem isn't the SMB server, though, it's that it loses it's IP, all my jails, in fact, lose their IPs nightly, it seems. In the past I didn't realize, I just restarted, I didn't have anything really useful running in them, but now that jail... well I need it, and restarting it every day is... well it's not fun, so....

What did I forget, or what am I doing wrong?

My configuration is still basic, and jails are started at startup by jail.conf, where the interfaces are also specified, and rc.conf.

Thanks in advance for any help,
 
it's that it loses it's IP, all my jails, in fact, lose their IPs nightly, it seems.
Check the host. If the host lost connection the interface goes down and all addresses are dropped. When the connection is restored your jails would still be disconnected from the interface.
 
Some ISPs drop your connection and reconnect every 24 hours. In Germany, many DSL providers do that (and charge extra fees for an “always on” option). I’m not sure if that’s common in other countries, though. Maybe something like that is causing your problem.

It might be a good idea to give your jails addresses from localnet (127/8) on the lo0 interface, i.e. 127.0.0.2, 127.0.0.3 and so on. If you need the jails to be accessible from external hosts, you can use IPFW rules to forward packets to/from physical interfaces. Alternatively you can run a proxy on the host, provided that the protocols used by the jails support proxying, like http/https. Then your jails’ networking will persists if the physical interface goes down temporarily. It’ll even work if the interface vanishes completely, e.g. if it’s a tun0 interface that’s destroyed and re-created.

I always use lo0 addresses for jails, because it has several advantages. For example, it gives you better control over what kind of traffic is allowed to reach and leave the jails, because lo0 addresses are never routed.
 
Check the host. If the host lost connection the interface goes down and all addresses are dropped. When the connection is restored your jails would still be disconnected from the interface.

The host is using DHCP, and it's connected to a router, and the router doesn't go down... My immediate guess is that it's DHCP renewal? I'm going to give it a static IP and see what happens, give news tomorrow...
 
My immediate guess is that it's DHCP renewal?
That's possible. If I recall correctly there were (still are?) some issues with setting the MTU during DHCP. That could momentarily drop the interface.

To prevent issues with MTU I have this in my /etc/dhclient.conf:
Code:
interface "em0" {
  supersede interface-mtu 0;
}
Adjust the em0 for your situation.
 
It was in fact the DHCP renegotiation that were taking enough time, or that procedurally allowed the jails to unbind from the interface... I think I set the IP Friday, Saturday the SMB shares were still there, didn't check yesterday, but today they're still there as well, so... I guess it's not really expected that a server with sMB shares is going to have a DHCP lease, but meh...

SirDice I'd try that, but I'm afraid to forget it's there... There's no good reason for my server to have a dynamic IP other than as a reminder I have to configure BIND (again) (lost files that were on an appliance's flash storage with openwrt)... I leave myself a lot of reminders like that 😋
 
Back
Top