I dont know for sure if this is openwrt related question,
My openwrt details,
root@OpenWrt:~# ubus call system board
{
"kernel": "6.6.67",
"hostname": "OpenWrt",
"system": "ARMv8 Processor rev 3",
"model": "Raspberry Pi 4 Model B Rev 1.1",
"board_name": "raspberrypi,4-model-b",
"rootfs_type": "ext4",
"release": {
"distribution": "OpenWrt",
"version": "24.10.0-rc4",
"revision": "r28211-d55754ce0d",
"target": "bcm27xx/bcm2711",
"description": "OpenWrt 24.10.0-rc4 r28211-d55754ce0d",
"builddate": "1734915335"
}
}
I have below dhcp reservation done in /etc/config/dhcp,
config host
option dns '1'
option name 'pinas'
option mac 'xxxx'
option ip '192.168.0.195'
option leasetime '6h'
option duid 'xxxx'
option hostid '95'
config host
option dns '1'
option name 'raspberrypi'
option mac 'xxxx'
option ip '192.168.0.6'
option leasetime '6h'
option duid 'xxxxxx'
option hostid '06'
And everything works (both pinas and raspberrypi computers got IPv6 address ending ::95 and ::6 respectively)
I have a ddns script running on both computers to grab the latest IPv6 address and update against DNS.
The command I used to grab the IPv6 address is,
ip -6 addr list scope global $device | grep -v " fd" | sed -n 's/.*inet6 \([0-9a-f:]\+\).*/\1/p' | head -n 1
Issue is, some times it grab correct IPv6 address I wanted (ending with ending ::95 and ::6) But some times it grab the longer IPv6 address.
ipconfig from both computers,
pi@pinas:~ $ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.195 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fd96:870e:ded0:0:c2ed:de96:5e98:4586 prefixlen 64 scopeid 0x0<global>
inet6 xxxx:xxx:xx:7673:b9c6:ed2b:d8bd:f619 prefixlen 64 scopeid 0x0<global>
inet6 fe80::8715:e707:9184:e674 prefixlen 64 scopeid 0x20<link>
inet6 xxxx:xxx:xx:7673::95 prefixlen 128 scopeid 0x0<global>
inet6 fd96:870e:ded0:0:a84a:a0bb:ba70:b814 prefixlen 64 scopeid 0x0<global>
inet6 fd96:870e:ded0::95 prefixlen 128 scopeid 0x0<global>
inet6 xxxx:xxx:xx:7673:fbdf:b2cf:30ae:12e0 prefixlen 64 scopeid 0x0<global>
pi@raspberrypi:~ $ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.6 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 xxxx:xxx:xx:7673::6 prefixlen 128 scopeid 0x0<global>
inet6 fd96:870e:ded0::6 prefixlen 128 scopeid 0x0<global>
inet6 fd96:870e:ded0:0:215:c936:c3be:6d26 prefixlen 64 scopeid 0x0<global>
inet6 xxxx:xxx:xx:7673:f6b8:127c:68b9:334 prefixlen 64 scopeid 0x0<global>
inet6 fe80::dc04:fdf9:d894:680f prefixlen 64 scopeid 0x20<link>
Is there a way we can make openwrt put only one IPv6 address (the shorter one)?