dhcpcd icon indicating copy to clipboard operation
dhcpcd copied to clipboard

Can we try harder to keep a delegated prefix?

Open gadall opened this issue 7 months ago • 4 comments

My ISP allows rebind while the link is still up, but if the PPPoE connection is closed and reestablished, rebind is always responded to with zero validity, and they like to forcibly close the connection every few days. However, I can make dhcpcd request the exact same prefix again in its solicit message, and that just works! ia_pd 2/2001:xxxx:xxxx:b167::/64 enp2s0/0 When requesting an out-of-range prefix, the ISP just responds with something that's available and that works. So I wonder, can dhcpcd just do this for me dynamically? If I statically configure a prefix there's no guarantee that exact prefix will always be available. But dhcpcd can just repeat the same prefix it used in its rebind request and see if it works. That would allow me to hold on to a prefix for as long as possible, rather than get a whole new one every few days. If requesting a specific or impossible prefix would cause trouble with some DHCPv6 servers then perhaps this could be made a configurable option.

gadall avatar Mar 19 '25 14:03 gadall

But dhcpcd should put the prefix you have in the rebind message. If the server does not reply then I don't know what to suggest. There should be no difference between the two messages other than one is rebind and the other is solicit. You should be able to verify this with tcpdump, so the question then becomes why does the PPPoE server not respond to the rebind request?

rsmarples avatar Mar 20 '25 10:03 rsmarples

The server responds to the rebind request with zero valid lifetime, a.k.a. expired. dhcpcd logs: ppp0: 2001:xxxx:xxxx:3a39::/64: no valid lifetime The server seems to always do this if PPPoE was reconnected. The subsequent solicit request does not contain a specific prefix, unless the configuration file contains a specific one. It occurs to me that it could be useful if dhcpcd could repeat in the solicit request the same prefix from the previous lease. When I force it via the configuration file I do get the desired result, but doing it dynamically would work even if occasionally I do get a new prefix - I'd still be able to reacquire it instead of always getting a new one. Of course I verified with tcpdump that the solicit request following a rebind does not contain a prefix if none is specified in the configuration file.

parsed by wireshark, the solicit looks like this:

DHCPv6
    Message type: Solicit (1)
    Transaction ID: 0xced2b0
    Client Identifier
        Option: Client Identifier (1)
        Length: 14
        DUID: 000103042e51a91c000000000000
        DUID Type: link-layer address plus time (1)
        Hardware type: Loopback (772)
        DUID Time: Aug 16, 2024 14:07:24.000000000 CST
        Link-layer address: 000000000000
    Identity Association for Non-temporary Address
        Option: Identity Association for Non-temporary Address (3)
        Length: 12
        IAID: 00000001
        T1: 0
        T2: 0
    Identity Association for Prefix Delegation
        Option: Identity Association for Prefix Delegation (25)
        Length: 12
        IAID: 00000002
        T1: 0
        T2: 0
    Option Request
        Option: Option Request (6)
        Length: 10
        Requested Option code: DNS recursive name server (23)
        Requested Option code: Domain Search List (24)
        Requested Option code: Client Fully Qualified Domain Name (39)
        Requested Option code: SOL_MAX_RT (82)
        Requested Option code: INF_MAX_RT (83)
    Elapsed time
        Option: Elapsed time (8)
        Length: 2
        Elapsed time: 0ms
    Rapid Commit
        Option: Rapid Commit (14)
        Length: 0
    Client Fully Qualified Domain Name
        Option: Client Fully Qualified Domain Name (39)
        Length: 5
        Flags: 0x01  [CLIENT wants SERVER to update both its AAAA and PTR RRs]
        Partial domain name: rt0

gadall avatar Mar 20 '25 10:03 gadall

Can you also post the capture for the REBIND and the REPLY please?

rsmarples avatar Mar 20 '25 10:03 rsmarples

DHCPv6
    Message type: Rebind (6)
    Transaction ID: 0xa66cec
    Client Identifier
        Option: Client Identifier (1)
        Length: 14
        DUID: 000103042e51a91c000000000000
        DUID Type: link-layer address plus time (1)
        Hardware type: Loopback (772)
        DUID Time: Aug 16, 2024 14:07:24.000000000 CST
        Link-layer address: 000000000000
    Identity Association for Non-temporary Address
        Option: Identity Association for Non-temporary Address (3)
        Length: 12
        IAID: 00000001
        T1: 0
        T2: 0
    Identity Association for Prefix Delegation
        Option: Identity Association for Prefix Delegation (25)
        Length: 41
        IAID: 00000002
        T1: 0
        T2: 0
        IA Prefix
            Option: IA Prefix (26)
            Length: 25
            Preferred lifetime: 0
            Valid lifetime: 0
            Prefix length: 64
            Prefix address: 2001:xxxx:xxxx:b167::
    Option Request
        Option: Option Request (6)
        Length: 10
        Requested Option code: DNS recursive name server (23)
        Requested Option code: Domain Search List (24)
        Requested Option code: Client Fully Qualified Domain Name (39)
        Requested Option code: SOL_MAX_RT (82)
        Requested Option code: INF_MAX_RT (83)
    Elapsed time
        Option: Elapsed time (8)
        Length: 2
        Elapsed time: 0ms
    Client Fully Qualified Domain Name
        Option: Client Fully Qualified Domain Name (39)
        Length: 5
        Flags: 0x01  [CLIENT wants SERVER to update both its AAAA and PTR RRs]
        Partial domain name: rt0


DHCPv6
    Message type: Reply (7)
    Transaction ID: 0xa66cec
    Server Identifier
        Option: Server Identifier (2)
        Length: 10
        DUID: 0003000168ab090dc801
        DUID Type: link-layer address (3)
        Hardware type: Ethernet (1)
        Link-layer address: xxxxxx
        Link-layer address (Ethernet): Nokia_xx:xx:xx (xxxxx)
    Client Identifier
        Option: Client Identifier (1)
        Length: 14
        DUID: 000103042e51a91c000000000000
        DUID Type: link-layer address plus time (1)
        Hardware type: Loopback (772)
        DUID Time: Aug 16, 2024 14:07:24.000000000 CST
        Link-layer address: 000000000000
    Identity Association for Prefix Delegation
        Option: Identity Association for Prefix Delegation (25)
        Length: 41
        IAID: 00000002
        T1: 0
        T2: 0
        IA Prefix
            Option: IA Prefix (26)
            Length: 25
            Preferred lifetime: 0
            Valid lifetime: 0
            Prefix length: 64
            Prefix address: 2001:xxxx:xxxx:b167::
    DNS recursive name server
        Option: DNS recursive name server (23)
        Length: 32
         1 DNS server address: 2001:xxxx:xxxx::2
         2 DNS server address: 2001:xxxx:xxxx::1

gadall avatar Mar 20 '25 10:03 gadall