Réponses céées sur le Forum

  • Jaco Kroon

    Membre
    novembre 5, 2025 à 11:08 pm en réponse à: Configure, Verify and Troubleshoot IPv6 on Linux
    5 HPs
    0 QPs
    2182 XPs

    For those looking to use iproute2 package (replacement for ifconfig etc … tool used underlying by various configuration methods):

    To add an ipv6 address to an interface, eg eth0:

    ip ad ad 2001:db8::dead:beef/64 dev eth0

    To list the addresses:

    ip [-6] li sh dev eth0 (with -6 will limit to ipv6 addresses, without will list all, including link-layer addresses).

    To add/remove routes:

    ip -6 ro {ad|del} default via fe80::???? dev eth0

    It’s also possible to add via global addressing, but typically LL is used, for example:

    ip -6 ro ad default via 2001:db8::1 metric 20000

    Routing table can be shows with:

    ip -6 ro sh

    Here -6 is important because by default ip ro sh will show the v4 routing table. If you’re using routing rules, the rules can be shown with:

    ip -6 rule show

    And specific referenced routing tables can be shown with:

    ip -6 ro sh table xyz

    ip -6 neigh show

    Will show the neighbour cache, ip neigh can also be used for ipv4, not only to show, but also manipulate the in-kernel neighbour caches.

    One other neat feature when SLAAC is in effect is that you can set a “token” that will be used to populate the host portion of the address, in server environments this can for example be used to sync with the static ipv4 address whilst obtaining the prefix from SLAAC, it should be noted that this is an unusual syntax for IPv6, but valid:

    ip token add ::192.168.0.1 dev eth0

    ip token list will throw this back at you:

    plastiekpoot [20:59:59] ~ # ip token list

    token :: dev wlp2s0
    token ::192.168.0.1 dev eth0

    This looks odd, but keep in mind the special IPv4 mapped v6 addresses are of the form:

    ::ffff:a.b.c.d

    Where a.b.c.d is quite literally an IPv4 address (32 bits) mapped into the last 32 bits of an IPv6 address. This same syntax is perfectly valid elsewhere on at least Linux, and the *assumption* for IP tokens (all documentation I find is Linux, and one article referencing Windows, but Mikrotik has a similar concept at least, I’m unable to locate an RFC on the matter).

    What I mean with valid elsewhere is that you could embed IPv4 addresses into global unicast addresses too:

    # ip ad ad 2001:db8::192.168.0.1/64 dev eth0
    # ip ad sh dev eth0 scope global
    870: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 34:48:ed:8d:d4:61 brd ff:ff:ff:ff:ff:ff
    altname enp58s0u1u2
    inet6 2001:db8::c0a8:1/64 scope global tentative
    valid_lft forever preferred_lft forever

    Note that 192 converted to hex is c0, 168 => a8, and 0.1 is 0001 or simply 1 by compression.