When I connect or disconnect the ethernet wire, my ssh connection to the Pi via WiFi goes down.
Sure would like to understand why it happens, and find a way to workaround it.
Any thoughts, or insights would be appreciated...
TIA
Re: Connecting Ethernet disconnects WiFi?
I'm quite new to the RPi, but I had a similar problem.
Turned out that if the amps drawn by the Pi go above a certain point (related to power supply A rating, perhaps) then things related to USB/Ethernet go a bit whacky. I think, from other posts on here, that there is a bit of an undocumented feature relating to how some devices plugged into the USB cause the ethernet to drop.
So, you could get a 1.5A power supply and see if that helps, or run some USB devices on a powered hub? Or perhaps just remove everything you can from the USB (run headless through SSH or VNC?) and see if that helps?
Turned out that if the amps drawn by the Pi go above a certain point (related to power supply A rating, perhaps) then things related to USB/Ethernet go a bit whacky. I think, from other posts on here, that there is a bit of an undocumented feature relating to how some devices plugged into the USB cause the ethernet to drop.
So, you could get a 1.5A power supply and see if that helps, or run some USB devices on a powered hub? Or perhaps just remove everything you can from the USB (run headless through SSH or VNC?) and see if that helps?
Re: Connecting Ethernet disconnects WiFi?
Thanks, I appreciate the reply.
I don't think that the issue is related to power. Even with the Pi headless (connected via SSH), networking restarts everytime the ethernet cable is plugged or unplugged. Once things are stable everything works well.
Why does this happen?
TIA
I don't think that the issue is related to power. Even with the Pi headless (connected via SSH), networking restarts everytime the ethernet cable is plugged or unplugged. Once things are stable everything works well.
Why does this happen?
TIA
Re: Connecting Ethernet disconnects WiFi?
While hot plugging WiFi or other devices into Pi USB ports can draw a surge of power that can cause it to spontaneously reboot, that is not the issue here.
Basically Linux (or Windows likewise) figures that ethernet is faster and more reliable than wireless, so if both ethernet and wireless are set to connect automatically and get automatic (dhcp) IP, it automatically switches to ethernet if that is active, and if there is no ethernet, it automatically switches to wireless (assuming that exists).
You can easily test that (I did) if you have display and keyboard attached. Look at the output of ifconfig with just wireless, and then look at it again after plugging in your ethernet cable. In the first case wlan0 will have an IP (eth0 not) and in latter case eth0 will have an IP (wlan0 not). But the automatic IP of each will be different because the MAC (hardware) address of each device is different, so that is why your ssh was interrupted.
It is possible for a computer to have more than one IP address on the same subnet at the same time, but to be brief, that is more complicated and may require some manual configuration of IP/netmask, routing, and possibly binding specific applications to specific IP's to actually make use of it.
Basically Linux (or Windows likewise) figures that ethernet is faster and more reliable than wireless, so if both ethernet and wireless are set to connect automatically and get automatic (dhcp) IP, it automatically switches to ethernet if that is active, and if there is no ethernet, it automatically switches to wireless (assuming that exists).
You can easily test that (I did) if you have display and keyboard attached. Look at the output of ifconfig with just wireless, and then look at it again after plugging in your ethernet cable. In the first case wlan0 will have an IP (eth0 not) and in latter case eth0 will have an IP (wlan0 not). But the automatic IP of each will be different because the MAC (hardware) address of each device is different, so that is why your ssh was interrupted.
It is possible for a computer to have more than one IP address on the same subnet at the same time, but to be brief, that is more complicated and may require some manual configuration of IP/netmask, routing, and possibly binding specific applications to specific IP's to actually make use of it.
Re: Connecting Ethernet disconnects WiFi?
Problem is I can no longer access my Pi when I plug in the ethernet cable. I'm attempting to monitor my internet connection outside my NAT router. Ethernet has a manually set private IP (10.0.0.xx). The WiFi connection associates with the router and has a DHCP assigned local IP (192.168.2.xx).
What I cannot understand is that while the WiFi connection pings fine, ssh no longer responds.
If I leave the Pi in place and simple unplug the ethernet connection, I can ssh without issue.
TIA
What I cannot understand is that while the WiFi connection pings fine, ssh no longer responds.
If I leave the Pi in place and simple unplug the ethernet connection, I can ssh without issue.
TIA
Re: Connecting Ethernet disconnects WiFi?
Sorry, getting confused about the tests I've done. I can't ping and ssh after unpluging and repluging ethernet.
I found this in /var/log/messages:
Jan 6 17:28:33 raspberrypi wpa_action: WPA_IFACE=wlan0 WPA_ACTION=CONNECTED
Jan 6 17:28:33 raspberrypi wpa_action: WPA_ID=0 WPA_ID_STR= WPA_CTRL_DIR=/var/run/wpa_supplicant
Jan 6 17:28:33 raspberrypi wpa_action: ifup wlan0=default
Jan 6 17:28:35 raspberrypi wpa_action: creating sendsigs omission pidfile: /run/sendsigs.omit.d/wpasupplicant.wpa_supplicant.wlan0.pid
Jan 6 17:28:35 raspberrypi wpa_action: bssid=00:22:6b:64:00:f7
Jan 6 17:28:35 raspberrypi wpa_action: ssid=sansfils
Jan 6 17:28:35 raspberrypi wpa_action: id=0
Jan 6 17:28:35 raspberrypi wpa_action: mode=station
Jan 6 17:28:35 raspberrypi wpa_action: pairwise_cipher=TKIP
Jan 6 17:28:35 raspberrypi wpa_action: group_cipher=TKIP
Jan 6 17:28:35 raspberrypi wpa_action: key_mgmt=WPA2-PSK
Jan 6 17:28:35 raspberrypi wpa_action: wpa_state=COMPLETED
Jan 6 17:28:35 raspberrypi wpa_action: ip_address=192.168.2.7
Jan 6 17:28:35 raspberrypi wpa_action: address=00:0f:54:02:1b:63
Jan 6 17:30:14 raspberrypi kernel: [ 338.455861] smsc95xx 1-1.1:1.0: eth0: link down
Jan 6 17:31:20 raspberrypi kernel: [ 404.206256] smsc95xx 1-1.1:1.0: eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1
Jan 6 17:31:21 raspberrypi kernel: [ 405.389880] cfg80211: Calling CRDA to update world regulatory domain
Jan 6 17:31:21 raspberrypi wpa_action: WPA_IFACE=wlan0 WPA_ACTION=DISCONNECTED
Jan 6 17:31:21 raspberrypi wpa_action: WPA_ID=0 WPA_ID_STR= WPA_CTRL_DIR=/var/run/wpa_supplicant
Jan 6 17:31:21 raspberrypi wpa_action: ifdown wlan0
Jan 6 17:31:22 raspberrypi wpa_action: removing sendsigs omission pidfile: /run/sendsigs.omit.d/wpasupplicant.wpa_supplicant.wlan0.pid[/size]
[/size]
This shows WiFi connected, then at 17:30:14 I unplug the ethernet cable, and about a min later plug it back. Note that wlan0 drops immediately.
How to I prevent WiFi from dropping when I plug in ethernet cable?
TIA
I found this in /var/log/messages:
Jan 6 17:28:33 raspberrypi wpa_action: WPA_IFACE=wlan0 WPA_ACTION=CONNECTED
Jan 6 17:28:33 raspberrypi wpa_action: WPA_ID=0 WPA_ID_STR= WPA_CTRL_DIR=/var/run/wpa_supplicant
Jan 6 17:28:33 raspberrypi wpa_action: ifup wlan0=default
Jan 6 17:28:35 raspberrypi wpa_action: creating sendsigs omission pidfile: /run/sendsigs.omit.d/wpasupplicant.wpa_supplicant.wlan0.pid
Jan 6 17:28:35 raspberrypi wpa_action: bssid=00:22:6b:64:00:f7
Jan 6 17:28:35 raspberrypi wpa_action: ssid=sansfils
Jan 6 17:28:35 raspberrypi wpa_action: id=0
Jan 6 17:28:35 raspberrypi wpa_action: mode=station
Jan 6 17:28:35 raspberrypi wpa_action: pairwise_cipher=TKIP
Jan 6 17:28:35 raspberrypi wpa_action: group_cipher=TKIP
Jan 6 17:28:35 raspberrypi wpa_action: key_mgmt=WPA2-PSK
Jan 6 17:28:35 raspberrypi wpa_action: wpa_state=COMPLETED
Jan 6 17:28:35 raspberrypi wpa_action: ip_address=192.168.2.7
Jan 6 17:28:35 raspberrypi wpa_action: address=00:0f:54:02:1b:63
Jan 6 17:30:14 raspberrypi kernel: [ 338.455861] smsc95xx 1-1.1:1.0: eth0: link down
Jan 6 17:31:20 raspberrypi kernel: [ 404.206256] smsc95xx 1-1.1:1.0: eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1
Jan 6 17:31:21 raspberrypi kernel: [ 405.389880] cfg80211: Calling CRDA to update world regulatory domain
Jan 6 17:31:21 raspberrypi wpa_action: WPA_IFACE=wlan0 WPA_ACTION=DISCONNECTED
Jan 6 17:31:21 raspberrypi wpa_action: WPA_ID=0 WPA_ID_STR= WPA_CTRL_DIR=/var/run/wpa_supplicant
Jan 6 17:31:21 raspberrypi wpa_action: ifdown wlan0
Jan 6 17:31:22 raspberrypi wpa_action: removing sendsigs omission pidfile: /run/sendsigs.omit.d/wpasupplicant.wpa_supplicant.wlan0.pid[/size]
[/size]
This shows WiFi connected, then at 17:30:14 I unplug the ethernet cable, and about a min later plug it back. Note that wlan0 drops immediately.
How to I prevent WiFi from dropping when I plug in ethernet cable?
TIA
Re: Connecting Ethernet disconnects WiFi?
I have this exact same issue and have been searching the boards for a reason, with the 'too much power' excuse being constantly given. However, I felt this wasn't the case, as like you, it didn't seem to be drawing too much power. After much digging, I have found the issue to be the ifplugd daemon. What is happening is that when you plug in your ethernet cable, the daemon on this interface turns off your wireless adapter.
More information can be found on this daemon here: http://linux.die.net/man/8/ifplugd
Basically, for a quick fix right now I've entered:
sudo ifplugd eth0 --kill
sudo ifplugd eth0 --check-running
This has solved my issue and hopefully will solve yours.
More information can be found on this daemon here: http://linux.die.net/man/8/ifplugd
Basically, for a quick fix right now I've entered:
sudo ifplugd eth0 --kill
sudo ifplugd eth0 --check-running
This has solved my issue and hopefully will solve yours.
- Paul Newton
- Posts: 4
- Joined: Sat Jan 12, 2013 4:08 pm
- Location: Berkshire, UK
Re: Connecting Ethernet disconnects WiFi?
Hello,
I have also had this problem.
So I am going to test the ifplugd suggestion above.
Background:
I have been using a Netduino for some time now and have a buggy base with motors and sensors. I would like to mount a Raspberry Pi on the buggy to be the "brains". The Pi would connect to the Netduino via UDP over wired Ethernet (saving me any more Netduino GPIO pins which I have run out of), and it would connect to my network via Wifi so I can monitor and control it from a PC.
Problem:
I have been using SSH from a windows 7 laptop's "Remote Destop Connection" utility.
I learnt how to set it up here: http://www.raspberrypiblog.com/2012/10/ ... -from.html
It works great, until I try to connect the wired Ethernet cable to either my Netduino or my main network, when I do the the SSH drops. I have to close the SSH session, and I can't re-connect until I remove the Ethernet cable - then it just works again (no reboot needed).
Here goes:
Connect Ethernet cable to main network, and try to continue using the SSH terminal:
It still works!
Power cycle Raspberry Pi, re-connect via SSH,
So the ifplugd setting does not survive a power cycle, but I guess I can add the command to some start up script.....
Thanks jakel - Paul
I have also had this problem.
So I am going to test the ifplugd suggestion above.
Background:
I have been using a Netduino for some time now and have a buggy base with motors and sensors. I would like to mount a Raspberry Pi on the buggy to be the "brains". The Pi would connect to the Netduino via UDP over wired Ethernet (saving me any more Netduino GPIO pins which I have run out of), and it would connect to my network via Wifi so I can monitor and control it from a PC.
Problem:
I have been using SSH from a windows 7 laptop's "Remote Destop Connection" utility.
I learnt how to set it up here: http://www.raspberrypiblog.com/2012/10/ ... -from.html
It works great, until I try to connect the wired Ethernet cable to either my Netduino or my main network, when I do the the SSH drops. I have to close the SSH session, and I can't re-connect until I remove the Ethernet cable - then it just works again (no reboot needed).
Here goes:
Code: Select all
paul@raspberrypi ~ $ sudo ifplugd eth0 --kill
paul@raspberrypi ~ $ sudo ifplugd eth0 --check-running
ifplugd not running
paul@raspberrypi ~ $
Code: Select all
paul@raspberrypi ~ $ ls
Desktop Python
paul@raspberrypi ~ $
Power cycle Raspberry Pi, re-connect via SSH,
Code: Select all
paul@raspberrypi ~ $ sudo ifplugd eth0 --check-running
ifplugd process for device eth0 running as pid 1234
paul@raspberrypi ~ $
Thanks jakel - Paul
Re: Connecting Ethernet disconnects WiFi?
Had the same problem.
Solution was to use allow-hotplug in /etc/network/interfaces:
Solution was to use allow-hotplug in /etc/network/interfaces:
Code: Select all
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa.conf
iface default inet dhcp
- Paul Newton
- Posts: 4
- Joined: Sat Jan 12, 2013 4:08 pm
- Location: Berkshire, UK
Re: Connecting Ethernet disconnects WiFi?
Hi,
I have been away updating my Netduino firmware for a while.
I have just got back around to this Wifi problem.
I tried modifying the interfaces file in /etc/network, my file is now almost identical to the one above, but I still lose Wifi when an Ethernet cable is connected.
The only difference is the wpa-roam entry, which points to a different file.
I did try power cycling the Pi, is there anything else that might help, or do I need to go back to the other solution?
Thanks - Paul
ps I am very new to Linux/Unix, so please explain carefully.
I have been away updating my Netduino firmware for a while.
I have just got back around to this Wifi problem.
I tried modifying the interfaces file in /etc/network, my file is now almost identical to the one above, but I still lose Wifi when an Ethernet cable is connected.
The only difference is the wpa-roam entry, which points to a different file.
I did try power cycling the Pi, is there anything else that might help, or do I need to go back to the other solution?
Thanks - Paul
ps I am very new to Linux/Unix, so please explain carefully.
- Paul Newton
- Posts: 4
- Joined: Sat Jan 12, 2013 4:08 pm
- Location: Berkshire, UK
Re: Connecting Ethernet disconnects WiFi?
Finally got a working solution.
1/ I added "allow-hotplug eth0" into the "interfaces" file in folder "/etc/network"
to edit this file you either need to change the permissions on it, or much easier is to use the nano editor with the sudo prefix. From a terminal window enter
The beginning of my interfaces file now looks like hjorken's:
2/ I removed ifplugd from the Pi using the command This was described by Bill Tompkins at https://github.com/BillTompkins/pi-spie ... ve-ifplugd.
3/ Then I rebooted the Pi using the shutdown command to pickup the changes:
NB to actually shut down the software running on the Pi so you can safly remove the power, use the option "-h"
That solved the problem for me.
Removing the offending ifplugd seems like a brute force way of doing things, and it leaves me wondering if I will miss it later on. Any thoughts?
1/ I added "allow-hotplug eth0" into the "interfaces" file in folder "/etc/network"
to edit this file you either need to change the permissions on it, or much easier is to use the nano editor with the sudo prefix. From a terminal window enter
Code: Select all
sudo nano /etc/network/interfaces
Code: Select all
auto lo
iface lo inet loopback
allow-hotplug eth0 <<< NEW LINE ADDED >>>
iface eth0 inet dhcp
allow-hotplug wlan0
...
Code: Select all
sudo apt-get remove ifplugd
3/ Then I rebooted the Pi using the shutdown command to pickup the changes:
Code: Select all
sudo shutdown -r now
Code: Select all
sudo shutdown -h now
Removing the offending ifplugd seems like a brute force way of doing things, and it leaves me wondering if I will miss it later on. Any thoughts?
- Paul Newton
- Posts: 4
- Joined: Sat Jan 12, 2013 4:08 pm
- Location: Berkshire, UK
Re: Connecting Ethernet disconnects WiFi?
Well I found the first problem, I can't connect to the internet anymore. (sudo apt-get update)
If I ping http://www.google.co.uk, the Pi sends the ping apparently from the wired Ethernet connector and fails to get a response from google on my Netduino!
If I send a ping from my laptop, I can then ping back sucessfully from the Pi, presumably because there is then an ARP entry under the wlan0.
I found that restoring my old copy of the interfaces file and a reboot has fixed this issue, but I guess I will have to switch it back again to talk to my Ethernet connected Netduino.
Why does everything on the Pi have to be so complicated?
Does the order of the connections in the interfaces file imply which is used first?
A rather confused - Paul
If I ping http://www.google.co.uk, the Pi sends the ping apparently from the wired Ethernet connector and fails to get a response from google on my Netduino!
If I send a ping from my laptop, I can then ping back sucessfully from the Pi, presumably because there is then an ARP entry under the wlan0.
I found that restoring my old copy of the interfaces file and a reboot has fixed this issue, but I guess I will have to switch it back again to talk to my Ethernet connected Netduino.
Why does everything on the Pi have to be so complicated?

