# IPV6 default route disappears after 30 minutes.



## whoops (Mar 16, 2014)

I've been melting my brain trying to figure why, after 30 minutes, the default ipv6 route disappears from my FreeBSD 10 machine.

First up, my configuration:

```
ipv6_enable="YES"
ipv6_prefer="YES"
ipv6_network_interfaces="em0"
ifconfig_em0_ipv6="inet6 <redacted> prefixlen 64"
ipv6_defaultrouter="2607:5300:60:3Bff:ff:ff:ff:ff"
```

Running `ifconfig` after boot results in:

```
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=4219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC,VLAN_HWTSO>
        ether 00:25:90:7c:53:1c
        inet <redacted> netmask 0xffffff00 broadcast 192.99.10.255
        inet6 fe80::225:90ff:fe7c:531c%em0 prefixlen 64 scopeid 0x1
        inet6 <redacted> prefixlen 64
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
em1: flags=8c02<BROADCAST,OACTIVE,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=4219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC,VLAN_HWTSO>
        ether 00:25:90:7c:53:1d
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: no carrier
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
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
```

and the routing table:

```
Internet:
Destination        Gateway            Flags    Refs      Use    Mtu    Netif Expire
default            192.99.10.254      UGS         0     6737   1500      em0
localhost          link#3             UH          0      125  16384      lo0
192.99.10.0        link#1             U           0        8   1500      em0
vor                link#1             UHS         0        4  16384      lo0

Internet6:
Destination                  Gateway                       Flags    Refs      Use    Mtu    Netif Expire
::                           localhost                     UGRS        0        0  16384      lo0 =>
default                      fe80::caf9:f9ff:fe58:3fc0%em0 UG          0      338   1500      em0
localhost                    link#3                        UH          0    18087  16384      lo0
::ffff:0.0.0.0               localhost                     UGRS        0        0  16384      lo0
2607:5300:60:3b00::          link#1                        U           0        0   1500      em0
2607:5300:60:3b8e::          link#1                        U           0        0   1500      em0
vor.waltonhoops.com          link#1                        UHS         0        0  16384      lo0
fe80::                       localhost                     UGRS        0        0  16384      lo0
fe80::%em0                   link#1                        U           0        1   1500      em0
fe80::225:90ff:fe7c:531c%em0 link#1                        UHS         0        0  16384      lo0
fe80::%lo0                   link#3                        U           0        0  16384      lo0
fe80::1%lo0                  link#3                        UHS         0        0  16384      lo0
ff01::%em0                   fe80::225:90ff:fe7c:531c%em0  U           0        0   1500      em0
ff01::%lo0                   localhost                     U           0        0  16384      lo0
ff02::                       localhost                     UGRS        0        0  16384      lo0
ff02::%em0                   fe80::225:90ff:fe7c:531c%em0  U           0        0   1500      em0
ff02::%lo0                   localhost                     U           0        0  16384      lo0
```

So it appears to me at least, that my 
	
	



```
ipv6_defaultrouter="2607:5300:60:3Bff:ff:ff:ff:ff"
```
 is getting ignored, and instead the gateway for ipv6 is: 
	
	



```
default                       fe80::caf9:f9ff:fe58:3fc0%em0
```

Presumably coming from ndp. Sure enough `ndp -r` gives

```
fe80::caf9:f9ff:fe58:3fc0%em0 if=em0, flags=, pref=medium, expire=4m32s
fe80::da24:bdff:fe91:c700%em0 if=em0, flags=, pref=medium, expire=4m32s
```
(Note the expire starts at 30m.) Up until the expire, ipv6 works fine. Afterwords, the default route is removed from the ipv6 routing table, and ipv6 is dead.  I can still ping what should be my gateway, but no external services. Nothing appears in any log files. Running `rtsol -a` immediately adds the route back, and everything is up again. However enabling rtsold with 
	
	



```
rtsold_enable="YES"
```
 in rc.conf, has no effect.

The output from `route monitor` when it expires is:

