Page MenuHomeDevCentral

Allow to discover IPv6 gateway for Online servers
ClosedPublic

Authored by dereckson on Sun, Aug 31, 16:07.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Sep 17, 22:32
Unknown Object (File)
Wed, Sep 17, 22:32
Unknown Object (File)
Wed, Sep 17, 08:36
Unknown Object (File)
Tue, Sep 16, 18:59
Unknown Object (File)
Tue, Sep 16, 10:37
Unknown Object (File)
Tue, Sep 16, 00:11
Unknown Object (File)
Sat, Sep 13, 11:26
Unknown Object (File)
Sat, Sep 13, 04:32
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.Thu, Sep 4, 17:06