Control Omega Wi-Fi AP with Cron?
-
Hello, I would like to be able to toggle the Omega's Wi-Fi access point on and off using Cron. The AP needs to be on during some hours of the day and off at other hours.
My Omega gets Internet access via the Ethernet Expansion unit, which is wired to my home router and ISP. I have its Wi-Fi network radio off -- but its access point is on. Thus it is functioning as an ordinary Wi-Fi AP with wired connection to the network.
Would the Busybox ifup and ifdown be used for this purpose? Or the OpenWRT wifitoggle? Ifup and ifdown don't seem to be able to recognize the Omega's wlan0.
-
After more experimenting, it appears that it's not possible to use the Omega as an AP if the Wi-Fi network setting is off -- even if AP and Wi-Fi network are in separate parts of the Settings.
If the Wi-Fi network is off, the AP will not serve Internet to connected devices even if the Ethernet board is connected to my router and received DHCP from it.
Is this right? I do not need the Omega to connect wirelessly to the Internet. That should be handled by Ethernet. I only need devices to use the Omega as an AP. Thanks.
-
Hi @Onion-Rings, The Omega only has one wifi interface, which is shared by the AP and the interface that connects to your home router. As a result, you need to enable Wi-Fi for AP to work. However, you can enable just the AP and disable the interface that connects to your home router.
Are you trying to turn the Omega into a router? If that's the case, you need to setup the
/etc/config/firewall
to allow routing of traffic frometh0
, which is connected to your home router through the ethernet port andwlan0
, which is the Access point. You can disable the wifi interface connecting to your home router altogether.Does that make sense?
-
It makes sense but I will have to wrap my mind around the complex firewall config.
The objective is not to use the Omega as a router, but to use it as a Wi-Fi Access Point to my home router and gateway to the Internet.
Then use Cron to turn the Wi-Fi AP on and off. Is there a command to do that?
-
@Onion-Rings The firewall is currently configured to route traffic back and forth between the AP and the home wifi. To allow forwarding of packets between ethernet and AP, you first need to create a new network under
/etc/config/network
by adding the following block:config interface 'wan' option ifname 'eth0' option proto 'dhcp' option hostname 'OnionOmega'
Then, you will need to go into
/etc/config/firewall
and add thewan
interface (which you have just created) into a firewall zone namedwan
.Simplying add `list network 'wan' to the following block:
config zone option name wan list network 'wwan' #list network 'wan6' option input ACCEPT option output ACCEPT option forward REJECT option masq 1 option mtu_fix 1
Finally, you need to restart your network and your firewall with the following commands:
/etc/init.d/network restart /etc/init.d/firewall restart
Then your router should be able to route packets between
eth0
and AP.
The way you disable AP through commandline is by using the following command (assuming your AP network is interface number 0):
uci set wireless.@wifi-iface[0].disabled=1 ; uci commit ; wifi
And to enable it again, you run:
uci set wireless.@wifi-iface[0].disabled=0 ; uci commit ; wifi