How to set the DHCPv6 client pubilc ipv6 address suffix to ::1

i am using pppoe to get the ipv6-pd from isp with /60 space. now the DHCPv6 client obtain a ipv6 address through this ipv6-pd and it is generate by mac address. so it is a very long address.


pic2
i am wondering how to set the DHCPv6 client suffix to ::1 so it would be more concise like 2001:abcd:1234:ef0::1
thanks!

Try option ip6ifaceid

(Although, the Wiki says this is for a static IP.)

:spiral_notepad: It should be possible to assign a subnet (e.g. /64) to WAN from the PD, it could be assigned ::1.

1 Like

Normally, OpenWrt assigns this to the LAN interface on the router.

2 Likes

There is some misconfiguration here, because the lan interface doesn't get any prefix. Then you can assign ::1 to that and it will be preferred source for curl and others.

Please run the following commands (copy-paste the whole block) and paste the output here, using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have

ubus call system board; \
uci export network; \
uci export dhcp; uci export firewall; \
ip -6 addr ; ip -6 ro li tab all ; ip -6 ru; ifstatus wan_6
2 Likes

i think the "misconfiguration" is the firewall option. i set up the nat6 for port forwarding and security reason according to https://openwrt.org/docs/guide-user/network/ipv6/ipv6.nat6. the option uci set firewall.@zone[1].masq6="1" cause this situation. at this point how to use the ::1 suffix as source

Neither is a valid reason to use nat.

Do as asked.

1 Like
{
        "kernel": "5.10.176",
        "hostname": "OpenWrt",
        "system": "Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz",
        "model": "ASUSTeK COMPUTER INC. B150M-ET D3",
        "board_name": "asustek-computer-inc-b150m-et-d3",
        "rootfs_type": "ext4",
        "release": {
                "distribution": "OpenWrt",
                "version": "22.03.5",
                "revision": "r20134-5f15225c1e",
                "target": "x86/64",
                "description": "OpenWrt 22.03.5 r20134-5f15225c1e"
        }
}
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 'fd80::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth1'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.47.1'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option ip6class 'local'

config interface 'wan'
        option proto 'pppoe'
        option device 'eth0'
        option username '123456'
        option password '123456'
        option ipv6 'auto'
        option delegate '0'
        option sourcefilter '0'

config route6
        option interface 'wan'
        option target '::/0'
        option gateway 'fe80::1'

package dhcp

config dnsmasq
        option domainneeded '1'
        option boguspriv '1'
        option filterwin2k '0'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option nonegcache '0'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option nonwildcard '1'
        option localservice '1'
        option ednspacket_max '1232'

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

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

package firewall

config defaults
        option syn_flood '1'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'REJECT'

config zone
        option name 'lan'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'
        list network 'lan'

config zone
        option name 'wan'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option masq '1'
        option mtu_fix '1'
        list network 'wan'
        option masq6 '1'

config forwarding
        option src 'lan'
        option dest 'wan'

config rule
        option name 'Allow-DHCP-Renew'
        option src 'wan'
        option proto 'udp'
        option dest_port '68'
        option target 'ACCEPT'
        option family 'ipv4'

config rule
        option name 'Allow-Ping'
        option src 'wan'
        option proto 'icmp'
        option icmp_type 'echo-request'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-IGMP'
        option src 'wan'
        option proto 'igmp'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-DHCPv6'
        option src 'wan'
        option proto 'udp'
        option dest_port '546'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-MLD'
        option src 'wan'
        option proto 'icmp'
        option src_ip 'fe80::/10'
        list icmp_type '130/0'
        list icmp_type '131/0'
        list icmp_type '132/0'
        list icmp_type '143/0'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Input'
        option src 'wan'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        list icmp_type 'router-solicitation'
        list icmp_type 'neighbour-solicitation'
        list icmp_type 'router-advertisement'
        list icmp_type 'neighbour-advertisement'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Forward'
        option src 'wan'
        option dest '*'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-IPSec-ESP'
        option src 'wan'
        option dest 'lan'
        option proto 'esp'
        option target 'ACCEPT'

config rule
        option name 'Allow-ISAKMP'
        option src 'wan'
        option dest 'lan'
        option dest_port '500'
        option proto 'udp'
        option target 'ACCEPT'

config rule
        option name '8001'
        option src 'wan'
        option src_port '8001'
        option dest 'lan'
        option target 'ACCEPT'

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
    inet6 fe80::36f7:16ff:fe83:23a6/64 scope link
       valid_lft forever preferred_lft forever
