I have a device that is only accessible using wireless. By default it starts an ad-hoc wireless I can connect to. The problem is there is no internet access on the ad-hoc.
So I'm connecting it to my router using the commands (its a gnu/linux):
iwconfig ath0 mode managed essid "ESSID"
ifconfig ath0 192.168.1.25 netmask 255.255.255.0 up
route add default gw 192.168.1.1
I want to add it to start up script but I don't want to get locked out of the device forever if something happens to the router (its really old).
Is there any way to check if the connection failed and create an ad-hoc instead if it failed?