[Feature Request] DHCP(v4/v6) client: Make arbitrary option codes requestable and provide their values to the script

Motivation:
The DHCP server in Mikrotik routers can be configured to supply arbitrary options to clients, and the DHCP client in Mikrotik routers can be configured to add arbitrary options too, but the DHCP client has no method of requesting arbitrary options from the server and does not make values from arbitrary options available to the user script. Several IPv6 transition mechanisms rely on DHCP(v4/v6) options to give extended IP configuration information to the clients. This includes two of the most widely used protocols at the moment, 6rd and DS-Lite. Without a way to get this information from the ISP’s DHCP server, there is no way to reliably use Mikrotik routers on many ISP connections.

Technical:
RFC 5969 defines 6rd, a protocol based on 6to4. OPTION_6RD (212) for DHCPv4 provides the prefix, mask and length and the addresses of 6rd border relays to the client.
RFC 6333 defines DS-Lite, which uses an IPIPv6 tunnel to a remote CGNAT gateway (called AFTR) in order to move IPv4 through a native IPv6 network. RFC 6334 defines the corresponding OPTION_AFTR_NAME (64) for DHCPv6 to inform the client of the fully qualified domain name of the AFTR.

Request:
Ideally these protocols would be supported directly, but in the meantime they could be scripted, if the DHCP(v4/v6) client could be configured to request arbitrary options and provide the returned values to a script. Please add that functionality to the DHCP clients in RouterOS.

+100

+100, again.

Even if the actual mechanisms aren’t directly supported, arbitrary DHCP option requests and values would be really handy.

When can we expect the feature? Otherwise I have to kick out the mikrotik devices from my network!!!
It is really poor such reaction for implementation.

+1 for supporting rfc5969. it will help a lot with using ipv6.

+1 for this feature!

To request options:


/ip dhcp-client option
# 01 = Subnet Mask, 03 = Router, 06 = Domain Server, d4 = OPTION_6RD
add code=55 name=req_6rd value=0x010306d4

To process responses, I haven’t been able to figure this further out.. I think DHCP option 212 deserves an actual implementation by MikroTik.


/ip dhcp-client
add dhcp-options=req_6rd,hostname,clientid disabled=no interface=ether1 \
    script=":log info [:len (\$\"lease-options\"->\"212\")]"

For DS-lite, would be something similar:


/ipv6 dhcp-client option
# 0017 = OPTION_DNS_SERVERS, 0040 = OPTION_AFTR_NAME
add code=6 name=req_dns_aftr value=0x00170040

But unfortunately $“lease-options” is not implemented.

The default options request on 6.47.10 is

0x010306212A2B333536798A

corresponding to options:

1,3,6,33,42,43,51,53,54,121,138
Subnet Mask, Gateway, DNS Servers, Static Routes, NTP Servers, Vendor Specific, Lease Time,
DHCP Message Type, DHCP Server ID, Classless Static Routes, CAP Access Controller IPs

You can add, for example a request for option “212” (0xD4) [6RD for IPv6] at the end without “destroy” all the other options:

/ip dhcp-client option
add code=55 name=Default-Options-Request value=0x010306212A2B333536798AD4

then add Default-Options-Request to DHCP Client “DHCP option” and add this to “Script” for read it and put on global variable:

:global dhcpClientLEOP $"lease-options"
:global dhcpClient6RD ($dhcpClientLEOP->"212")
:global dhcpClientIF $interface

But you must add and configure on your other router on dhcp-server / network the option 212 [6RD for IPv6] after add the option:

/ip dhcp-server option
add code=212 name=option-6rd value="<INSERT THE RIGHT VALUE HERE>"

Script inside the router, than have the dhcp server active, can change the value.