Page 1 of 1

feature request: dynamic DHCP

Posted: Mon Jun 28, 2010 11:50 pm
by smite
dhpcd on Linux supports dynamic options, like:
  if not exists gpxe.bus-id {
        filename "gpxe/undionly.kpxe";
  } else {
        filename "gpxe/menu.gpxe";
See ... hcp_server for a use-case or for my first topic about it.

I'm not sure what a sensible syntax would be for this.

See for a few implementation examples.

Re: feature request: dynamic DHCP

Posted: Tue Aug 31, 2010 1:50 am
by YazzY
Oh cool, I wrote that Howto. I'm glad people actually find it useful :)

Re: feature request: dynamic DHCP

Posted: Thu Sep 02, 2010 12:40 am
by dssmiktik
I too had the same question.

Basically, this can't be done natively in RouterOS, but you could make a workaround (pretty messy though).

The solution I came up with was to parse the dhcp log entries and the filename based on specific data retrieved.

First, you could have a "catch-all" filename sent that simply tells the client to reboot continuously.
Then, run a script every 1 sec. to parse the dhcp logs. Find the IP, MAC, and bus-id info.
After deciding what file name to push, create a new dhcp network entry with the IP/32, and a new dhcp lease with IP and MAC specified. Have this new lease use your desired dhcp filename entry.
Wait until the client boots with specified filename.
After this, you could parse the dhcp log again, looking for info that the network/lease could be removed.

NOTE: I'm not currently using the above method. This is only a solution in theory that should achieve your end goal. Again, it's messy. There might be easier ways (scripting, parsing, etc...).

Hope this helps.