/etc/rc.d/routing fails on boot with "Network is unreachable"

Hello,

It's been a while since I upgraded to 9.0 that I'm having this annoying problem that results in the network being unavailable after boot. The /etc/rc.d/routing script fails (see dmesg) and I need to execute that script manually after boot to get access.

Here is the relevant dmesg output:

Code:
route: writing to routing socket: Network is unreachable
add net default: gateway x.x.x.1: Network is unreachable
route: writing to routing socket: Network is unreachable
add net ::ffff:0.0.0.0: gateway ::1: Network is unreachable
route: writing to routing socket: Network is unreachable
add net ::0.0.0.0: gateway ::1: Network is unreachable
route: writing to routing socket: Network is unreachable
add net fe80::: gateway ::1: Network is unreachable
route: writing to routing socket: Network is unreachable
add net ff02::: gateway ::1: Network is unreachable
bge0: link state changed to DOWN
Starting Network: lo0 bge0.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=3<RXCSUM,TXCSUM>
        inet6 ::1 prefixlen 128 
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x7 
        inet 127.0.0.1 netmask 0xff000000 
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
bge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8009b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LINKSTATE>
        ether 00:15:60:a0:b8:e5
        inet x.x.x.30 netmask 0xffffff00 broadcast x.x.x.255
        inet6 (...)%bge0 prefixlen 64 tentative scopeid 0x1 
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect (none)
        status: no carrier
Starting devd.

As you can see my card is using the bge(4) driver and at first glance it seems that it is taking too long to get the link up. But actually even after adding a sleep and checking that the link is up in a custom rc.d the result is the same. It seems that for some reason the link falls just as the routes are about to be added.

I've googled and googled but found no solution (tried different sleep methods, media and mediaopt settings) but haven't been able to solve this. So far I have managed to ignore it (I seldom reboot anyway) but it would be great if anyone here could help. My rc.conf (also attached) has just the following network configuration options (ip redacted):

Code:
defaultrouter="x.x.x.1"
ifconfig_bge0="inet x.x.x.30  netmask 255.255.255.0"
 

Attachments

Most of the errors are relating to IPv6, which you don't seem to use.

It may be caused by PF, can you post your pf.conf?
 
/etc/pf.conf:
Code:
ext_if = "bge0"
localnet = $ext_if:network

set block-policy return
scrub in all no-df
antispoof for $ext_if

pass quick on tun0 inet6
pass quick on $ext_if proto ipv6

block in all
pass out all
pass inet proto icmp from any to any

pass in on $ext_if proto tcp from { x.x.y.z, x.x.y.z, x.x.y.z, x.x.y.z } to any port 65389
pass in on $ext_if proto tcp from any to any port { ftp, http, 8080, rdp, 65301 }
pass in on $ext_if proto tcp from x.x.y.z/18 to any port { ssh }
pass in on $ext_if proto tcp from x.x.y.z to any port { 8840 }
pass in on $ext_if proto tcp from x.x.y.z to any port { 6001 }
pass in on $ext_if proto tcp from x.x.y.z to any port { 64516 }
pass in on $ext_if proto { tcp, udp } from x.x.y.z to any port { sunrpc, nfsd, nfsd-status, lockd }
pass in on lo0 proto tcp from any to any
 
Use this instead of the last rule, there's other traffic on loopback than just tcp:
Code:
set skip on lo0
 
Thanks for the tip. Unfortunately the original problem remains.

Could this have something to do with IPv6? I assumed that the IFDISABLED flag in the ifconfig means IPv6 is disabled. However if I try to start ntpd it complains that it can't bind to bge0's link local address. And of course the errors from the /etc/rc.d/routing indicate that it's trying to set up some IPv6 routes.
 
Try disabling IPv6 completely:
Code:
ipv6_network_interfaces="none"
ipv6_activate_all_interfaces="NO"
 
Although I read somewhere that the ipv6_activate_all_interfaces var was deprecated I tried your suggestion. Same problem while booting but it doesn't seem to make a difference at all. Here's the ifconfig output after boot is completed:
Code:
bge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8009b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LINKSTATE>
        ether 00:15:60:a0:b8:e5
        inet x.x.x.30 netmask 0xffffff00 broadcast x.x.x.255
        inet6 fe80::215:60ff:fea0:b8e5%bge0 prefixlen 64 scopeid 0x1 
        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=3<RXCSUM,TXCSUM>
        inet6 ::1 prefixlen 128 
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x7 
        inet 127.0.0.1 netmask 0xff000000 
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

The interface returns to UP shortly after the /etc/rc.d/routing script (unsuccesfully) executes.

Also, the kernel, either GENERIC or my own custom kernel exhibit the same behavior. Both have INET6 in the configuration. I considered recompiling without but in the long run I do want to have ipv6 support for different reasons (testing, experimenting, etc.).
 
Try the /etc/rc.d/netwait script. These should go in /etc/rc.conf

Code:
netwait_ip="x.x.x.1"
netwait_if="bge0"
netwait_timeout="10"

With those settings the script will wait up to netwait_timeout seconds (10 in my example, ymmv) after bge0 is configured or until the interface appears to have carrier. The script will also try to ping netwait_ip ip address after the interface appears to be up or netwait_timeout seconds has passed.
 
Hello,

First please excuse the silly comment about ipv6_activate_all_interfaces being deprecated. I misread some file in /etc.

As for netwait I had tried it some time ago and it didn't help but I think now I have found the reason why. I added rc_debug="YES" to /etc/rc.conf and noticed from dmesg -a that for some strange reason /etc/rc.d/netif is run after /etc/rc.d/routing. This is strange because in the output of rcorder /etc/rc.d/* the order is correct. I will investigate further but in the meantime if anyone has an idea what could cause this please let me know.
 
Problem solved

OK, I found the solution and it didn't really have anything to do with networking I'm afraid.

Earlier, I checked the output of rcorder /etc/rc.d/* to see what the order should be but I didn't notice that rc's first pass doesn't execute all the scripts in /etc/rc.d. The networking scripts are executed in a second pass along with the scripts in /usr/local/etc/rc.d.

So, it turns out that there was a long forgotten init script from the freenet6 port, which I had forgotten to deinstall after having fooled around with a bit. This script had a BEFORE: ip6addrctl statement and mentioned scripts in /etc/rc.d in it's REQUIRE statement. That was causing some circular dependencies and generally mucking things up. The result was /etc/rc.d/netif was executed much too late. For some reason standard error is redirected to /dev/null when rc executes rcorder. That doesn't seem ideal to me, but who knows.

So anyway, things are working now! Thank your for your help and tips,

Kostas
 
Back
Top