4: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
    inet6 fd80::1/60 scope global noprefixroute
       valid_lft forever preferred_lft forever
    inet6 fe80::fa32:e4ff:fe9b:826b/64 scope link
       valid_lft forever preferred_lft forever
5: pppoe-wan: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492 state UNKNOWN qlen 3
    inet6 240e:3b0:438:728:36f7:16df:6583:23a6/64 scope global dynamic noprefixroute
       valid_lft 2591681sec preferred_lft 604481sec
    inet6 fe80::36f7:16df:6583:23a6/128 scope link
       valid_lft forever preferred_lft forever
default from 240e:3b0:438:728::/64 via fe80::e44b:bfff:fed8:52 dev pppoe-wan  metric 512
default from 240e:3b4:482:98f0::/60 via fe80::e44b:bfff:fed8:52 dev pppoe-wan  metric 512
unreachable 240e:3b0:438:728::/64 dev lo  metric 2147483647
unreachable 240e:3b4:482:98f0::/60 dev lo  metric 2147483647
fd80::/64 dev br-lan  metric 1024
unreachable fd80::/48 dev lo  metric 2147483647
fe80::36f7:16df:6583:23a6 dev pppoe-wan  metric 256
fe80::e44b:bfff:fed8:52 dev pppoe-wan  metric 256
fe80::/64 dev br-lan  metric 256
fe80::/64 dev eth0  metric 256
default via fe80::1 dev pppoe-wan  metric 1024
local ::1 dev lo table local  metric 0
anycast 240e:3b0:438:728:: dev pppoe-wan table local  metric 0
local 240e:3b0:438:728:36f7:16df:6583:23a6 dev pppoe-wan table local  metric 0
anycast fd80:: dev br-lan table local  metric 0
local fd80::1 dev br-lan table local  metric 0
anycast fe80:: dev br-lan table local  metric 0
anycast fe80:: dev eth0 table local  metric 0
local fe80::36f7:16df:6583:23a6 dev pppoe-wan table local  metric 0
local fe80::36f7:16ff:fe83:23a6 dev eth0 table local  metric 0
local fe80::fa32:e4ff:fe9b:826b dev br-lan table local  metric 0
multicast ff00::/8 dev br-lan table local  metric 256
multicast ff00::/8 dev eth0 table local  metric 256
multicast ff00::/8 dev pppoe-wan table local  metric 256
0:      from all lookup local
32766:  from all lookup main
{
        "up": true,
        "pending": false,
        "available": true,
        "autostart": true,
        "dynamic": true,
        "uptime": 10520,
        "l3_device": "pppoe-wan",
        "proto": "dhcpv6",
        "device": "pppoe-wan",
        "metric": 0,
        "dns_metric": 0,
        "delegation": true,
        "ipv4-address": [

        ],
        "ipv6-address": [
                {
                        "address": "240e:3b0:438:728:36f7:16df:6583:23a6",
                        "mask": 64,
                        "preferred": 604480,
                        "valid": 2591680
                }
        ],
        "ipv6-prefix": [
                {
                        "address": "240e:3b4:482:98f0::",
                        "mask": 60,
                        "preferred": 2080,
                        "valid": 2080,
                        "class": "wan_6",
                        "assigned": {

                        }
                }
        ],
        "ipv6-prefix-assignment": [

        ],
        "route": [
                {
                        "target": "::",
                        "mask": 0,
                        "nexthop": "fe80::e44b:bfff:fed8:52",
                        "metric": 512,
                        "valid": 1480,
                        "source": "240e:3b4:482:98f0::/60"
                },
                {
                        "target": "::",
                        "mask": 0,
                        "nexthop": "fe80::e44b:bfff:fed8:52",
                        "metric": 512,
                        "valid": 1480,
                        "source": "240e:3b0:438:728:36f7:16df:6583:23a6/64"
                }
        ],
        "dns-server": [
                "240e:1f:1::1",
                "240e:1f:1::33"
        ],
        "dns-search": [

        ],
        "neighbors": [

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

                ],
                "ipv6-address": [

                ],
                "route": [

                ],
                "dns-server": [

                ],
                "dns-search": [

                ],
                "neighbors": [

                ]
        },
        "data": {
                "zone": "wan",
                "passthru": "00170020240e001f000100000000000000000001240e001f000100000000000000000033",
                "zone": "wan"
        }
}

ok, i follow your instruction and post the configuration.

uci del network.lan.ip6class
uci commit network
ifup lan

You also probably don't need the static route you added and you can remove it.

1 Like