I have been trying to use static DHCPv6 assignment using odhcpd (git: 73a7133) and a 6in4 tunnel.
The goal is to have the client receive 2001:470:1f12:1103::2/64. On the WAN side, a 6in4 tunnel is created. From the router, I can ping6 ipv6.google.com.
On the LAN side however the client receive 2001:470:1f12:1103::2/128. This Wireshark capture shows that the DHCP server offers the expected IPv6 address but does not include any prefix information (like DHCPV6_OPT_IA_PREFIX) option in its answer which leads the client (Ubuntu 14.04) to interpret the address as "/128".
eth0 Link encap:Ethernet HWaddr 54:a0:50:7a:fc:df
inet addr:192.168.77.2 Bcast:192.168.77.255 Mask:255.255.255.0
inet6 addr: 2001:470:1f13:1103::2/128 Scope:Global
inet6 addr: fe80::56a0:50ff:fe7a:fcdf/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:723851 errors:0 dropped:0 overruns:0 frame:0
TX packets:371144 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:933141282 (933.1 MB) TX bytes:43979869 (43.9 MB)
The network configuration file looks like this:
[...]
config interface 'lan'
option force_link '1'
option type 'bridge'
option proto 'static'
option netmask '255.255.255.0'
option ifname 'eth0.1'
option ipaddr '192.168.77.1'
option ip6gw '2001:470:1f13:1103::1'
option ip6assign '64'
option ip6hint '0'
[...]
config interface 'wan6'
option _orig_ifname '@wan'
option _orig_bridge 'false'
option proto '6in4'
option peeraddr '216.66.84.42'
option ip6addr '2001:470:1f12:1103::2/64'
option ip6prefix '2001:470:1f13:1103::/64'
option ip6assign '64'
[...]
option delegate '1'
And the DHCP configuration looks like this.
config dnsmasq
option domainneeded '1'
option boguspriv '1'
option localise_queries '1'
option rebind_protection '1'
option rebind_localhost '1'
option local '/lan/'
option domain 'lan'
option expandhosts '1'
option authoritative '1'
option readethers '1'
option leasefile '/tmp/dhcp.leases'
option resolvfile '/tmp/resolv.conf.auto'
config dhcp 'wan'
option interface 'wan'
option ignore '1'
config dhcp 'lan'
option interface 'lan'
option start '100'
option limit '150'
option leasetime '12h'
option dhcpv6 'server'
option ra 'server'
option ra_management '1'
config odhcpd 'odhcpd'
option maindhcp '0'
option leasefile '/tmp/hosts/odhcpd'
option leasetrigger '/usr/sbin/odhcpd-update'
config host
option name 'desktop'
option mac '54:a0:50:7a:fc:df'
option duid '0004eef4c651095f7f8f9139168091a4aa4c'
option ip '192.168.77.2'
option hostid '2'
The system seams to understand that the prefix from wan6 should be delegated to lan:
ifstatus wan6
{
"up": true,
"pending": false,
"available": true,
"autostart": true,
"uptime": 171,
"l3_device": "6in4-wan6",
"proto": "6in4",
"updated": [
"addresses",
"routes",
"prefixes"
],
"metric": 0,
"delegation": true,
"ipv4-address": [
],
"ipv6-address": [
{
"address": "2001:470:1f12:1103::2",
"mask": 64
}
],
"ipv6-prefix": [
{
"address": "2001:470:1f13:1103::",
"mask": 64,
"class": "wan6",
"assigned": {
"lan": {
"address": "2001:470:1f13:1103::",
"mask": 64
}
}
}
],
"ipv6-prefix-assignment": [
],
"route": [
{
"target": "::",
"mask": 0,
"nexthop": "::",
"source": "2001:470:1f12:1103::2\/64"
},
{
"target": "::",
"mask": 0,
"nexthop": "::",
"source": "2001:470:1f13:1103::\/64"
},
{
"target": "::",
"mask": 0,
"nexthop": "::",
"source": "::\/128"
}
],
"dns-server": [
],
"dns-search": [
],
"inactive": {
"ipv4-address": [
],
"ipv6-address": [
],
"route": [
],
"dns-server": [
],
"dns-search": [
]
},
"data": {
}
}
And the LAN interface seam to receive the prefix assignment properly (both address and mask):
ifstatus lan
{
"up": true,
"pending": false,
"available": true,
"autostart": true,
"uptime": 38,
"l3_device": "br-lan",
"proto": "static",
"device": "br-lan",
"updated": [
"addresses"
],
"metric": 0,
"delegation": true,
"ipv4-address": [
{
"address": "192.168.77.1",
"mask": 24
}
],
"ipv6-address": [
],
"ipv6-prefix": [
],
"ipv6-prefix-assignment": [
{
"address": "2001:470:1f13:1103::",
"mask": 64
}
],
"route": [
],
"dns-server": [
],
"dns-search": [
],
"inactive": {
"ipv4-address": [
],
"ipv6-address": [
],
"route": [
],
"dns-server": [
],
"dns-search": [
]
},
"data": {
}
}
Running odhcpd manually over SSH gives the following:
root@OpenWrt:/tmp# ./odhcpd
odhcpd[13117]: DHCPV6 CONFIRM IA_NA from 0004eef4c651095f7f8f9139168091a4aa4c on br-lan: not on-link 2001:470:1f13:1103::2/128
odhcpd[13117]: DHCPV6 SOLICIT IA_NA from 0004eef4c651095f7f8f9139168091a4aa4c on br-lan: ok 2001:470:1f13:1103::2/128
odhcpd[13117]: DHCPV6 REQUEST IA_NA from 0004eef4c651095f7f8f9139168091a4aa4c on br-lan: ok 2001:470:1f13:1103::2/128
I have not been able to figure out how the prefix is propagated in "dhcpv6-ia.c". Is the device improperly configured or is this case untested?