• lazy / delayed address allocation via ip command

    From hede@3:633/10 to All on Friday, January 09, 2026 21:00:01

    Dear List,ÿ
    I'm using some post-up commands for additinal ip routes within /etc/network/interfaces. For many years and several debian versions this was fine. Like for example with (sanetized version):
    iface eth0 inet6 staticÿ
    ÿÿaddress aaaa:bbbb:10:60:11::4ÿ
    ÿÿnetmask 80ÿ
    ÿÿgateway aaaa:bbbb:10:60:11::2
    ÿ ÿpost-up ip -6 route add aaaa:bbbb:10:60:105::/80 dev eth0 src aaaa:bbbb:10:60:11::4 via aaaa:bbbb:10:60:11::3
    With trixie this does no longer work. It seems the ip address gets valid several seconds AFTER the post-up script gets run. The logs show some error: ?Error: Invalid source address?
    Does anybody know the reason for this?
    regards
    hede
    ÿ
    Some more information. The following commands get run by ifup:
    ip addr flush dev eth0 mngtmpaddrÿ
    ip link set dev eth0 ÿupÿ
    ip -6 addr add aaaa:bbbb:10:60:11::4/80 ÿdev eth0 ÿ
    ip -6 route replace default via aaaa:bbbb:10:60:11::2 ÿdev eth0 onlink ÿ
    ip -6 route add aaaa:bbbb:10:60:13::/80 dev eth0 src aaaa:bbbb:10:60:11::4 via aaaa:bbbb:10:60:11::3
    The following shows that it needs about 2 seconds for the address to get valid / the route gets applied only after two one-seconds sleeps:
    root@system:~# ip addr flush dev eth0 mngtmpaddr && ip link set dev eth0 ÿup && ip -6 addr add aaaa:bbbb:10:60:11::4/80 ÿdev eth0 ÿ&& ip -6 route replace default via aaaa:bbbb:10:60:11::2 ÿdev eth0 onlink ÿ&& echo iface is up; echo first: ; ip -6 route add aaaa:bbbb:10:60:13::/80 dev eth0 src aaaa:bbbb:10:60:11::4 via aaaa:bbbb:10:60:11::3 ; sleep 1; echo second: ; ip -6 route add aaaa:bbbb:10:60:13::/80 dev eth0 src aaaa:bbbb:10:60:11::4 via aaaa:bbbb:10:60:11::3 ; sleep 1; echo third: ; ip -6 route add aaaa:bbbb:10:60:13::/80 dev eth0 src aaaa:bbbb:10:60:11::4 via aaaa:bbbb:10:60:11::3 ; sleep 1; echo forth: ; ip -6 route add aaaa:bbbb:10:60:13::/80 dev eth0 src aaaa:bbbb:10:60:11::4 via aaaa:bbbb:10:60:11::3 ; sleep 1; echo fifth: ; ip -6 route add aaaa:bbbb:10:60:13::/80 dev eth0 src aaaa:bbbb:10:60:11::4 via aaaa:bbbb:10:60:11::3 ;ÿ
    iface is up
    first:
    Error: Invalid source address.
    second:
    Error: Invalid source address.
    third:
    forth:
    RTNETLINK answers: File exists
    fifth:
    RTNETLINK answers: File exists
    and btw: I do have my solution now, simply by running a postup-script some seconds after ifup finishes. But I'm still interested why this happens.ÿ


    --- PyGate Linux v1.5.2
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Andy Smith@3:633/10 to All on Friday, January 09, 2026 21:40:01
    Hi,

    On Fri, Jan 09, 2026 at 08:50:31PM +0100, hede wrote:
    I do have my solution now, simply by running a postup-script some
    seconds after ifup finishes. But I'm still interested why this
    happens.ÿ

    Could it be waiting for duplicate address detection (DAD)? You could try
    with:

    iface eth0 inet6 staticÿ
    ÿÿ address aaaa:bbbb:10:60:11::4/80
    ÿÿ gateway aaaa:bbbb:10:60:11::2
    dad-attempts 0
    ?

    to see if that helps. Obviously you will then have to be careful not to
    use this address elsewhere as well.

    Failing that, you could improve the post-up sleep a bit by calling a
    script that:

    1. reads the list of IPs for that interface

    2. If source address found, add the route

    3. sleep for a second

    4. go to (1), probably check if already waited for too long and abort if
    so.

    Thanks,
    Andy

    --
    https://bitfolk.com/ -- No-nonsense VPS hosting

    --- PyGate Linux v1.5.2
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From hede@3:633/10 to All on Saturday, January 10, 2026 08:40:01
    Hi Andy
    Am 09.01.26 um 21:38 schrieb Andy Smith:
    ...
    Could it be waiting for duplicate address detection (DAD)? You could try with:

    iface eth0 inet6 static
    ?? address aaaa:bbbb:10:60:11::4/80
    ?? gateway aaaa:bbbb:10:60:11::2
    dad-attempts 0
    \u2026
    That's it. Thank you. Quite easy to understand.
    Yet I am even more interested in why that was no problem with previous
    Debian versions. And indeed as it's a system within a network for me
    /dad/ will stay enabled - obviously ;-).
    regards
    hede


    --- PyGate Linux v1.5.2
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Stefan Monnier@3:633/10 to All on Saturday, January 10, 2026 16:30:01
    Could it be waiting for duplicate address detection (DAD)? You could try
    with:

    iface eth0 inet6 static
    ÿÿ address aaaa:bbbb:10:60:11::4/80
    ÿÿ gateway aaaa:bbbb:10:60:11::2
    dad-attempts 0
    ?

    That's it. Thank you. Quite easy to understand.

    Yet I am even more interested in why that was no problem with previous
    Debian versions.

    I suggest `reportbug`: It seems like the `post-up` script is run
    a bit too early.


    Stefan

    --- PyGate Linux v1.5.2
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)