Page 1 of 1

Vendor-class-id replaced with generic option matcher - How to PXE boot?

Posted: Tue Aug 09, 2022 2:50 pm
by blazej222
Hello. I want to run PXE server in my local network and setup the router's DHCP server to serve different files according to client's PXE architecture string (example: EFI32 receives boot.e32, EFI64 receives boot.e64, legacy bios receives boot.bios).
Until 7.4 it was possible by creating vendor-class-id rule with custom option set.
# [admin@v7] /ip/dhcp-server/vendor-class-id> add 
Creates new item with specified property values.

address-pool -- pool used for this vendor-class-id
copy-from -- Item number
disabled -- Defines whether item is ignored or used
name -- 
option-set -- 
vid -- contents of vendor-class-id as string or hex with 0x prefix
In changelog for version 7.4 we can read
dhcp-server - change "vendor-class-id" matcher to generic option matcher;
Is it possible to replicate this exact behavior on versions 7.4+? I don't really understand how to use this new option matcher, because what I think it does is it simply allows to select a dhcp server/address pool according to dhcp client option 93 (or other option), but doesn't allow specifying dhcp option sets to be sent back to the client.

Re: Vendor-class-id replaced with generic option matcher - How to PXE boot?

Posted: Sat Sep 10, 2022 6:00 pm
by deramirez
same problem. can't find any documentation for new matcher.

looks like option matcher works with limited range dhcp options.
in dhcp debug, option 93 displayed as "Unknown(93)":
default received request id 3471760989 from 0.0.0.0 ''
    flags = broadcast
    ciaddr = 0.0.0.0
    chaddr = 08:00:27:2B:77:C2	
    Address-Request = 192.168.88.174
    Msg-Type = request
    Server-Id = 192.168.88.1
	Parameter-List = Subnet-Mask,Unknown(2),Router,Unknown(4),Unknown(5),Domain-Server,Host-Name,Unknown(13),Domain-Name,Unknown(17),Unknown(18),Unknown(22),Unknown(23),Broadcast-Address,Unknown(40),Unknown(41),NTP-Server,Vendor-Specific,Address-Request,Address-Time,Server-Id,Renewal-Time,Rebinding-Time,Class-Id,Unknown(66),Unknown(67),Unknown(97),Unknown(128),Unknown(129),Unknown(130),Unknown(131),Unknown(132),Unknown(133),Unknown(134),Unknown(135)
	Max-DHCP-Message-Size = 65280
    Class-Id = "PXEClient:Arch:00007:UNDI:003000"
    Unknown(93) = 00-07
    Unknown(94) = 01-03-00
    Unknown(97) = 00-25-E8-E7-ED-FD-93-2A-4D-B4-94-E1-78-81-1F-C1-06
If i use matcher with option 60 (Class-Id) it works as expected
But with option 93 (Unknown) matcher wont work.

Re: Vendor-class-id replaced with generic option matcher - How to PXE boot?

Posted: Sun Sep 11, 2022 12:32 am
by deramirez
matcher with option 93 works if value is HEX
to catch arch uefi64: value = 0x0007

for example, i can assign specific pool to uefi64 clients (with option 93 = 0x0007) and its works as expected.
but assigning specific option set to this matcher (with specific bootfile name) has no effect.
[admin@MikroTik] /ip/dhcp-server/matcher> print detail 
 1   name="arch-uefi64" address-pool=uefi option-set=arch-uefi64-default code=93 value="0x0007" 
 2   name="arch-uefi32" address-pool=dhcp option-set=arch-uefi32-default code=93 value="0x0006" 
 
 [admin@MikroTik] /ip/dhcp-server/option/sets> print detail
 0 name="arch-uefi64-default" options=boot-uefi64
 1 name="arch-uefi32-default" options=boot-uefi32
 2 name="arch-bios-default" options=boot-bios

[admin@MikroTik] /ip/dhcp-server/option> print detail
 4 name="boot-bios" code=67 value="'ipxe.pxe'" raw-value="697078652e707865" 
 5 name="boot-uefi32" code=67 value="'ipxe.efi'" raw-value="697078652e656669" 
 6 name="boot-uefi64" code=67 value="'ipxe64.efi'" raw-value="6970786536342e656669" 


Re: Vendor-class-id replaced with generic option matcher - How to PXE boot?

Posted: Sat Sep 24, 2022 12:29 pm
by Fritti
It seems something in the matcher is going to be fixed in 7.6, see viewtopic.php?t=188907#p958429 .

Re: Vendor-class-id replaced with generic option matcher - How to PXE boot?

Posted: Wed Oct 12, 2022 5:29 am
by ormandj
matcher with option 93 works if value is HEX
to catch arch uefi64: value = 0x0007