Does the order of the connections in the interfaces file imply which is used first?
A rather confused - Paul
Re: Connecting Ethernet disconnects WiFi?
This issue was causing me grief too. This post was edited (01/10/13) to reflect a more functional, and concise, configuration. This allows me to hot-swap between wireless and wired as I please, wired connection gets preference.
If you have eth0 connected during boot both connections are marked as up. This is because "allow-hotplug wlan0" is in the interfaces file. If you remove that then wlan0 will not be activated during boot, and it wouldn't automatically connect to wifi. In my case, wlan0 becomes the default route when eth0 is connect at boot. You can unplug your Ethernet cable, then plug it back in, and wlan0 will be brought down... if you care.
There's a bug that sometimes causes eth0 to come up before wlan0 ifdown scripts completed. I inserted a 5 second wait before bringing eth0 up for that reason. Without that pause the default route doesn't get setup when plugging in an Ethernet cable for eth0. I would get LAN access, but no default route for WAN access. Again, the 5 second wait works for me.
This is my "/etc/network/interfaces" file below. I'll leave wpa_supplicant.conf to you.
This is my "/etc/default/ifplugd" file:
After editing, restart the ifplugd service: /etc/init.d/ifplugd restart
Hopefully that helps!
GRK
If you have eth0 connected during boot both connections are marked as up. This is because "allow-hotplug wlan0" is in the interfaces file. If you remove that then wlan0 will not be activated during boot, and it wouldn't automatically connect to wifi. In my case, wlan0 becomes the default route when eth0 is connect at boot. You can unplug your Ethernet cable, then plug it back in, and wlan0 will be brought down... if you care.
There's a bug that sometimes causes eth0 to come up before wlan0 ifdown scripts completed. I inserted a 5 second wait before bringing eth0 up for that reason. Without that pause the default route doesn't get setup when plugging in an Ethernet cable for eth0. I would get LAN access, but no default route for WAN access. Again, the 5 second wait works for me.
This is my "/etc/network/interfaces" file below. I'll leave wpa_supplicant.conf to you.
Code: Select all
auto lo
iface lo inet loopback
iface eth0 inet dhcp
pre-up sleep 5
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface MyHomeWirelessSSID inet dhcp
iface default inet dhcp
Code: Select all
INTERFACES=""
HOTPLUG_INTERFACES="wlan0 eth0"
ARGS="-q -f -u0 -d10 -w -I"
SUSPEND_ACTION="stop"
Hopefully that helps!
GRK
Re: Connecting Ethernet disconnects WiFi?
GRK:
My original problem was that if I had my ethernet unplugged, suddenly there was no route to wlan0. I would get:
Then I found your post, thanks. I did not, however, need the 5 second delay. But when I set my /etc/default/ifplugd like yours, it worked like a charm.
Cheers,
Tom
My original problem was that if I had my ethernet unplugged, suddenly there was no route to wlan0. I would get:
Code: Select all
ssh: connect to host 10.0.0.15 port 22: No route to host
Cheers,
Tom
Re: Connecting Ethernet disconnects WiFi?
I had the same issue with the wifi disconnecting when an ethernet cable was plugged in. The simple solution for me was to changePaul Newton wrote:Finally got a working solution.
1/ I added "allow-hotplug eth0" into the "interfaces" file in folder "/etc/network"
to edit this file you either need to change the permissions on it, or much easier is to use the nano editor with the sudo prefix. From a terminal window enterThe beginning of my interfaces file now looks like hjorken's:Code: Select all
sudo nano /etc/network/interfaces
2/ I removed ifplugd from the Pi using the commandCode: Select all
auto lo iface lo inet loopback allow-hotplug eth0 <<< NEW LINE ADDED >>> iface eth0 inet dhcp allow-hotplug wlan0 ...
This was described by Bill Tompkins at https://github.com/BillTompkins/pi-spie ... ve-ifplugd.Code: Select all
sudo apt-get remove ifplugd
3/ Then I rebooted the Pi using the shutdown command to pickup the changes:NB to actually shut down the software running on the Pi so you can safly remove the power, use the option "-h"Code: Select all
sudo shutdown -r now
That solved the problem for me.Code: Select all
sudo shutdown -h now
Removing the offending ifplugd seems like a brute force way of doing things, and it leaves me wondering if I will miss it later on. Any thoughts?
Code: Select all
wpa-roam
Code: Select all
wpa-conf
Code: Select all
/etc/network/interfaces