```
got message of size 312 on Sun Mar 16 19:29:29 2014
RTM_DELETE: Delete Route: len 312, pid: 0, seq 0, errno 0, flags:<GATEWAY,DONE>
locks:  inits:
sockaddrs: <DST,GATEWAY,NETMASK,IFP,IFA>
 default fe80::caf9:f9ff:fe58:3fc0%em0 default em0:0.25.90.7c.53.1c fe80::225:90ff:fe7c:531c%em0

got message of size 312 on Sun Mar 16 19:29:29 2014
RTM_ADD: Add Route: len 312, pid: 0, seq 0, errno 0, flags:<UP,GATEWAY,DONE>
locks:  inits:
sockaddrs: <DST,GATEWAY,NETMASK,IFP,IFA>
 default fe80::da24:bdff:fe91:c700%em0 default em0:0.25.90.7c.53.1c fe80::225:90ff:fe7c:531c%em0

got message of size 312 on Sun Mar 16 19:29:29 2014
RTM_DELETE: Delete Route: len 312, pid: 0, seq 0, errno 0, flags:<GATEWAY,DONE>
locks:  inits:
sockaddrs: <DST,GATEWAY,NETMASK,IFP,IFA>
 default fe80::da24:bdff:fe91:c700%em0 default em0:0.25.90.7c.53.1c fe80::225:90ff:fe7c:531c%em0
```

I've also tried disabling accept_rtadv by setting 
	
	



```
net.inet6.ip6.accept_rtadv=0
```
 in sysctl.conf and changing the interface configuration to 
	
	



```
ifconfig_em0_ipv6="inet6 <redacted> prefixlen 64 -accept_rtadv"
```
, However this doesn't appear to have any effect. After rebooting, `ifconfig` still gives:

```
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=4219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC,VLAN_HWTSO>
        ether 00:25:90:7c:53:1c
        inet <redacted> netmask 0xffffff00 broadcast 192.99.10.255
        inet6 fe80::225:90ff:fe7c:531c%em0 prefixlen 64 scopeid 0x1
        inet6 <redacted> prefixlen 64
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
```
and the problem persists.  At this point I'm out of troubleshooting ideas. Using the staticly defined gateway, or the gateways discovered via ndp would be fine, but I can't seem to figure out how to do either.


----------



## kpa (Mar 16, 2014)

You have ACCEPT_RTADV on the interface and that makes it receive router advertisement messages. The flag is not on by default afaik and I'm not sure if what's happening on your system is a side effect of ipv6_enable or ip6_prefer but you can try with:


```
ifconfig_em0_ipv6="inet6 <redacted> prefixlen 64 -accept_rtadv"
```


----------



## whoops (Mar 16, 2014)

As noted above, I've tried disabling accept_rtadv both via 
	
	



```
ifconfig_em0_ipv6="inet6 2607:5300:60:3B8e::1 prefixlen 64 -accept_rtadv"
```
 in rc.conf and setting

```
net.inet6.ip6.accept_rtadv=0
```
 in sysctl.conf and neither has any effect.

My current rc.conf (with services removed)

```
zfs_enable="YES"
sshd_enable="YES"
fsck_y_enable="YES"
named_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"

ifconfig_em0="inet 192.99.10.142 netmask 255.255.255.0 broadcast 192.99.10.255"
defaultrouter="192.99.10.254"

# IPv6 configuration
ipv6_enable="YES"

ipv6_network_interfaces="em0"
ifconfig_em0_ipv6="inet6 2607:5300:60:3B8e::1 prefixlen 64 -accept_rtadv"
ipv6_defaultrouter="2607:5300:60:3Bff:ff:ff:ff:ff"
hostname="vor.waltonhoops.com""
```

`ifconfig` after rebooting

```
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=4219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC,VLAN_HWTSO>
        ether 00:25:90:7c:53:1c
        inet 192.99.10.142 netmask 0xffffff00 broadcast 192.99.10.255
        inet6 fe80::225:90ff:fe7c:531c%em0 prefixlen 64 scopeid 0x1
        inet6 2607:5300:60:3b8e::1 prefixlen 64
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
em1: flags=8c02<BROADCAST,OACTIVE,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=4219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC,VLAN_HWTSO>
        ether 00:25:90:7c:53:1d
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: no carrier
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
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
```
Note ACCEPT_RTADV is still enabled. Commenting out 
	
	



```
ipv6_enable="YES"
```
 does cause em0 to come up without ACCEPT_RTADV, however the default route for ipv6 is also missing.

Edit: also, I should mention that by running `ifconfig em0 inet6 -accept_rtadv` after the system is booted, I can disable it, but of course by then the damage is done. I can't figure out why setting it in rc.conf has no effect at boot.


----------

