# IPv6 & rtadvd.conf



## gkontos (Sep 9, 2012)

Hi all,

I have finally setup a FreeBSD box as a router/firewall for my native IPv6 /56  network assignment.

I use my modem in bridge mode and PPPoE from the FreeBSD box to initiate the connection. Everything works fine and all the PCs get IPv6 addresses from rtadvd().

*The problem:*

I want to use statefull DHCP and DNS dynamic updates for each client. net/isc-dhcp41-server is already installed. But rtadvd.conf() completely ignores the below configuration which would instruct to only advertise the IPv6 routing on the network :


```
interface re0 {
        AdvManagedFlag on;
        AdvSendAdvert on;
        AdvAutonomous off;
        AdvOtherConfigFlag on;
        MinRtrAdvInterval 3;
        MaxRtrAdvInterval 60;
};
```

Instead it expects to find something similar to this:


```
re0:\
  :raflags="o":
```

I am really stack here because it looks like the documentation for rtadvd.conf for FreeBSD is very limited.  Any help will be appreciated!

_PS1 The box runs FreeBSD 9.1-RC1_
_PS2 Sample of dhcpd6.conf_


```
# The path of the lease file
dhcpv6-lease-file-name "/var/db/dhcpd6/dhcpd6.leases";

subnet6 2a02:xxx:xxx:xxxx::/64 {
	range6 2a02:xxx:xxx:xxxx::10 2a02:xxx:xxx:xxxx::1000;
}
```


----------



## kpa (Sep 9, 2012)

I use this in /etc/rtadvd.conf:


```
re0:\
    :raflags="mo":\
    :addr="2001:14b8:abcd:mnop::":prefixlen#64:\
    :pinfoflags="l":\
    :rdnss="2001:14b8:abcd:mnop::1":\
    :dnssl="mooo.com":
```

The m flag in raflags is the AdvManagedFlag on setting, the o flag the  AdvOtherConfigFlag on setting. The pinfoflags="l" is the same as AdvAutonomous off (only the on-link bit set).

For the DHCP6 part you'll have to figure out the DUIDs used by the clients, net/wireshark is great for that if you can't find them otherwise. Listen for the UDP packets arriving at the DHCP6 server (port 547) and net/wireshark decodes them for you.

Example host :


```
host myhost {
    host-identifier option dhcp6.client-id 00:01:00:01:17:bc:2d:f3:00:23:32:ce:67:96;
    fixed-address6 2001:14b8:abcd:mnop::200;
}
```

Edit: The above is for case when you want to have fixed IPs for hosts, it's not needed if dynamic ip addresses are enough.


----------



## gkontos (Sep 9, 2012)

THANK YOU :e


----------



## gkontos (Sep 9, 2012)

Just as follow up with some clients I tested so far. (laptops not VMs)

OSX 10.7.4 seems to prefer IPv4 over IPv6

Ubuntu 12.04 seems to prefer IPv4 over IPv6

Windows7 seems to prefer IPv6 over IPv4!!!

I know those are default settings that can easily be changed in each OS.


----------



## kpa (Sep 10, 2012)

As far as I know the applications can implement their own preference policy. It's simply a matter of requesting both A and AAAA records for a DNS name and choosing which set of addresses to use.


----------



## gkontos (Sep 10, 2012)

kpa said:
			
		

> As far as I know the applications can implement their own preference policy. It's simply a matter of requesting both A and AAAA records for a DNS name and choosing which set of addresses to use.



In my environment the FreeBSD box acts as a dual stack router/firewall. It also runs dual stack DNS server and DHCPD server. The interesting part is that the Windows7 laptop gets both IPv4 & IPv6 IP address and DNS info but prefers to use the IPv6 DNS for queries. Also, in the "network map" displays all the discovered devices with their IPv6 address.

Another funny thing is that the Windows7 client always chooses to use the last IPv6 address of the DHCP pool.


----------

