# ipv6 default route is not installed even though its gets the RA



## bigbrother (Aug 14, 2021)

Hi,

My Ipv6 FreeBSD was used to operate successfully in the past. These days, after many binary upgrades my ipv6 default route is not installed any more and I have created a script as a workarround that I am displaying in the end of this post. I am using the same configuration into different ipv6 networks and different machines (all with the same setup), so I can assume that I am missing something. 

On all my machines, I use the same firewall rules and the same settings. On my rc.conf I have:


```
#enable ipv6
ipv6_network_interfaces="re0"
ifconfig_re0_ipv6="inet6 accept_rtadv"
ipv6_activate_all_interfaces="YES"
ip6addrctl_policy="ipv6_prefer"
rtsold_enable="YES"
rtsold_flags="-aF"
```

I have disabled the firewall using a 
ipfw add 1 allow all from any to any

My network card gets an IPv6 and can ping local ipv6 hosts.
But It does not get a default route, which I can verify if I view the 

netstat -nr

(I see there only a default route for ipv4).

Using -dD flags on the rtsol or tcpdump -n -i em0 icmp6  I can verify that I receive router advertisement (tested on 4-5 freebsd machines (
12.2-RELEASE-p7 FreeBSD 12.2-RELEASE-p7 GENERIC  amd64 )  but no default route is ever installed, and thus I cannot ping or traceroute.

Example:


```
# traceroute6 google.com
connect: No route to host
```

The rtsol output that shows the RA received, but nothing is installed in the routing table.
Also note that I have tried either by net.inet6.ip6.accept_rtadv=1 or net.inet6.ip6.accept_rtadv=0


```
# rtsol -Dd em0
rtsol: checking if em0 is ready...
rtsol: em0 is ready
rtsol: set timer for em0 to 0s
rtsol: New timer is 0s
rtsol: timer expiration on em0, state = 1
rtsol: set timer for em0 to 4s
rtsol: New timer is 4s
rtsol: received RA from fe80::21e:13ff:fe40:8e7f on em0, state is 2
rtsol: Processing RA
rtsol: ndo = 0x7fffffffe220
rtsol: ndo->nd_opt_type = 1
rtsol: ndo->nd_opt_len = 1
rtsol: ndo = 0x7fffffffe228
rtsol: ndo->nd_opt_type = 5
rtsol: ndo->nd_opt_len = 1
rtsol: ndo = 0x7fffffffe230
rtsol: ndo->nd_opt_type = 3
rtsol: ndo->nd_opt_len = 4
rtsol: rsid = [em0:slaac]
rtsol: stop timer for em0
rtsol: there is no timer
```

To solve this as a workarround I have created the script at the end of this message, that parses the rtsol RA and installs the default route if absent. It works, but I would like to know why the default route is not installed, and what else should I look to fix it without this workarround.

the script that I have created for workarround to install a default ipv6 route is:


```
#!/bin/sh
# If not default gateway is present, do setup one
# 2021.08.14 First Version, Minas

tmpfile=/tmp/$$.rtsol.txt



#ipv6 routes carry a : (xx:xx:xx) , while ipv4 carry dots (x.x.x.x)
ipv6gw=`netstat -nr | grep default | awk '{print $2}' | grep ':'`

# If this is not empty, we have a default ipv6 route
if [ ! -z "$ipv6gw" ] ; then
        exit
fi

# if we are here we have to setup a default ipv6
rtsol -Dda > $tmpfile 2>&1
ipv6gw=`cat $tmpfile | grep received | tr -d ',' | awk '{print $5"%"$7}'`
echo "$0 Adding GW [$ipv6gw]"
route add -6 default $ipv6gw
rm $tmpfile
```


Any insights on ipv6 default gateway? Thanks!


----------



## VladiBG (Aug 14, 2021)

Why in your rc.conf you set up re0 and then you are using em0?


----------



## bigbrother (Aug 15, 2021)

Some of my machines are using em0 and some re0.  Of course on the rc.conf I have setup either em0 or re0 for each machine. All the rest are the same.


----------



## bigbrother (Aug 15, 2021)

bigbrother said:


> Also note that I have tried either by net.inet6.ip6.accept_rtadv=1 or net.inet6.ip6.accept_rtadv=0


To answer to VladiBG question,  I have experimented by using a value of 0 or a value for 1 for net.inet6.ip6.accept_rtadv and nothing happened. I assume that '1' is the suggested value, but I did not notice any different either by 1 or by 0.


----------

