Posts: 50
Joined: Sat Nov 17, 2012 10:58 am

Using wlan0 after eth0 disconnected

Wed Sep 23, 2015 5:01 pm

Hi all
Looking for some help from the group. Hopefully its a simple request..

I want the Pi to be connected to 2 different networks-eth0 on network1, and wlan0 on network2-mainly for a resiliency project. Upon bootup, eth0 seems to be the dominant connection? I would like to be able to remotely disable eth0 (so connected by ssh), and then let wlan0 take over all routing/traffic. When I try this, and either
a) physically disconnect eth0
b) perform a sudo ifdown eth0

eht0 does go down, wlan0 stays up-but no traffic passes over wlan0! I'm not sure if this is a firewall thing, or there is a further action after the ifdown I need to invoke?
When I reboot, eth0 comes back up, again as the dominant connection. One of the other reasons for this is that I would like the choice of sending/receiving traffic on the interface I choose, rather than leaving it up to the Pi :-) I'm doing all this with the Pi beside me, as if ssh is travelling over the Pi via eth0, what solution I can try, has to then either resume the ssh connection-or at least be able to disconnect, and then ssh over the wlan0 link.

Hope this makes sense!


User avatar
Posts: 37128
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Using wlan0 after eth0 disconnected

Wed Sep 23, 2015 6:22 pm

Have you removed ifplugd from your system (or reconfigured it)? The useless piece of software messes with your interfaces so that only one is ever active at any one time.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Posts: 3
Joined: Wed Sep 23, 2015 5:57 pm

Re: Using wlan0 after eth0 disconnected

Wed Sep 23, 2015 6:52 pm

wouldn't you be able to put something in the if-down scripts?

or something similar to:

Code: Select all

auto eth0
iface eth0 inet static
	### static routing ###
[b]        post-up route add -net netmask gw
        pre-down route del -net netmask gw[/b]
auto eth1
iface eth1 inet static
        # dns-* options are implemented by the resolvconf package, if installed

Except, you would change it for your information.

Posts: 50
Joined: Sat Nov 17, 2012 10:58 am

Re: Using wlan0 after eth0 disconnected

Thu Sep 24, 2015 7:56 am

Hi chaps
First of all, thanks for the replies-I did try the removal of ifplugd, but found when I did it, eth0 refused to come back up, as did the wlan0! I had to do it manually-putting ifplugd back in seemed to solve the issue on eth0, but the wlan adaptor needs to be taken out, and put back in, manually.So issues on that, not sure why

I did look at routing, and found this page ... ic-network

using the following commands
sudo route del default
Add a new default route for the other network
sudo route add default gw x.x.x.x

Putting in all into a small bash script seems to do the trick-having 2 scripts in cron (one for the eth0, and one for the wlan0 route), I can swap between the two connections-seems to work really well? Both interfaces stay up, but all traffic can be routed over which ever connection I choose

Make sense?



Posts: 1
Joined: Thu Sep 24, 2015 11:29 am

Re: Using wlan0 after eth0 disconnected

Thu Sep 24, 2015 12:33 pm

My problem is related but slightly different. I have 2 Pi's. The older one controls my central heating and is fully accessible by ssh and Internet. I connect into it using Blynk. The newer one one is fully updated and I can connect using Blynk over the Internet but I cannot ssh into it. If I ping from a PC it returns unreachable. The router can see it and it has an IP address but it is not accessible over the LAN whether by ethernet or Wifi. The older Pi has not been updated since June.

Return to “Networking and servers”