Hello Yuri,
You are right:
When it is broken:
PID JID FIB COMMAND
83074 0 1 /usr/local/sbin/nslcd
when it worked:
PID JID FIB COMMAND
89266 0 0 /usr/local/sbin/nslcd
The reasons of the issue:
1. When jexeced to jail which proposed to be FIB 1 commands will use FIB 0
without special attention . Testing "FIB 1" in jexeced shell is illusion
because it works with FIB 0. It's algorithmically right but very
counterintuitive.
2. FIB 1 not functional.
ip4.addr doesn't care about FIB. The setting
ip4.addr = "$if_lan|192.168.0.113/25";
has no relation to "exec.fib = 1;" It's algorithmically right.
Then there a fight for bringing jail's ip addr to FIB 1.
The
ip4.addr = "$if_lan|192.168.0.113/25 fib 1";
gives
Routing tables (fib: 1)
Internet:
Destination Gateway Flags Netif Expire
192.168.0.113 link#4 UHS lo0
and doesn't make FIB 1 functional.
As a side effect starting jail with this setting put whole interface to FIB 1
breaking host functionality:
igb1 ...
inet 192.168.0.113 netmask 0xffffff80 broadcast 192.168.0.127
fib: 1
fib 1 from the interface not cleared on a jail stop.
Is it ever possible to add alias of an interface to fib 1 when
net.add_addr_allfibs=0?
And whether it possible to do it at jail creation and remove on jail dies?
Tuesday, October 13, 2026, 8:55:39 PM, you wrote:
> you can do two captures:
> 1. When it is broken: ps -p PID -o pid,jid,fib,command
> 2. After restart when it works: ps -p PID -o pid,jid,fib,command
> See if fib has changed from 1 to 0, it would explain why restart helped
> On Tue, Oct 13, 2026 at 9:51 AM Anthony Pankov <[email protected]>
> wrote:
>> Hello Yuri,
>>
>> I recently found that it is strictly related to exec.fib=1 and renamed
>> the topic to "network not ready (?) while jail rc.startup when fib not 0".
>> May be it was incorrect action I don't know does anybody see it.
>> I copy it here:
>>
>> The issue is related to jail parameter
>>
>> exec.fib = 1;
>>
>> When it is not set the issue disappeared. When fib is 1 the previously
>> mentioned problem arises.
>> It seems to be something related to kernel:
>>
>> " This is a timing race condition directly tied to how FreeBSD initializes
>> independent routing tables (FIBs) for shared-IP jails.
>> When exec.fib=1 is configured, the jail executes all its internal /etc/rc
>> boot processes within FIB 1. However, during the early stage of the jail
>> creation sequence, the host assigns the jail's shared IP alias to FIB 0
>> first before the exec.fib=1 routine fully maps the IP alias space into FIB
>> 1."
>>
>> Tuesday, October 13, 2026, 7:16:11 PM, you wrote:
>>
>>
>> A restart fixing it, suggests some persistent state or some other dep.
>> Could you collect additional information?
>> 1. Temp enable the debug log of nslcd.conf inside the jail
>> 2. While it is broken, try to look up for a known ldap user: "getent
>> passwd <ldap_user>". Repeat after 30 secs w/o restarting.
>> 3. If the log only reports a generic connection error, trace the existing
>> broken process. Run as root on the host, substituting that jail's nslcd pid:
>> ktrace -t cs -f /tmp/nslcd-failed.ktrace -p PID
>> Trigger the lookup inside the jail, then on the host:
>> ktrace -c -p PID
>> kdump -f /tmp/nslcd-failed.ktrace > /tmp/nslcd-failed.txt
>>
>> The useful sequence is socket(), connect(), any getsockopt(SO_ERROR), and
>> subsequent operations on that descriptor. EINPROGRESS from a non-blocking
>> connect() is normal; the eventual result matters. A successful TCP
>> connection followed by LDAP failure points toward TLS, binding, or
>> connection handling instead of an outbound socket restriction.
>>
>> or you can share the collected files.
>> --
>>
>> On Tue, Oct 13, 2026 at 6:04 AM Anthony Pankov <[email protected]>
>> wrote:
>>
>> Hello,
>>
>> I have an issue with nss-pam-ldapd (nslcd) inside a jail.
>> When the jail started nslcd do not work and say "Can't connect LDAP
>> server".
>> After "service nslcd restart" all work as expected.
>>
>> May be somebody can explain/help?
>>
>>
>> I have many tries myself, then with AI and no luck. Before AI give up it
>> said:
>> "The Socket is not connected error happens when nslcd handles an early
>> request inside the jail while dropping root privileges (setuid). In a
>> shared-IP jail environment, FreeBSD's kernel enforces a strict network
>> isolation rule: an unprivileged process inside a jail is completely
>> forbidden from creating an outbound TCP socket (connect()) if it is inside
>> a process path processing a local UNIX domain socket loop check."
>>
>>
>> Jail is configured as:
>> # host shared loopback
>> ip6.addr += "hosl|1:2554:e::1/64";
>> # use casual ip4
>> ip4.addr = "$if_lan|192.168.0.113";
>>
>> P.S.
>> System is 14-stable.
>> Things that doesn't help:
>> - adding ip4.add="lo0|127.1.0.1"
>> - prevent dropping privileges (uid root, gid wheel in nslcd.conf)
>> - running with "nscld_supervisior="YES" (through daemon)
>> - defining IP addresses (host(jail) itself, ldap servers) in /etc/hosts
>> - preventing any real query to ldap from nslcd before startup sequence end
>>
>> --
>> Best regards,
>> Anthony Pankov mailto:[email protected]
>>
>>
>>
>>
>> --
>> Thanks,
>> Yuri.
>>
>>
>> --
>> Best regards,
>> Anthony
>>
>>
--
Best regards,
Anthony