Configure WiFi-SSID -frequency -transmitpower via DHCP

Hello everybody,

the subject line already says what I'm trying to do: Using DHCP on the WAN-Interface with a DHCP-server that delivers additional information about what SSID, frequency and transmit-power the access points WiFi should use.

We are using ISC dhcpd and adding a vendor field to the DHCP-reply is no problem. But how do I change the booting sequence of OpenWRT such that the WAN interface will be configured via DHCP and the contents of the DHCP-reply will be used to change the WiFi-config?

An alternative would be to download the WiFi-config via wget once the WAN has been configured. But how do I fetch the WiFi config after WAN-configuration and before WiFi-configuration?

Any ideas?


Why does it have to be before WiFi-configuration? Once you've obtained the settings, you can just apply them and restart the WiFi-interface, you know. It'll only take a couple of seconds longer before the router is useable, so hardly a huge loss in that regards, either.

Or if it really is THAT huge a deal, just set the WiFi-interface to not be automatically brought up and instead bring it up only once you've obtained the settings.

Your are right, fetching the WiFi-config needs a working WAN-configuration, so it must be done after WAN has been brougth up. But it is absolutely no problem to configure WiFi first with its last configuration and change the WiFi-config at a later point, i.e. from rc.local

But how do I get the DHCP-reply that was used to configure WAN and that has the WiFi-config in one of its vendor-options?


That I do not know. Seems like a very unusual setup, so I'm not sure there even is any good way of doing that with standard tools.

You'd ask your ISP. Though I'd surmise if they suppored the bring-your-own-device, would say to configure the proper Client ID or Vendor Class. You can find these settings on the advanced WAN interface config tab.

OP is the one who is running the DHCP-server; they've set the server to deliver WiFi-settings in the same DHCP-reply to OpenWrt-clients in an extra field and want to understand how to actually read the settings from the reply.

Correct; and they asked for "the DHCP-reply that was used to configure WAN".

If not the ISP, they should ask themself. So, I surmised they needed the settings on OpenWrt. The settings remain at the same tab on OpenWrt, which seems like what they're asking:

The OP stated that they already made the corresponding setting in their DHCP server, so that should work.

Hope this helps.

(Regarding the entire config all seems chicken-or-the-egg paradoxes to me...still reading on what the OP wishes to do.)

  • Maybe they should share the field, as we donno what it contains, format, etc.?
  • Are they using a software for this, or is that the actual inquiry?
  • Is this a one-time provision; or for every boot?

(Anyone could write a script to read the packet...e.g. hex positions...if this is something like a enabled (1) or disabled (0) - it doesn't seem too difficult. But I assume this all exists for the OP, if not, that's one idea.)

I'll second what the others wrote already. DHCP cannot be used to configure the wireless per se. You'd have to intercept the dhcp reply packets before they get to the dhcp client, read the interesting part, then clean it up or forward it to the dhcp client.
Otherwise you can add a hotplug script when wan comes up or dhcp gets an address to wget/curl the config and restart wifi.