Solved service netif restart loses default route?

As illustrated below, I rebooted my machine and immediately ran netstat -rn followed by service netif restart. I then executed ifconfig to verify the network interfaces were properly up, and ran netstat -rn again. The entry
Code:
default  192.168.1.1  UGS  re1
present in the first netstat results disappeared from the second results.
  1. Am I correct in understanding the default route is no longer present?
  2. Is this something that would be caused by my configuration, or is this a bug in FreeBSD?
  3. Do I need to provide any more information to support debugging this issue?
  4. Did I miss something?
Code:
[root]pts/0://Dreamer/root # uname -a
FreeBSD Dreamer.FKEinternet.net 10.2-RELEASE FreeBSD 10.2-RELEASE #0: Mon Oct  5 23:53:36 EDT 2015  root@Dreamer.FKEinternet.com.:/usr/obj/usr/src/sys/GENERIC  amd64
From /etc/rc.conf:
Code:
hostname="Dreamer.FKEinternet.net"
defaultrouter="192.168.1.1"
#
ifconfig_re0="inet 192.168.14.69 netmask 255.255.252.0"
ifconfig_re0_alias0="inet 192.168.14.253 netmask 255.255.252.0"
ifconfig_re0_alias1="inet 192.168.14.199 netmask 255.255.252.0"
ifconfig_re0_alias2="inet 192.168.14.202 netmask 255.255.252.0"
#
ifconfig_re1="inet 100.0.193.99 netmask 255.255.255.0"
ifconfig_re1_alias0="inet 192.168.1.199 netmask 255.255.255.0"
ifconfig_re1_alias1="inet 100.0.193.102 netmask 255.255.255.0"
ifconfig_re1_alias2="inet 192.168.1.202 netmask 255.255.255.0"
#
ifconfig_lo0_alias0="inet 127.0.0.2 netmask 255.255.255.255"  # second domain/named instance
#
netwait_enable=YES
netwait_if="re0"
netwait_ip="192.168.14.1"
#
firewall_enable="YES"
firewall_script="/usr/local/etc/ipfw.rules"
firewall_logging="YES"
sshguard_enable="YES"
#
named_fke_enable="YES"
named_fke_chrootdir="/usr/local/named-fke"
named_occ_enable="YES"
named_occ_chrootdir="/usr/local/named-occ"
# NO! NO! NO! DO *NOT* START local_unbound SERVICE - IT'S ON named'S PORT!!
# local_unbound_enable="NO"
Console output (PuTTY) illustrating the problem:
Code:
System shutdown time has arrived
login as: root
Using keyboard-interactive authentication.
Password for root@Dreamer.FKEinternet.net:
Last login: Thu Mar 24 02:30:52 2016 from 192.168.14.73
FreeBSD 10.2-RELEASE (GENERIC) #0: Mon Oct  5 23:53:36 EDT 2015
Welcome to FreeBSD!

This *IS* Dreamer...
Thu Mar 24 13:42:07 EDT 2016
[root]pts/0://Dreamer/root # netstat -rn
Routing tables

Internet:
Destination  Gateway  Flags  Netif Expire
default  192.168.1.1  UGS  re1
100.0.193.0/24  link#2  U  re1
100.0.193.99  link#2  UHS  lo0
100.0.193.102  link#2  UHS  lo0
127.0.0.1  link#3  UH  lo0
127.0.0.2  link#3  UH  lo0
192.168.1.0/24  link#2  U  re1
192.168.1.199  link#2  UHS  lo0
192.168.1.202  link#2  UHS  lo0
192.168.12.0/22  link#1  U  re0
192.168.14.69  link#1  UHS  lo0
192.168.14.199  link#1  UHS  lo0
192.168.14.202  link#1  UHS  lo0
192.168.14.253  link#1  UHS  lo0

Internet6:
Destination  Gateway  Flags  Netif Expire
::/96  ::1  UGRS  lo0
::1  link#3  UH  lo0
::ffff:0.0.0.0/96  ::1  UGRS  lo0
fe80::/10  ::1  UGRS  lo0
fe80::%lo0/64  link#3  U  lo0
fe80::1%lo0  link#3  UHS  lo0
ff01::%lo0/32  ::1  U  lo0
ff02::/16  ::1  UGRS  lo0
ff02::%lo0/32  ::1  U  lo0
Thu Mar 24 13:42:13 EDT 2016
[root]pts/0://Dreamer/root # service netif restart
Stopping Network: lo0 re0 re1.
lo0: flags=8048<LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
  options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
  nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
re0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
  options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
  ether 1c:6f:65:92:c4:59
  nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
  media: Ethernet autoselect (1000baseT <full-duplex>)
  status: active
re1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
  options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
  ether c4:12:f5:30:68:51
  nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
  media: Ethernet autoselect (1000baseT <full-duplex>)
  status: active
