Community discussions

MikroTik App
 
User avatar
jvanhambelgium
Forum Guru
Forum Guru
Topic Author
Posts: 1128
Joined: Thu Jul 14, 2016 9:29 pm
Location: Belgium

Flexibel DHCP-client options

Sat May 11, 2024 1:04 am

I'm looking into options to bypass my ISP devices and work directly on my RB5009. However for the TV-service of my ISP, they have published detailed specs what you need to be capable of.
Apparently

DHCPv4 Option spoofing:
The following options provided on WAN side need to be provided to the TV decoder:
• Option 6 : DNS
• Option 42 : NTP server
• Option 67 : Bootfilename
• Option 43 : Vendor specific


Now there lies the problem ... the RouterOS DHCP-client service (which is used to obtain info from the ISP - when on GPON/fiber PPPoE is not used anymore - solely DHCPv4 to request your IP) seems only capable of requesting/storing/processing CERTAIN option ?
No flexibility ??


The MikroTik RouterOS DHCP client may be enabled on any Ethernet-like interface at a time. The client will accept an address, netmask, default gateway, and two dns server addresses. The received IP address will be added to the interface with the respective netmask. The default gateway will be added to the routing table as a dynamic entry. Should the DHCP client be disabled or not renew an address, the dynamic default route will be removed. If there is already a default route installed prior the DHCP client obtains one, the route obtained by the DHCP client would be shown as invalid.

RouterOS DHCP cilent asks for following options:

option 1 - SUBNET_MASK,
option 3 - GATEWAY_LIST,
option 6 - TAG_DNS_LIST,
option 33 - STATIC_ROUTE,
option 42 - NTP_LIST,
option 121 - CLASSLESS_ROUTE,


** Actually exactly like this one which was never answered.

viewtopic.php?t=85350


In theory I could start wiresharking and put the values in DHCP-options on the LAN-side, until the ISP changes them for some reason then my TV-box would not work anymore.
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 4965
Joined: Sun May 01, 2016 7:12 pm
Location: California
Contact:

Re: Flexibel DHCP-client options

Sat May 11, 2024 2:11 am

I've never used them, but did you try to add those additional options via:
/ip/dhcp-client/option/add name=bootfilename code=67 value="'somefile'"                              

Those are also in winbox, and docs are explain the format for value follows the dhcp-server scheme:
DHCP client has the possibility to set up options that are sent to the DHCP server. For example, hostname and MAC address. The syntax is the same as for DHCP server options.
which is funky, see https://help.mikrotik.com/docs/display/ ... POptions.1
Parameter's value. Available data types for options are:
'test' -> ASCII to Hex 0x74657374
'10.10.10.10' -> Unicode IP to Hex 0x0a0a0a0a
s'10.10.10.10' -> ASCII to hex 0x31302e31302e31302e3130
s'160' -> ASCII to hex 0x313630
'10' -> Decimal to Hex 0x0a
0x0a0a -> No conversion
$(VARIABLE) -> hardcoded values
RouterOS has predefined variables that can be used:
HOSTNAME - client hostname
RADIUS_MT_STR1 - from radius MT attr nr. 24
RADIUS_MT_STR2 - from radius MT attr nr. 25
REMOTE_ID - agent remote-id
NETWORK_GATEWAY - the first gateway from '/ip dhcp-server network', note that this option won't work if used from lease

Now it is also possible to combine data types into one, for example: "0x01'vards'$(HOSTNAME)"
For example if HOSTNAME is 'kvm', then raw value will be 0x0176617264736b766d.
Last edited by Amm0 on Sat May 11, 2024 2:54 am, edited 1 time in total.
 
jaclaz
Forum Guru
Forum Guru
Posts: 3115
Joined: Tue Oct 03, 2023 4:21 pm

Re: Flexibel DHCP-client options

Sat May 11, 2024 2:31 am

Maybe you can try with DHCP option 55, see:
viewtopic.php?t=172463
Have a look at this too:
viewtopic.php?t=187055

It seems that "custom DHCP client request" is one of the least documented topics.
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 4965
Joined: Sun May 01, 2016 7:12 pm
Location: California
Contact:

Re: Flexibel DHCP-client options

Sat May 11, 2024 3:19 am

In theory I could start wiresharking and put the values in DHCP-options on the LAN-side, until the ISP changes them for some reason then my TV-box would not work anymore.
You'd still need to sniff the existing DHCP from your ISP router what's in the Option 43 Vendor. Hard to know if it's dynamically generated, but imagine it some fixed identifier that it's a TV set-top box.
 
User avatar
patrikg
Member
Member
Posts: 426
Joined: Thu Feb 07, 2013 6:38 pm
Location: Stockholm, Sweden

Re: Flexibel DHCP-client options

Sun May 12, 2024 12:34 am

And if you are dealing with sub options you can do it like me code them by your self, and like @Amm0 says the best thing you have to sniff the traffic to get a know how...then you can do it trough the mikrotik device,
You can use the mikrotik device and mirror some port to your computer and run like wireshark on that.
Here my old thread about sub options for IPTV.
And when I wrote this i think it was on ver 6 not the latest 7.

viewtopic.php?t=72160