Solved Loopback interfaces for jails not being created automatically on system startup

Hello everyone,

I'm having issues with a couple of loopback interfaces as they are not being automatically created during system startup. My server is a Freebsd 10.3-RELEASE and I have setup 3 jails to run on it. One jail (latest one created will start up fine) the rest will only start after I manually create the loopback interfaces.

I'm going to describe the issue by illustrating what happens once the system finishes powering on. Once system is on, ifconfig configuration shows as follows:
Code:
% ifconfig
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
        ether f4:6d:04:70:a5:5e
        inet 172.16.1.20 netmask 0xffffff80 broadcast 172.16.1.127
        inet 172.16.1.21 netmask 0xffffffff broadcast 172.16.1.21
        inet 172.16.1.22 netmask 0xffffffff broadcast 172.16.1.22
        inet 172.16.1.23 netmask 0xffffffff broadcast 172.16.1.23
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=600003<RXCSUM,TXCSUM,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>
lo3: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
        inet 127.0.3.1 netmask 0xffffffff
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
At this point it's missing lo1 and lo2 for jail1 and jail2. Jail3 is on and running fine. I tipically run ifconfig lo1 create and ifconfig lo2 create to create lo1 and lo2. Issuing ifconfig will have the same output as the above + the new information for lo1 and lo2:
Code:
lo1: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
        inet 127.0.1.1 netmask 0xffffffff
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
lo2: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
        inet 127.0.2.1 netmask 0xffffffff
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
I am now able to issue the command to start up the jails, ezjail-admin start jail1/2.

Everything was running fine before I created my 3rd jail a few days back with the command ezjail-admin create jail3 'lo3|127.0.3.1,re0|172.16.1.23'.
Any ideas as to why I have to create the lo1 and lo2 manually ?

Some system information from /etc/rc.conf pertinent to networking:
Code:
ifconfig_re0="inet 172.16.1.20 netmask 255.255.255.128"
cloned_interfaces="lo1"
ifconfig_lo1="inet 127.0.1.1/32"
cloned_interfaces="lo2"
ifconfig_lo2="inet 127.0.2.1/32"
cloned_interfaces="lo3"
ifconfig_lo3="inet 127.0.3.1/32"
ifconfig_re0_alias0="inet 172.16.1.21 netmask 255.255.255.128"
ifconfig_re0_alias1="inet 172.16.1.22 netmask 255.255.255.128"
ifconfig_re0_alias2="inet 172.16.1.23 netmask 255.255.255.128"
My subnet is a /25 or 255.255.255.128.
My jail network config from /usr/local/etc/ezjail/jail1-2-3
Code:
export jail_jail1_ip="lo2|127.0.2.1,re0|172.16.1.21"
export jail_jail2_ip="lo1|127.0.1.1,re0|172.16.1.22"
export jail_jail3_ip="lo3|127.0.3.1,re0|172.16.1.23"

As a note that has popped out several times, when looking at the netmask and broadcast addresses assigned for the alias interfaces under ifconfig, I sometimes see it as a /32 or /25 CIDR.
For example after a reboot I sometimes see
Code:
inet 172.16.1.23 netmask 0xffffff80 broadcast 172.16.1.127
or
Code:
inet 172.16.1.23 netmask 0xffffffff broadcast 172.16.1.23
 
The settings in /etc/rc.conf are not commands or functions, they are variables. As such, setting the same variable multiple times throws away all but the last instance of it. So, you need a single instance of cloned_interfaces="lo1 lo2 lo3". Try that and let us know if it's sufficient. There might be something else, but that one jumped right out of the screen as the major issue.
 
Thank you Murph! That was indeed the issue. After placing cloned_interfaces="lo1 lo2 lo3" in /etc/rc.conf the issue got resolved. System was rebooted and all loopbacks were created and assigned. Thank you again.
 
It's just a shell script so normal shell script rules apply. This would work as well.
Code:
cloned_interfaces="lo1"
#...
cloned_interfaces="$cloned_interfaces lo2"
#...
cloned_interfaces="$cloned_interfaces lo3"
 
Back
Top