for example, i can assign specific pool to uefi64 clients (with option 93 = 0x0007) and its works as expected.
but assigning specific option set to this matcher (with specific bootfile name) has no effect.
[admin@MikroTik] /ip/dhcp-server/matcher> print detail 
 1   name="arch-uefi64" address-pool=uefi option-set=arch-uefi64-default code=93 value="0x0007" 
 2   name="arch-uefi32" address-pool=dhcp option-set=arch-uefi32-default code=93 value="0x0006" 
 
 [admin@MikroTik] /ip/dhcp-server/option/sets> print detail
 0 name="arch-uefi64-default" options=boot-uefi64
 1 name="arch-uefi32-default" options=boot-uefi32
 2 name="arch-bios-default" options=boot-bios

[admin@MikroTik] /ip/dhcp-server/option> print detail
 4 name="boot-bios" code=67 value="'ipxe.pxe'" raw-value="697078652e707865" 
 5 name="boot-uefi32" code=67 value="'ipxe.efi'" raw-value="697078652e656669" 
 6 name="boot-uefi64" code=67 value="'ipxe64.efi'" raw-value="6970786536342e656669" 

I've run into the same problem, the matcher doesn't appear to be using the option set I have specified. I'm matching the class id, and the debug dhcp logs show the value I'm expecting from the client, but the option set isn't being applied as expected (boot filename in my case, based on class id/option 60). I'm running 7.5, so I hope 7.6 does actually fix this.

Re: Vendor-class-id replaced with generic option matcher - How to PXE boot?

Posted: Sat Oct 22, 2022 1:17 pm
by deramirez
just tested on 7.6 and looks like problem fixed.
matcher works as expected with option sets and boot options!

Re: Vendor-class-id replaced with generic option matcher - How to PXE boot?

Posted: Sun Oct 23, 2022 2:16 am
by bassist
just tested on 7.6 and looks like problem fixed.
matcher works as expected with option sets and boot options!
Very nice! Are you able to post some snippets/examples? I'm just about to start testing this out and having something to go off would be awesome!

Re: Vendor-class-id replaced with generic option matcher - How to PXE boot?

Posted: Thu Jan 19, 2023 1:12 am
by trnubo
I just got this working with RouterOS 7.7 (never tried on 7.6).
[admin@MikroTik] > /ip/dhcp-server/option print detail 
 0 name="ipxe-uefi64" code=67 value="'ipxe-x86_64.efi'" raw-value="697078652d7838365f36342e656669" 
 1 name="ipxe-uefi32" code=67 value="'ipxe-i386.efi'" raw-value="697078652d693338362e656669" 
 2 name="ipxe-bios" code=67 value="'undionly.kpxe'" raw-value="756e64696f6e6c792e6b707865" 
 3 name="next-server" code=66 value="'192.168.100.1'" raw-value="c0a86401" 
 4 name="ipxe-menu" code=67 value="'menu.ipxe'" raw-value="6d656e752e69707865" 

[admin@MikroTik] > /ip/dhcp-server/option/sets print detail 
 0 name="arch-uefi64" options=ipxe-uefi64,next-server 
 1 name="arch-uefi32" options=ipxe-uefi32,next-server 
 2 name="arch-bios" options=ipxe-bios,next-server 
 3 name="ipxe-menu" options=next-server,ipxe-menu 

[admin@MikroTik] > /ip/dhcp-server/matcher print detail 
 0   name="arch-uefi64" server=vlan100 address-pool=pool-vlan100 option-set=arch-uefi64 code=93 value="0x0007" 
 1   name="arch-uefi32" server=vlan100 address-pool=pool-vlan100 option-set=arch-uefi32 code=93 value="0x0006" 
 2   name="arch-bios" server=vlan100 address-pool=pool-vlan100 option-set=arch-bios code=93 value="0x0000" 
 3   name="ipxe-menu" server=vlan100 address-pool=pool-vlan100 option-set=ipxe-menu code=77 value="iPXE" 
This will boot either bios or efi iPXE based on the Client system architecture (code 93). Then when iPXE runs it will be given "menu.ipxe" based on the User class (code 77). This is based off the examples in this thread (thanks deramirez) and on the iPXE docs iPXE Wiki: PXE chainloading for ICS dhcpd.

It is great to finally have this working in RouterOS.

Re: Vendor-class-id replaced with generic option matcher - How to PXE boot?

Posted: Thu Jan 26, 2023 6:52 pm
by mrboombasticdk
Hello. I have issues making my setup work.

I have a netboot.xyz server running with iPXE, when i use the matcher feature, my PXE client, cannot recieve the boot file or the ip to my tftp server.

