IPv6-PD assignment length for LAN config

Hello, i'm new for ipv6 config.
ISP has assigned a /60 on main route(Openwrt)
I try to obtain /62 on LAN for downstream router (XiaoMi).
But the downstream router got /64 and /128 addr,missing IPv6-PD
how can i get the downstream router work? Thanks in advance

root@WRT:~# uci export network
package network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fdb2:xxxx:xxxx::/48'
        option packet_steering '1'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0.1'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '62'
        option ip6ifaceid '::xxxx:2059'

config interface 'wan6'
        option device '@wan'
        option proto 'dhcpv6'
        option reqaddress 'try'
        option reqprefix 'auto'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0 1 2 6t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '4 5t'

config interface 'wan'
        option proto 'pppoe'
        option device 'eth1.2'
        option metric '40'
        option username ''
        option password ''
        option keepalive '5 5'
        option mtu '1492'
        option ipv6 '1'

root@WRT:~# uci export dhcp
package dhcp

config dnsmasq
        option domainneeded '1'
        option localise_queries '1'
        option rebind_protection '0'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option cachesize '4096'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option localservice '0'
        option ednspacket_max '1232'
        option dnsforwardmax '4096'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option dhcpv6 'server'
        option force '1'
        option ra 'server'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'

config dhcp 'wan'
        option interface 'wan'
        option ignore '1'

config odhcpd 'odhcpd'
        option maindhcp '0'
        option leasefile '/tmp/hosts/odhcpd'
        option leasetrigger '/usr/sbin/odhcpd-update'
        option loglevel '4'


root@WRT:~# ifstatus lan
{
        "up": true,
        "pending": false,
        "available": true,
        "autostart": true,
        "dynamic": false,
        "uptime": 85890,
        "l3_device": "br-lan",
        "proto": "static",
        "device": "br-lan",
        "updated": [
                "addresses",
                "routes"
        ],
        "metric": 0,
        "dns_metric": 0,
        "delegation": true,
        "ipv4-address": [
                {
                        "address": "192.168.1.1",
                        "mask": 24
                }
        ],
        "ipv6-address": [

        ],
        "ipv6-prefix": [

        ],
        "ipv6-prefix-assignment": [
                {
                        "address": "240e:xxxx:xxxx:e0a0::",
                        "mask": 62,
                        "preferred": 2160,
                        "valid": 2160,
                        "local-address": {
                                "address": "240e:xxxx:xxxx:xxxx::xxxx:2059",
                                "mask": 62
                        }
                },
                {
                        "address": "fdb2:xxxx:b76f::",
                        "mask": 62,
                        "local-address": {
                                "address": "fdb2:xxxx:xxxx::xxxx:2059",
                                "mask": 62
                        }
                }
        ],
        "route": [

        ],
        "dns-server": [

        ],
        "dns-search": [

        ],
        "neighbors": [

        ],
        "inactive": {
                "ipv4-address": [

                ],
                "ipv6-address": [

                ],
                "route": [

                ],
                "dns-server": [

                ],
                "dns-search": [

                ],
                "neighbors": [

                ]
        },
        "data": {

        }
}
root@WRT:~# ifstatus wan6
{
        "up": true,
        "pending": false,
        "available": true,
        "autostart": true,
        "dynamic": false,
        "uptime": 16038,
        "l3_device": "pppoe-wan",
        "proto": "dhcpv6",
        "device": "pppoe-wan",
        "metric": 0,
        "dns_metric": 0,
        "delegation": true,
        "ipv4-address": [

        ],
        "ipv6-address": [
                {
                        "address": "240e:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:81f5",
                        "mask": 64,
                        "preferred": 604359,
                        "valid": 2591559
                }
        ],
        "ipv6-prefix": [
                {
                        "address": "240e:xxxx:xxxx:e0a0::",
                        "mask": 60,
                        "preferred": 1962,
                        "valid": 1962,
                        "class": "wan6",
                        "assigned": {
                                "lan": {
                                        "address": "240e:xxxx:xxxx:e0a0::",
                                        "mask": 62
                                }
                        }
                }
        ],
        "ipv6-prefix-assignment": [

        ],
        "route": [
                {
                        "target": "::",
                        "mask": 0,
                        "nexthop": "fe80::xxxx:xxxx:xxxx:7700",
                        "metric": 512,
                        "valid": 1359,
                        "source": "240e:xxxx:xxxx:xxxx::/60"
                },
                {
                        "target": "::",
                        "mask": 0,
                        "nexthop": "fe80::xxxx:xxxx:xxxx:7700",
                        "metric": 512,
                        "valid": 1359,
                        "source": "240e:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:81f5/64"
                }
        ],
        "dns-server": [
                "240e:1:1::1",
                "240e:1:1::1"
        ],
        "dns-search": [

        ],
        "neighbors": [

        ],
        "inactive": {
                "ipv4-address": [

                ],
                "ipv6-address": [

                ],
                "route": [

                ],
                "dns-server": [

                ],
                "dns-search": [

                ],
                "neighbors": [

                ]
        },
        "data": {
                "passthru": "xxx"
        }
}

Your LAN interface on the OpenWrt system is configured with a /62 subnet. The downstream router can't be delegated the entire /62.
Try option ip6assign '61' on the OpenWrt LAN interface, then it will have room to delegate a /62 (half of your subnet) downstream.

2 Likes

thank for reply,
I try option ip6assign '61' , but nothing change on my downstream router.
it still get /64 and /128 addr.
the downstream router with offical roms do all ipv6 config auto, Does it matter?
I had try to set static ipv6 on my downstream router.but it actually confuse me more.

A /62 can theoretically only be divided into four /64 or two /63. But I've never seen OpenWrt actually do the latter. I need to study the code for prefix delegation since it seems it doesn't work optimally on small prefixes.

I think the official Xaiomi firmware is OpenWrt based.