Awesome @Lazar-Demin! I never thought to mess around with Firewall. I was trying to do everything through Network but this is awesome because the connection stays active but no traffic can pass through it. This means I can maintain a cellular connection but disallow traffic through it. This is perfect! Thanks so much for looking into this. I'll be sure to let you know how it works for me. Also I'll be putting together a python script to monitor internet connectivity through the interfaces and enable/disable them so I'll be sure to share that script for others.
IOTrav
@IOTrav
Best posts made by IOTrav
-
RE: Looking for input managing network connection interfaces
-
RE: Connect to WiFi and install OPKG package with AutoRun example
Thank you @crispyoz,
I actually finally got it working this morning just the way I wanted. Here's a simple example based on what I did:
printf "%s" "Connecting to WiFi" wifisetup add -ssid Network-SSID -encr wpa2 -password XXXXXXXX printf "%s" "Waiting for Internet" while ! ping -c 1 -n -w 1 www.google.com &> /dev/null do printf "%c" "." done printf "\n%s\n" "Internet Connected" opkg update
Seems to be running great. It waits indefinitely but I don't want it to proceed until Internet connection is there so I didn't figure there was any reason to have a retry count. I'm using an on board RGB LED to indicate when the script starts, when it connects to wifi and begins installing OPKG packages, and when it is complete. This will be used for configuring a group of Onion modules prior to installation in our product. AutoRun is fantastic!
-
Connect to WiFi and install OPKG package with AutoRun example
I have been reviewing the Autorun documentation here:
https://onion.io/usb-autorun/It seems fairly straightforward, however I do not write shell scripts that often. One of the suggestions is to write a script that connects to WiFi and then installs some packages via OPKG. That is exactly what I'm looking to do. However all methods of connecting to WiFi networks appear to be Asynchronous, my issue with that is I need to write a script that connects to a WiFi network, waits for that connection to be established and then install a package via OPKG. Thus I either need a blocking call to connect to WiFi, or I need to write a while block into the script that waits for valid wifi connection using something link ping. Would it be possible to get a super simple .sh example for this?
Latest posts made by IOTrav
-
Console logging with Node-Red
Hey everyone,
I'm working with Node-Red on an Omega Onion 2S+. Since Node-Red is installed a bit differently than on my normal computer I'm not sure how I can access the console terminal for Node-Red so I can do live debugging and view breaking errors. Is this possible somehow? I believe since NodeRed is being ran as a service I can't view the console. Any pointers?
-
RE: Looking for input managing network connection interfaces
Awesome @Lazar-Demin! I never thought to mess around with Firewall. I was trying to do everything through Network but this is awesome because the connection stays active but no traffic can pass through it. This means I can maintain a cellular connection but disallow traffic through it. This is perfect! Thanks so much for looking into this. I'll be sure to let you know how it works for me. Also I'll be putting together a python script to monitor internet connectivity through the interfaces and enable/disable them so I'll be sure to share that script for others.
-
Looking for input managing network connection interfaces
Hi everyone,
We are developing a gateway device based on the Omega2S+. Our hardware supports WiFi, Ethernet, Cellular, and for web configuration of settings soft AP. We have everything fully functional and are on the home stretch. The last thing to do before we can release this thing is to manage internet connectivity.
We plan to have the user prioritize internet connectivity interfaces and to disable them completely if they wish. So they would put the interfaces in order like:
- Ethernet
- WiFi
- Cellular
I plan to use ping in a script to monitor internet connectivity of the interfaces like:
ping -c 1 -n -w 1 -I eth0 www.google.com
I'll do this on interval for all connectivity options the user has selected to enable. Once I find internet connection on the top priority connection I want to ensure that all internet based requests go over that particular interface. I'm not finding a conclusive way to do this. How can you tell OpenWRT to prioritize a particular interface for internet based requests?
If this is outside the scope of this forum please let me know and I'll be happy to request this over on OpenWRT.
Thank you
-
RE: Connect to WiFi and install OPKG package with AutoRun example
Thank you @crispyoz,
I actually finally got it working this morning just the way I wanted. Here's a simple example based on what I did:
printf "%s" "Connecting to WiFi" wifisetup add -ssid Network-SSID -encr wpa2 -password XXXXXXXX printf "%s" "Waiting for Internet" while ! ping -c 1 -n -w 1 www.google.com &> /dev/null do printf "%c" "." done printf "\n%s\n" "Internet Connected" opkg update
Seems to be running great. It waits indefinitely but I don't want it to proceed until Internet connection is there so I didn't figure there was any reason to have a retry count. I'm using an on board RGB LED to indicate when the script starts, when it connects to wifi and begins installing OPKG packages, and when it is complete. This will be used for configuring a group of Onion modules prior to installation in our product. AutoRun is fantastic!
-
Connect to WiFi and install OPKG package with AutoRun example
I have been reviewing the Autorun documentation here:
https://onion.io/usb-autorun/It seems fairly straightforward, however I do not write shell scripts that often. One of the suggestions is to write a script that connects to WiFi and then installs some packages via OPKG. That is exactly what I'm looking to do. However all methods of connecting to WiFi networks appear to be Asynchronous, my issue with that is I need to write a script that connects to a WiFi network, waits for that connection to be established and then install a package via OPKG. Thus I either need a blocking call to connect to WiFi, or I need to write a while block into the script that waits for valid wifi connection using something link ping. Would it be possible to get a super simple .sh example for this?
-
RE: Switching default internet access interface
So from what I can find it looks like the best way to do this is to set the disabled option property on the network interface.
To switch to Cellular execute commands:
uci set network.hologram.disabled=0 uci set wireless.radio0.disabled=1
To switch to WiFi execute commands:
uci set network.hologram.disabled=1 uci set wireless.radio0.disabled=0
If there is a better way of doing this please let me know.
-
Switching default internet access interface
Hey everyone,
I'm working with an Onion Omega2S+. I have it connected to a Sara R410 module which is working great. However I'd like to programmatically switch my internet connection interface between wireless.sta and the Cellular connection. What is the cleanest way to do this? I've seen mentions of using the option metric to do this but not sure I fully grasp how that works. Any input would be greatly appreciated.
For reference, in case it helps, here is the output from uci show network and uci show wireless
uci show network: network.loopback=interface network.loopback.ifname='lo' network.loopback.proto='static' network.loopback.ipaddr='127.0.0.1' network.loopback.netmask='255.0.0.0' network.globals=globals network.globals.ula_prefix='fd1d:48c4:7633::/48' network.wlan=interface network.wlan.type='bridge' network.wlan.proto='static' network.wlan.ipaddr='192.168.3.1' network.wlan.netmask='255.255.255.0' network.wlan.ip6assign='60' network.wwan=interface network.wwan.ifname='apcli0' network.wwan.proto='dhcp' network.wwan.hostname='Cosmic-CB57' network.wan=interface network.wan.ifname='eth0' network.wan.proto='dhcp' network.hologram=interface network.hologram.defaultroute='1' network.hologram.device='/dev/ttyS2' network.hologram.apn='hologram' network.hologram.service='umts' network.hologram.proto='3g' network.hologram.pppd_options='noipdefault'
uci show wireless:
wireless.radio0=wifi-device wireless.radio0.type='ralink' wireless.radio0.variant='mt7628' wireless.radio0.country='US' wireless.radio0.hwmode='11g' wireless.radio0.htmode='HT40' wireless.radio0.channel='auto' wireless.radio0.device_mode='apsta' wireless.radio0.op_mode='preference' wireless.radio0.disabled='0' wireless.ap=wifi-iface wireless.ap.device='radio0' wireless.ap.mode='ap' wireless.ap.network='wlan' wireless.ap.ifname='ra0' wireless.ap.disabled='0' wireless.ap.ssid='Cosmic-CB57' wireless.ap.key='XXXXXXXXX' wireless.ap.encryption='psk2' wireless.sta=wifi-iface wireless.sta.device='radio0' wireless.sta.mode='sta' wireless.sta.ifname='apcli0' wireless.sta.network='wwan' wireless.sta.led='omega2pro:blue:wifi' wireless.sta.disabled='0' wireless.sta.encryption='psk2' wireless.sta.key='XXXXXXXX' wireless.sta.ssid='Travis-WiFi' wireless.@wifi-config[0]=wifi-config wireless.@wifi-config[0].key='XXXXXXXX' wireless.@wifi-config[0].ssid='Travis-WiFi' wireless.@wifi-config[0].encryption='psk2'