Starting Network: lo0 re0 re1.
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 0x3
  inet 127.0.0.1 netmask 0xff000000
  inet 127.0.0.2 netmask 0xffffffff
  nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
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 1c:6f:65:92:c4:59
  inet 192.168.14.69 netmask 0xfffffc00 broadcast 192.168.15.255
  inet 192.168.14.253 netmask 0xfffffc00 broadcast 192.168.15.255
  inet 192.168.14.199 netmask 0xfffffc00 broadcast 192.168.15.255
  inet 192.168.14.202 netmask 0xfffffc00 broadcast 192.168.15.255
  nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
  media: Ethernet autoselect (none)
  status: no carrier
re1: 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 c4:12:f5:30:68:51
  inet 100.0.193.99 netmask 0xffffff00 broadcast 100.0.193.255
  inet 192.168.1.199 netmask 0xffffff00 broadcast 192.168.1.255
  inet 100.0.193.102 netmask 0xffffff00 broadcast 100.0.193.255
  inet 192.168.1.202 netmask 0xffffff00 broadcast 192.168.1.255
  nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
  media: Ethernet autoselect (none)
  status: no carrier
Thu Mar 24 13:42:27 EDT 2016
[root]pts/0://Dreamer/root # 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 1c:6f:65:92:c4:59
  inet 192.168.14.69 netmask 0xfffffc00 broadcast 192.168.15.255
  inet 192.168.14.253 netmask 0xfffffc00 broadcast 192.168.15.255
  inet 192.168.14.199 netmask 0xfffffc00 broadcast 192.168.15.255
  inet 192.168.14.202 netmask 0xfffffc00 broadcast 192.168.15.255
  nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
  media: Ethernet autoselect (1000baseT <full-duplex>)
  status: active
re1: 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 c4:12:f5:30:68:51
  inet 100.0.193.99 netmask 0xffffff00 broadcast 100.0.193.255
  inet 192.168.1.199 netmask 0xffffff00 broadcast 192.168.1.255
  inet 100.0.193.102 netmask 0xffffff00 broadcast 100.0.193.255
  inet 192.168.1.202 netmask 0xffffff00 broadcast 192.168.1.255
  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 0x3
  inet 127.0.0.1 netmask 0xff000000
  inet 127.0.0.2 netmask 0xffffffff
  nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
Thu Mar 24 13:42:40 EDT 2016
[root]pts/0://Dreamer/root # netstat -rn
Routing tables

Internet:
Destination  Gateway  Flags  Netif Expire
100.0.193.0/24  link#2  U  re1
100.0.193.99  link#2  UHS  lo0
100.0.193.102  link#2  UHS  lo0
127.0.0.1  link#3  UH  lo0
127.0.0.2  link#3  UH  lo0
192.168.1.0/24  link#2  U  re1
192.168.1.199  link#2  UHS  lo0
192.168.1.202  link#2  UHS  lo0
192.168.12.0/22  link#1  U  re0
192.168.14.69  link#1  UHS  lo0
192.168.14.199  link#1  UHS  lo0
192.168.14.202  link#1  UHS  lo0
192.168.14.253  link#1  UHS  lo0

Internet6:
Destination  Gateway  Flags  Netif Expire
::/96  ::1  UGRS  lo0
::1  link#3  UH  lo0
::ffff:0.0.0.0/96  ::1  UGRS  lo0
fe80::/10  ::1  UGRS  lo0
fe80::%lo0/64  link#3  U  lo0
fe80::1%lo0  link#3  UHS  lo0
ff01::%lo0/32  ::1  U  lo0
ff02::/16  ::1  UGRS  lo0
ff02::%lo0/32  ::1  U  lo0
Thu Mar 24 13:42:44 EDT 2016
[root]pts/0://Dreamer/root #
 
I think this is expected behaviour. I know that if you manually remove the IP from your gateway interface and re-add it, the route disappears. There should be a routing (not sure if that's the exact name) rc script which you also need to restart, which will set up the default gateway.

I don't know what happens on other operating systems. I'm sure on my routeros devices that the routes are completely separate, and any static routes stay regardless of what you do with the interfaces, they just become unreachable.
 
I think this is expected behaviour. I know that if you manually remove the IP from your gateway interface and re-add it, the route disappears. There should be a routing (not sure if that's the exact name) rc script which you also need to restart, which will set up the default gateway.

So, the answer to my question 4 is "yes" - I missed something.

Thanks for your reply, running service routing restart restored the default route.

I find it curious that the IPv4 default route had been removed, but not the IPv6 ones:
Code:
# service routing restart
route: writing to routing socket: No such process
delete net default: gateway 192.168.1.1 fib 0: not in table
delete net fe80::: gateway ::1
delete net ff02::: gateway ::1
delete net ::ffff:0.0.0.0: gateway ::1
delete net ::0.0.0.0: gateway ::1
add net default: gateway 192.168.1.1
add net fe80::: gateway ::1
add net ff02::: gateway ::1
add net ::ffff:0.0.0.0: gateway ::1
add net ::0.0.0.0: gateway ::1
 
I think this is expected behaviour. I know that if you manually remove the IP from your gateway interface and re-add it, the route disappears. There should be a routing (not sure if that's the exact name) rc script which you also need to restart, which will set up the default gateway.
Yep. service routing restart
 
Back
Top