How to schedule a Cron command for WiFi channels and Frequent DHCP Loss

Hi,

So every time I reboot my OpenWRT Router, due to DFS, the extender is not able to extend the 5GHz signal without me having to change the channel periodically. I would prefer to automate this process, or avoid it altogether given how inconvenient it is to have to constantly access the router.

Additionally, every time I lose internet, I notice that the active DHCP leases are no longer able to be found. I do not know if this is a problem on my end or the ISP.

Any suggestions?

I'm doing this to get my WiFi back on a DFS channel:

00 03 * * * [ "$(iw dev wlan1 info|awk '/channel/{print }')" != 149 ] && /sbin/wifi down && /sbin/wifi up

I assume you know how to set the frequency on a cron entry, if not consult the cron manual (available online as well).

I'm not familiar with the command itself, but I think that the number (149) implies the channel that I plan to change the 5 GHz to.

Can you help me break down the command and its meaning?

Just run iw dev wlan1 info|awk '/channel/{print }' in your SSH session and it will print the channel your radio is on. The [] is a test case that will make /sbin/wifi stop and start again if the channel is anything else than 149.

Yup, I pretty much get it and understand it now.

Just a small problem though; under normal circumstances, with my OpenWRT router alone, the internet works fine. However, the moment I involve an extender, it becomes problematic since it shows no internet and causes a blank DHCP lease when I attempt to access the router.

Do you have any ideas as to why this happens?

That sounds like you're using a router as an extender or access point, and it is trying to hand out DHCP leases by itself, maybe even trying to use the same IP as your OpenWrt router. Make sure it has a different IP in the same subnet (ideally .2 e.g.) and its DHCP server is not active.

1 Like

Yes, my OpenWRT is an AP since the ISP Modem is set to Bridge mode. So, I should change the router IP to something different?

192.168.1.1 to something else to avoid conflict?

Your statements are confusing.

  1. Even if your ISP supplies you with a router/modem combo, if you really have it bridged, it's just working as your modem.
  2. Your OpenWrt device behind that hardware will be your router. Make sure to connect your router to your modem through your router's WAN port.
  3. Make sure your OpenWrt router uses a different subnet for the LAN than your ISP's hardware to avoid conflicts.
  4. Whatever extender/repeater/access point (please note they can all mean different things, so be specific about what it actually is you are connecting) you have, make it sit in the same subnet as your router's LAN, but with a static IP on e.g. .2 or any other low IP, so as not to interfere with the LAN DHCP pool your router uses.
  5. Your extender/... should be connected through its LAN ports to your OpenWrt router.
  6. Make sure DHCP is disabled on your extender/repeater/AP.
1 Like

Alright, sorry for the confusion.

I think I've made the necessary adjustments.

Fingers crossed :slightly_smiling_face:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.