If i type in the next server ip, and boot file name, directly in the "dhcp server/networks" section, the is no problems, but i want to be able to boot, both bios and uefi devices.

I use the file "netboot.xyz.kpxe" for bios devices, and "netboot.xyz.efi" for uefi devices.
[xxxxxxx@MikroTik] > ip/dhcp-server/option print detail
 0 name="ipxe-uefi64" code=67 value="'netboot.xyz.efi'" raw-value="6e6574626f6f742e78797a2e656669"
 1 name="ipxe-uefi32" code=67 value="'netboot.xyz.efi'" raw-value="6e6574626f6f742e78797a2e656669"
 2 name="ipxe-bios" code=67 value="'netboot.xyz-undionly.kpxe'" raw-value="6e6574626f6f742e78797a2d756e64696f6e6c792e6b707865" 
 3 name="next-server" code=66 value="'192.168.1.11'" force=yes raw-value="c0a8010b" 
 4 name="ipxe-menu" code=67 value="'menu.ipxe'" raw-value="6d656e752e69707865"


[xxxxxxx@MikroTik] > /ip/dhcp-server/option/sets print detail
 0 name="arch-uefi64" options=ipxe-uefi64,next-server 
 1 name="arch-uefi32" options=ipxe-uefi32,next-server 
 2 name="arch-bios" options=ipxe-bios,next-server 
 3 name="ipxe-menu" options=next-server,ipxe-menu
 
 
 [xxxxxxx@MikroTik] > /ip/dhcp-server/matcher print detail
Flags: X - disabled 
 0   name="arch-uefi64" server=LAN address-pool=LAN option-set=arch-uefi64 code=93 value="0x0007" 
 1   name="arch-uefi32" server=LAN address-pool=LAN option-set=arch-uefi32 code=93 value="0x0006" 
 2   name="arch-bios" server=LAN address-pool=LAN option-set=arch-bios code=93 value="0x0000" 
 3   name="ipxe-menu" server=LAN address-pool=LAN option-set=ipxe-menu code=77 value="iPXE"
Info about netboot.xyz: https://github.com/netbootxyz/netboot.xyz
I'm running routerOS 7.7


Any help would be much appreciated

Re: Vendor-class-id replaced with generic option matcher - How to PXE boot?

Posted: Wed Jun 12, 2024 8:23 pm
by semchs3000
Hi. I just combined ideas from this thread an both bios/efi PXE with auto-selection are working with netboot.xyz for all clients at RouterOS x86 v7.10.2. You can just repeat my conf:

[st@xgw1.stepantv.ru] > ip/dhcp-server/option print detail
 0 name="xyz-efi64" code=67 value="'netboot.xyz.efi'" raw-value="6e6574626f6f742e78797a2e656669" 

 1 name="xyz-bios" code=67 value="'netboot.xyz.kpxe'" raw-value="6e6574626f6f742e78797a2e6b707865" 

 2 name="next-server" code=66 value="'xgw1.stepantv.ru'" raw-value="786777312e73746570616e74762e7275" 
 
 
[st@xgw1.stepantv.ru] > /ip/dhcp-server/option/sets print detail
 0 name="arch-uefi64" options=xyz-efi64,next-server 

 1 name="arch-bios" options=xyz-bios,next-server 
 
 
[st@xgw1.stepantv.ru] > /ip/dhcp-server/matcher print detail
Flags: X - disabled 
 0   name="arch-uefi64" server=dhcp1 address-pool=dhcp_pool0 option-set=arch-uefi64 code=93 value="0x0007" 

 1   name="arch-bios" server=dhcp1 address-pool=dhcp_pool0 option-set=arch-bios code=93 value="0x0000" 
 
 
[st@xgw1.stepantv.ru] > /ip/tftp/print detail
Flags: X - disabled 
 0   ip-addresses=10.99.0.0/22 req-filename="" real-filename="xyz" allow=yes read-only=yes allow-rollover=no allow-overwrite=no 
     reading-window-size=none hits=26 
     
          
st@mox1:~$ ssh xgw1 'file/print' | grep xyz
341  xyz                                                                 
342  xyz/netboot.xyz.kpxe                                                
343  xyz/netboot.xyz.efi                                                 


Re: Vendor-class-id replaced with generic option matcher - How to PXE boot?

Posted: Sat Jun 15, 2024 4:22 pm
by mrboombasticdk
I got it working using zyx's new documentation for mikrotik routers.https://netboot.xyz/docs/kb/networking/mikrotik/
The xyz server is living on my nas in a docker container. I just changed the next server ip to my nas, and everything is working now. Awesome