I prefer to use wired ethernet whenever possible for nodes and PCs, etc. but wifi does have its place for portable nodes and for those who don’t like extra wires. If someone wanted to be able to use both however, eg. ethernet at home (for best performance and less RF floating around), and wifi on the road, I wonder if anyone knows a way to set up Debian so it will automatically turn on/enable wifi only if ethernet is not connected?
There seem to be a variety of ways to manage networking on Debian, wpasupplicant seems pretty common and is what I’m using on wifi-enabled nodes I build, whereas iwd seems to be a newer option that may have some advantages but which I have not tried yet. Is there an option with any of these to try ethernet first and only go to wifi if an IP address could not be obtained on ethernet or if no ethernet cable is plugged in?
If not I can probably set up some DMTF commands to run an AGI script to turn wifi on/off so as to have relatively easy manual control, but it would be nice if it was automatic. I have noticed that if ethernet and wifi are both connected and the node then gets 2 IP addresses assigned that this seems to really confuse the OS/networking stack and internet responses are then very slow.
This question does not really relate to ASL and might be better for a Debian forum, but hopefully someone here has already done this and the answer could be useful for others trying to do the same thing on their nodes.
Hi Mike, What package are you using to manage wifi / networking? I believe that in the default ASL image there is no wifi management app/package by default and you have to install one. And for wpasupplicant or iwd I think they only manage wifi but not ethernet connections, so I don’t know how you could put both in a list and have it try one first. Any details you could provide there would be much appreciated. This would probably be easier if I installed a desktop GUI package such as Mate on the node, however that takes up GB of space and may not all fit on the miniPCs I use (Dell Wyse 3040’s which usually have only 8GB eMMMC). And command line is usually better for keeping things simple and allowing things to be controlled by DTMF commands. Thanks, David. Also BTW Thank you for always being one of the first commenters on the ASL forums and helping so many people.
That is enough to get anyone started. But it’s where my time stops in producing scripts that likely end up in for profit systems. These are the basic command tools. Make them work for your need
A BASH script is the logical choice for custom work within our system. Since it can do anything you can do from a command line and will expand your capability in knowing your system without learning many different languages to get the job done. And you might be surprised just what you can do from a command line.
And these can be called with or without parameters from both app_rpt and asterisk. And I might add, nothing is better documented on the web. I can’t remember the syntax on it all and have to look it up very often.
I quit using the methods posted above in place of something else I will describe briefly here.
It may not fit many folks actual use. Others it may be perfect for.
I took a Linksys wrt54g router and loaded dd-wrt firmware in it. (still a cheap router on ebay) https://dd-wrt.com/
Inside of that firmware, the ability to make your lan all input and your wan on the wifi.
So, I set the WAN wifi to the tether connection on my cell phone.
The linux box was always LAN/eithernet and got it’s WAN internet from the phone.
This is a great method for operating a Pi on ASL portable.
However, if you want inbound connections, you will need a dynamicdns service as your IP will change as you float within cell towers and networks. And the router & firmware will help with that.
So, I didn’t need to use the above scripts anymore for my laptop while mobile. But you can just tether wifi directly to a cell phone, but now you are going to script dyndns if you need to keep inbound connections.
Know that this method also means you are going to lug around a router with you.
(not a issue if you take it all camping LOL)
I used a big LiPO battery on it and a briefcase to carry it and a laptop, mouse with me.
This admitably is not for everyone.
I did use it a couple of times on a ASL Pi portable, so I know it works.
Since then the Pi portable has been collecting dust (it had a led display and wireless keyboard).
Since then, I use a soft iax phone and a phone app ‘Terminus’ for SSH and can leave the equipment at home or in the cloud and do the same. Not really Ham Radio, Just easy access to it. Which is about all you had the other ways.
Lots of good info above. I think what I’ll do is set wifi off by default and create a script that runs at boot that checks the ethernet status and if no IP address is received on ethernet within X seconds then power up the wifi, and then just in case recheck every once in awhile and if a user happens to have plugged in ethernet and an IP address is assigned there then turn off wifi. This should be simple to do. And yes bash does a lot but the syntax is definitely unintuitive. Fortunately PHP does all the same things but with user-friendly syntax, more simplicity and more flexibility. Will post what I come up with soon.
It would still be nice if there was a network package that could do this switching automatically, ie. turn on wifi only when ethernet is not connected, but it should only take me 1/2 hour to set up the same thing in PHP and I’ll then have a more flexible solution and I can also call the script from DTMF commands.