Agressive network re-configuration for headless use

I'd like to configure a Pi in such a way that if a network interface is
not able to connect (whether it's because a wireless adaptor is missing,
it can't find its expected wireless network, the Ethernet connection is
missing or not working) it will keep retrying until it picks something
up.
And, if it loses a connection for whatever reason, it won't just sit
there waiting for it to come back, but will actively and aggressively
try to establish a new one - for example, if it loses its IP connection
over Ethernet, it will keep asking for a new DHCP IP address until it
gets one.
Is this possible?
Thanks,
Daniele
Reply to
D.M. Procida
Loading thread data ...
On Sun, 22 Jul 2018 00:04:30 +0200, snipped-for-privacy@apple-juice.co.uk (D.M. Procida) declaimed the following:
Well... the Pi-Star software is apparently configured to spend 2 minutes trying to get a network connection before it creates a WiFi access point (no Internet) for itself. I say "apparently" as I've not seen that behavior -- only read about. The purpose being to let one access the software configuration page wirelessly -- in order to provide the connection information for an Internet WiFi connection.
However, what you ask for is not a boot-time action.
First step is to define loss of "IP connection". Especially since Ethernet connections are via MAC addresses, IP addresses are embedded inside packets that get routed to hardware MAC addresses. DHCP leases of IP numbers are commonly for a 24 hour period so pulling an Ethernet cable, say, does not result in loss of IP lease by the router -- only loss of data packets being sent over the disconnected cable.
The second part of that is determining where the break in connectivity takes place. After all, you might have a valid DHCP lease and Ethernet connection to the router -- but the router may not have connectivity to the Internet.
I suppose one could set up a cron job that periodically pings what is supposed to be the next step, so is tied to a configuration (the router) -- but that does require knowing the IP address of the router (can't rely upon domain name, since it may not be in a DNS system to be translated to IP# -- especially if the DNS is on the other side of the router). If you can't ping the router via a particular interface (and setting up logic to ignore one interface if another is up would be another complication) then you could assume the interface is disconnected -- but there is no sense in sending DHCP requests to a disconnected interface.
With regards to WiFi -- considering how many devices automatically connect (or attempt to) when one moves from the range of one access point to another, it is obviously doable... But does require having either open access points (no WPA password) or a list of connection parameters (supplicant? file in Linux); and a means of determining loss of WiFi connectivity.
--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
	wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.