Page MenuHomeDevCentral

Allow to discover IPv6 gateway for Online servers
ClosedPublic

Authored by dereckson on Aug 31 2025, 16:07.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Oct 10, 15:23
Unknown Object (File)
Fri, Oct 10, 07:09
Unknown Object (File)
Fri, Oct 10, 01:10
Unknown Object (File)
Mon, Oct 6, 16:40
Unknown Object (File)
Mon, Oct 6, 16:40
Unknown Object (File)
Sat, Oct 4, 04:56
Unknown Object (File)
Sat, Oct 4, 04:56
Unknown Object (File)
Fri, Oct 3, 09:03
Subscribers
None
Tokens
"Y So Serious" token, awarded by dereckson.

Details

Summary

Online doesn't document gateway for IPv6 blocks.

Normally, inet6 -ifdisabled accept_rtadv up and the DHCPv6 request
to authenticate the right to use the block with DUID should be enough.

If we want to explicitly set a gateway in the routing table, we can
discover it through neighbour discovery protocol (NDP): this will be
the only IP adress not associated to a known MAC address.

With that informatino, gateway can then be declared on NetBox
by an ops running the query-ndp-for-ipv6-neighbor.sh script.

Test Plan

sh utils/query-ndp-for-ipv6-neighbor.sh on WindRiver

Diff Detail

Repository
rOPS Nasqueron Operations
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dereckson created this revision.

The ndp parsing code has been written by a GPT model, offering to forget about awk.

For reference, the following script generated by GPT 5 works too, but only with GNU awk:

#!/bin/sh

# Collect local MAC addresses
LOCAL_MACS=$(ifconfig | awk '/ether/ {print $2}')

# Scan ndp table
ndp -an | gawk -v macs="$LOCAL_MACS" '
NR == 1 { next }

BEGIN {
    split(macs, arr)
    for (i in arr) {
        local[arr[i]] = 1
    }
}
# Fields: IPv6, MAC, iface, ...
{
    mac = $2
    if (mac == "(incomplete)") next
    if (!(mac in local)) {
        ip = $1
        sub(/%.*/, "", ip)
        print ip
        exit 0
    }
}
'
This revision is now accepted and ready to land.Sep 4 2025, 17:06