# loss of IPv6 default route



## su27 (Feb 15, 2011)

Hi All,

I am trying to use static IPv6 configuration on FreeBSD 8.0 and 8.1-RELEASE.

Please excuse me if my knowledge about IPv6 is bad. But there is not enough documentation about how to configure IPv6 if I don't want to use autoconf.

Could anybody tell me what the difference between two manipulations:

1) If I add to rc.conf (for example)

```
ipv6_defaultrouter="1234:5687:9abc::1"
```

after booting I will see in routing table:


```
Internet6:
Destination Gateway Flags Netif Expire
default fe80::abcd:efff:fe12:3456%bge0/64 UG bge0
```

2) If I type (for example)

```
route add -inet6 default 1234:5687:9abc::1
```

I will see in routing table:


```
Internet6:
Destination Gateway Flags Netif Expire
default 1234:5687:9abc::1 UGS bge0
```

So I don't understand these things: 
a) Why results are different? In IPv4 results are the same...
b) Why flags are different? Why in first case flag "S" is absent?
b) Why in both cases FreeBSD loose IPv6 default route after the small period of time (about 10 minutes)?


----------



## SirDice (Feb 15, 2011)

To be honest I've never looked at the console when my server boots. But it does use static IPv6 addresses and routes. And I don't 'lose' my default gateway.

You'll need at least these in /etc/rc.conf:

```
#IPv6
ipv6_enable="YES"
ipv6_ifconfig_re0="2001:xxx:xxx::190 prefixlen 64"
ipv6_defaultrouter="2001:xxx:xxx::1"
```

The FE80:: addresses are link-local addresses. The S in the netstat output means it's been added statically.


----------



## su27 (Feb 15, 2011)

Yes, I have in  /etc/rc.conf

```
ipv6_enable="YES"
ipv6_ifconfig_bge0="2a02:xxxx:xxxx::10 prefixlen 64"
ipv6_defaultrouter="2a02:xxxx:xxxx::3"
```

SirDice, could you please look at yours 
	
	



```
netstat -rn
```
 output? do you have default IPv6 on link-local or on unicast address?


----------



## SirDice (Feb 15, 2011)

su27 said:
			
		

> SirDice, could you please look at yours
> 
> 
> 
> ...


On the unicast address I've set in rc.conf:


```
dice@molly:~>netstat -rnf inet6
Routing tables

Internet6:
Destination                       Gateway                       Flags      Netif Expire
::/96                             ::1                           UGRS        lo0 =>
default                           2001:xxx:xxx::1              UGS         re0
::1                               ::1                           UH          lo0
::ffff:0.0.0.0/96                 ::1                           UGRS        lo0
2001:xxx:xxx::/64                link#1                        U           re0
2001:xxx:xxx::190                link#1                        UHS         lo0
2001:xxx:xxx::191                link#1                        UHS         lo0
fe80::/10                         ::1                           UGRS        lo0
fe80::%re0/64                     link#1                        U           re0
fe80::yyyy:yyyy:yyyy:yyy%re0      link#1                        UHS         lo0
fe80::%lo0/64                     link#3                        U           lo0
fe80::1%lo0                       link#3                        UHS         lo0
ff01:1::/32                       fe80::yyyy:yyyy:yyyy:yyyy%re0  U           re0
ff01:3::/32                       ::1                           U           lo0
ff02::/16                         ::1                           UGRS        lo0
ff02::%re0/32                     fe80::yyyy:yyyy:yyyy:yyyy%re0  U           re0
ff02::%lo0/32                     ::1                           U           lo0
```


----------



## su27 (Feb 15, 2011)

SirDice said:
			
		

> On the unicast address I've set in /etc/rc.conf:



Thanks a lot!

I looked through my /etc/rc.conf again and again, and I found the root of my troubles: second interface was configured as 
	
	



```
ipv6_ifconfig_bge1_alias0="..."
```
 instead of 
	
	



```
ipv6_ifconfig_bge1="..."
```

When I changed it - all starts work fine - now i see unicast IPv6 in routing table, and it seems really static 

Coud you tell me one more thing - do you know how to correctly add IPv6 static route to the /etc/rc.conf?

I tried to add this:

```
route_v6="-inet6 -net 2a02:xxxx:xxxx:xxxx::0/64 2a02:xxxx:yyyy:yyyy::3"
static_routes="v6"
```

and it doesn't work, but when I type


```
route add -inet6 -net 2a02:xxxx:xxxx:xxxx::0/64 2a02:xxxx:yyyy:yyyy::3
```

it works fine.


----------



## SirDice (Feb 15, 2011)

If I read /etc/network.subr correctly it's something like:

```
ipv6_static_routes="myroute1"
ipv6_route_myroute1="2a02:xxxx:xxxx:xxxx::0/64 2a02:xxxx:yyyy:yyyy::3"
```


----------



## su27 (Feb 15, 2011)

SirDice said:
			
		

> If I read /etc/network.subr correctly it's something like:
> 
> ```
> ipv6_static_routes="myroute1"
> ...



Big thanks! It works!


----------

