# Enabling ipv6 without reboot



## frijsdijk (Apr 4, 2011)

Hi,

We're in the process of enabling IPv6 on our network and servers. The network is done, now we're looking into the process of enabling ipv6 on servers, preferably without reboots. The problem is, is that I can't get it to work without the reboot. The default route always binds on lo0 in that case.

Example.

This is my routing table running only ipv4:


```
# netstat -rn
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
default            87.250.133.1       UGS         5       63    em0
87.250.133.0/24    link#1             U           0        0    em0
87.250.133.5       link#1             UHS         0        0    lo0
87.250.133.7       link#1             UHS         0        0    lo0 =>
87.250.133.7/32    link#1             U           0        0    em0
127.0.0.1          link#3             UH          0        0    lo0

Internet6:
Destination                       Gateway                       Flags      Netif Expire
::1                               ::1                           UH          lo0
fe80::%lo0/64                     link#3                        U           lo0
fe80::1%lo0                       link#3                        UHS         lo0
ff01:3::/32                       fe80::1%lo0                   U           lo0
ff02::%lo0/32                     fe80::1%lo0                   U           lo0
```

Now I set in /etc/rc.conf:


```
ipv6_enable="YES"
ipv6_network_interfaces="em0"
ipv6_ifconfig_em0="2A02:F18:1:8501:87:250:133:5/64"
ipv6_defaultrouter="FE80::1%em0"
ipv6_ifconfig_em0_alias0="2A02:F18:1:8501:87:250:133:7/128"
```

Consequenty I run:

```
# /etc/rc.d/network_ipv6 start
/etc/rc.d/network_ipv6: DEBUG: checkyesno: ipv6_enable is set to YES.
/etc/rc.d/network_ipv6: DEBUG: run_rc_command: doit: network_ipv6_start
add net ::ffff:0.0.0.0: gateway ::1
add net ::0.0.0.0: gateway ::1
/etc/rc.d/network_ipv6: DEBUG: checkyesno: ipv6_gateway_enable is set to NO.
net.inet6.ip6.forwarding: 0 -> 0
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        inet6 2a02:f18:1:8501:87:250:133:5 prefixlen 64 tentative
/etc/rc.d/network_ipv6: DEBUG: checkyesno: ipv6_gateway_enable is set to NO.
add net fe80::: gateway ::1
add net ff02::: gateway ::1
add net default: gateway FE80::1%em0
/etc/rc.d/network_ipv6: DEBUG: checkyesno: ipv6_ipv4mapping is set to NO.
IPv4 mapped IPv6 address support=NO
```

em0 gets the correct ipv6 address.

Now my routing tables looks like this (note the default ipv6 route is bound on lo0):


```
# netstat -rn
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
default            87.250.133.1       UGS         2      264    em0
87.250.133.0/24    link#1             U           0        0    em0
87.250.133.5       link#1             UHS         0        3    lo0
87.250.133.7       link#1             UHS         0        0    lo0 =>
87.250.133.7/32    link#1             U           0        0    em0
127.0.0.1          link#3             UH          0        0    lo0

Internet6:
Destination                       Gateway                       Flags      Netif Expire
::/96                             ::1                           UGRS        lo0 =>
default                           fe80::1%em0                   UGS         lo0
::1                               ::1                           UH          lo0
::ffff:0.0.0.0/96                 ::1                           UGRS        lo0
2a02:f18:1:8501::/64              link#1                        U           em0
2a02:f18:1:8501:87:250:133:5      link#1                        UHS         lo0
2a02:f18:1:8501:87:250:133:7      link#1                        UHS         lo0
fe80::/10                         ::1                           UGRS        lo0
fe80::%lo0/64                     link#3                        U           lo0
fe80::1%lo0                       link#3                        UHS         lo0
ff01:1::/32                       2a02:f18:1:8501:87:250:133:5  U           em0
ff01:3::/32                       fe80::1%lo0                   U           lo0
ff02::/16                         ::1                           UGRS        lo0
ff02::%em0/32                     2a02:f18:1:8501:87:250:133:5  U           em0
ff02::%lo0/32                     fe80::1%lo0                   U           lo0
```

For reference, if I reboot with the same /etc/rc.conf, my routing table looks like this:

```
# netstat -rn
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
default            87.250.133.1       UGS         1     1062    em0
87.250.133.0/24    link#1             U           0        0    em0
87.250.133.5       link#1             UHS         0        3    lo0
87.250.133.7       link#1             UHS         0        0    lo0 =>
87.250.133.7/32    link#1             U           0        0    em0
127.0.0.1          link#3             UH          0        0    lo0

Internet6:
Destination                       Gateway                       Flags      Netif Expire
::/96                             ::1                           UGRS        lo0 =>
default                           fe80::1%em0                   UGS         em0
::1                               ::1                           UH          lo0
::ffff:0.0.0.0/96                 ::1                           UGRS        lo0
2a02:f18:1:8501::/64              link#1                        U           em0
2a02:f18:1:8501:87:250:133:5      link#1                        UHS         lo0
2a02:f18:1:8501:87:250:133:7      link#1                        UHS         lo0
fe80::/10                         ::1                           UGRS        lo0
fe80::%em0/64                     link#1                        U           em0
fe80::250:56ff:fe8a:34%em0        link#1                        UHS         lo0
fe80::%lo0/64                     link#3                        U           lo0
fe80::1%lo0                       link#3                        UHS         lo0
ff01:1::/32                       fe80::250:56ff:fe8a:34%em0    U           em0
ff01:3::/32                       ::1                           U           lo0
ff02::/16                         ::1                           UGRS        lo0
ff02::%em0/32                     fe80::250:56ff:fe8a:34%em0    U           em0
ff02::%lo0/32                     ::1                           U           lo0
```

.. and I have full ipv6 functionality.

What am I missing? We'd of course like to enable ipv6 on hosts without rebooting them.


-- Frederique


----------



## SirDice (Apr 4, 2011)

Your default router isn't correct, you're pointing it to a (multicast) link-local address. Use a global address.


----------



## KernelPanic (Apr 4, 2011)

Your default route is wrong. It should be something like this:

```
ipv6_ifconfig_em0="2A02:F18:1:8501:87:250:133:5/64"
ipv6_defaultrouter="2A02:F18:1:8501:87:250:133:1"
```


----------



## frijsdijk (Apr 4, 2011)

That does indeed give a ipv6 default gateway on em0, but it's not the correct gateway. I did mention that with that /etc/rc.conf, all works fine after a reboot. It's just the fact that I can not 'hot-enable' it.


----------



## Nukama (Apr 4, 2011)

`# /etc/netstart` could help to initialize the network manually.


----------



## frijsdijk (Apr 5, 2011)

SirDice said:
			
		

> Your default router isn't correct, you're pointing it to a (multicast) link-local address. Use a global address.



Then why does this same configuration work with a reboot?


----------



## SirDice (Apr 5, 2011)

While it might work it's not correct. It's similar to setting the IPv4 gateway to 169.254.0.1.


----------



## frijsdijk (Apr 5, 2011)

Unfortunately we have to work with this do to limitations on our Cisco's..

Sorry for being ignorant, but there's got to be a way if it works after a reboot, to set it 'hot'.


----------



## SirDice (Apr 6, 2011)

The only difference I can spot between a reboot and a hot start is the route FE80::%em0/64. It doesn't exist when you hot started it. This might be due to the order in which things are started. You might want to have a look in /etc/network.subr where most of the network functions are defined.


----------



## frijsdijk (Apr 7, 2011)

Thanks SirDice, will have a look-see!


----------

