geekinthesticks
Posts: 97
Joined: Fri Feb 08, 2013 7:22 pm

Network Problems with Ethernet and WiFi Both Configured

Mon Feb 25, 2013 11:18 am

I have got a WifFi dongle from PiHut which works fine. However, I would like to leave my ethernet interface configured in case I ever need to boot without the Wifi dongle. However, if I unplug the ethernet cable and reboot, the Pi doesn't connect to the network. I suspect that it's waiting for ever for eth0 to be connected. My interfaces looks like:

Code: Select all

auto lo

iface lo inet loopback

# iface eth0 inet dhcp

auto eth0
iface eth0 inet static
       address 192.168.0.62
       netmask 255.255.255.0
       gateway 192.168.0.1

allow-hotplug wlan0
auto wlan0
iface wlan0 inet static
        address 192.168.0.61
        netmask 255.255.255.0
        gateway 192.168.0.1
Commenting out the eth0 section allows the WiFi to connect when booted with the ethernet cable unplugged. Any suggestions as to how to leave the ethernet interface enabled and still allow wlan0 to connect at boot.

Cloudcentric
Posts: 982
Joined: Fri Sep 14, 2012 9:13 am

Re: Network Problems with Ethernet and WiFi Both Configured

Mon Feb 25, 2013 11:49 am

Well whatever I have plugged in will be recognised and assigned a IP from DHCP at boot.

If leave both Ethernet and Wireless plugged in get both assigned, which is confusing because they are on different networks.

I am using the latest Raspbian "wheezy" with the default settings..................
I know everything about nothing"

geekinthesticks
Posts: 97
Joined: Fri Feb 08, 2013 7:22 pm

Re: Network Problems with Ethernet and WiFi Both Configured

Mon Feb 25, 2013 2:20 pm

Thanks, I specifically need to assign a static ip. At the moment the Pi s a headless, so I can get at the boot logs. Time to connect it the TV I think.

Raspbrain
Posts: 8
Joined: Wed Jun 13, 2012 6:54 am

Re: Network Problems with Ethernet and WiFi Both Configured

Fri Mar 08, 2013 2:45 pm

Hi geekinthesticks,

I'm having exactly the same issue. Have you resolved this?

Thanks.

geekinthesticks
Posts: 97
Joined: Fri Feb 08, 2013 7:22 pm

Re: Network Problems with Ethernet and WiFi Both Configured

Sat Mar 09, 2013 9:55 am

No I didn't, but I didn't try very hard. My system basically runs on WiFi, so I just commented out the ethernet part of /etc/network/interfaces. If I need to re-enable ethernet I just pull out the SD card and edit the file on another computer.

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5193
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Network Problems with Ethernet and WiFi Both Configured

Sat Mar 09, 2013 11:47 am

Hi folks, I run several Pi's, often "headless" (I've only one HDMI/DVI monitor) and, to ensure I know which one is which, they effectively use "static IP addresses". Whilst they are normally connected by (wired) ethernet I do occasionally use a WiFi dongle (or two). Fortunately my wireless router supports static IP address assignment to specific MAC addresses (ie. physical network ports/dongles). This means that the Pi's get their "static" address via DHCP (which will be different, but known for the wired or WiFi connection). If your router provides such support this should get around your issues switching between wired or wireless connection. FWIW I also assign each Pi a unique "hostname" (although, strictly it's the SD card that has the hostname stored upon it :) ) - details can be found at http://www.cpmspectrepi.webspace.virgin ... tName.html . Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, A+ and a B2) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

geekinthesticks
Posts: 97
Joined: Fri Feb 08, 2013 7:22 pm

Re: Network Problems with Ethernet and WiFi Both Configured

Sat Mar 09, 2013 12:05 pm

I run my own dhcp server and do a similar thing with some of the computers in the house, assigning them static ip's based on their mac address. I use it in combination with Squid proxy server to limit the children's access to things like YouTube at certain times of day. My isp gives me unlimited download limits between 8:00pm and 8:00am, so I limit people's use of bandwidth hungry sites outside those hours.

Raspbrain
Posts: 8
Joined: Wed Jun 13, 2012 6:54 am

Re: Network Problems with Ethernet and WiFi Both Configured

Thu Mar 14, 2013 2:02 pm

@geekinthesticks,
I'm having the same issue.
If I plug in ethernet, both ethernet and wifi work. But if I unplug ethernet wifi doesn't work.

Here is my setting:

$ uname -a
Linux raspberrypi 3.1.9+ #168 PREEMPT Sat Jul 14 18:56:31 BST 2012 armv6l GNU/Linux

(/etc/network/interfaces):
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.2.41
netmask 255.255.255.0
broadcast 192.168.2.255
gateway 192.168.2.1

allow-hotplug wlan0
auto wlan0
iface wlan0 inet static
address 192.168.2.42
netmask 255.255.255.0
broadcast 192.168.2.255
gateway 192.168.2.1
wpa-conf /etc/wpa.conf

(/etc/wpa.conf):
network={
ssid="###MYSSID###"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="###MYPASSWD###"
}

Exactly the same reason as geekinthesticks wrote, I want to keep the ethernet configuration, but I have to disable it to use wifi. Anyone figured out why this is the case?

ashbash
Posts: 50
Joined: Fri Jun 01, 2012 9:20 am

Re: Network Problems with Ethernet and WiFi Both Configured

Fri Mar 15, 2013 9:18 am

You have 2 routes to the same network concurrently. How is that supposed to work?? :?

Ash

Raspbrain
Posts: 8
Joined: Wed Jun 13, 2012 6:54 am

Re: Network Problems with Ethernet and WiFi Both Configured

Sat Mar 16, 2013 1:59 am

ashbash wrote:You have 2 routes to the same network concurrently. How is that supposed to work?? :?

Ash
I don't know much about inner working of Linux or computer network in general, but it does work. The ethernet and wifi bind to different IPs, and I can ssh to the IPs separately. I can turn off each adapter separately as well.

Anyway, I found what the problem is. 'ifplugd' wasn't running or installed properly. I installed it and also installed chkconfig, and made sure the service starts. Another thing is I modified 'interfaces' file as below:

-bash (561) $ more /etc/network/interfaces
auto lo
iface lo inet loopback

allow-hotplug eth0
auto eth0
iface eth0 inet static
address 192.168.2.41
netmask 255.255.255.0
broadcast 192.168.2.255
gateway 192.168.2.1

allow-hotplug wlan0
auto wlan0
iface wlan0 inet static
address 192.168.2.42
netmask 255.255.255.0
broadcast 192.168.2.255
gateway 192.168.2.1
wpa-conf /etc/wpa.conf
===
it seems to be working fine now. I have switched to wifi from ethernet without disabling ethernet, and rebooted -- wifi works fine. I haven't plugged it in with ethernet again yet, but last time, when both ethernet/wifi worked only ethernet is plugged in; if ethernet wasn't plugged in, wifi didn't work either.

Thanks.

Nander
Posts: 31
Joined: Tue Dec 04, 2012 11:21 pm
Location: The Hague - Netherlands

Re: Network Problems with Ethernet and WiFi Both Configured

Sat Mar 16, 2013 2:12 am

What you could also do is remove the auto wlan0 and then in /etc/rc.local put ifup wlan0.

geekinthesticks
Posts: 97
Joined: Fri Feb 08, 2013 7:22 pm

Re: Network Problems with Ethernet and WiFi Both Configured

Sat Mar 16, 2013 8:47 am

Thanks, I didn't know you had to install ifplugd, I'll give it a try now

Raspbrain
Posts: 8
Joined: Wed Jun 13, 2012 6:54 am

Re: Network Problems with Ethernet and WiFi Both Configured

Sat Mar 16, 2013 3:18 pm

geekinthesticks wrote:Thanks, I didn't know you had to install ifplugd, I'll give it a try now
Me neither. I hope this solves your problem too -- but please let us(me) know on this board so others who might have the same problem can fix the problem too.

As I wrote above, I didn't test thoroughly, so hope it works.

anto
Posts: 26
Joined: Tue Jan 01, 2013 5:20 pm
Location: Vienna, Austria

Re: Network Problems with Ethernet and WiFi Both Configured

Mon Mar 18, 2013 5:54 pm

A quite interesting issue that you guys have. I am curious. This could be related to USB devices sharing one upstream to the Broadcom CPU.

Could any of you who have the issue post the following output when you still have problem? Maybe we can have a look together.

- ifconfig -a
- dmesg or /var/log/messages or /var/log/syslog
You can filter out only information related to eth0 and wl0 if you don't want to post the whole thing
- lsusb and lsmod

And you also can install "ethtool" for deeper debugging. I am not sure which options relevant to the problem, but you could start with "ethtool eth0" for instance.

anto
Posts: 26
Joined: Tue Jan 01, 2013 5:20 pm
Location: Vienna, Austria

Re: Network Problems with Ethernet and WiFi Both Configured

Mon Mar 18, 2013 6:54 pm

I think I have missed the obvious information.

geekinthesticks has eth0 on 192.168.0.62/255.255.255.0 and wlan0 on 192.168.0.61/255.255.255.0
Raspbrain has eth0 on 192.168.2.41/255.255.255.0 and wlan0 on 192.168.2.42/255.255.255.0

In both cases, eth0 and wlan0 are on the same subnet. I think the issue that you have got is known as the "ARP Flux problem". You can search the internet for the solutions. Good luck.

Raspbrain
Posts: 8
Joined: Wed Jun 13, 2012 6:54 am

Re: Network Problems with Ethernet and WiFi Both Configured

Mon Mar 18, 2013 8:10 pm

anto wrote:I think I have missed the obvious information.

geekinthesticks has eth0 on 192.168.0.62/255.255.255.0 and wlan0 on 192.168.0.61/255.255.255.0
Raspbrain has eth0 on 192.168.2.41/255.255.255.0 and wlan0 on 192.168.2.42/255.255.255.0

In both cases, eth0 and wlan0 are on the same subnet. I think the issue that you have got is known as the "ARP Flux problem". You can search the internet for the solutions. Good luck.

Thanks. May be that is the cause of the problem. I had no idea about this. I'll do more experiment and report back here.

I really appreciate it.

Raspbrain
Posts: 8
Joined: Wed Jun 13, 2012 6:54 am

Re: Network Problems with Ethernet and WiFi Both Configured

Wed Mar 20, 2013 4:53 am

geekinthesticks wrote:Thanks, I didn't know you had to install ifplugd, I'll give it a try now
I just rebooted the device (w/o connecting to ethernet) and wifi is not working. I'll try again with ethernet tomorrow. Has this fixed your problem?

tibi38
Posts: 42
Joined: Sat Nov 10, 2012 8:46 am
Location: Europe
Contact: Website

Re: Network Problems with Ethernet and WiFi Both Configured

Wed Mar 20, 2013 6:39 am

Sorry,
I missunderstand why it is a problem to have both connected and with a ip-adressed at the same time.
At my home it is all the time working (wifi and cable connected). I can use putty to connect both networks. Also at the same time. There is no problem (if you had a good power supply).
br
Admin of http://bed-and-breakfast-ungarn.de

poing
Posts: 1131
Joined: Thu Mar 08, 2012 3:32 pm

Re: Network Problems with Ethernet and WiFi Both Configured

Wed Mar 20, 2013 7:40 am

Shot in the dark: You guys might want to try remove "allow-hotplug wlan0". In the AP tutorial that fixed a similar issue.


friguyb
Posts: 1
Joined: Wed Aug 14, 2013 5:40 am

Re: Network Problems with Ethernet and WiFi Both Configured

Sat Aug 31, 2013 8:42 pm

Hello,
I finaly found how to setup the network to use both or alternatively Eth0 and Wifi without any reconfiguration.

With my settings I can :
- Boot the PI without any wifi dongle nor cable, then plug the cable (plugin the wifi dongle reboots the PI)
- Boot the PI with both cable and wifi dongle
- Boot the PI only with one or them, usually wifi.

The main trick is to DO NOT set eth0 in auto !! otherwise booting only with the wifi dongle will not work.

Personally I use static adresses but dhcp will do it if you wish.
If you prefer dhcp just replace static by dhcp (2 times) and remove all the lines
containing adresses

All the configuration is done in /etc/network/interfaces only ( no wpa- things )

Here is my /etc/network/interfaces :

Code: Select all

auto lo
iface lo inet loopback

iface eth0 inet static
address 192.168.1.11
netmask 255.255.255.0
gateway 192.168.1.1
network 192.168.1.0

auto wlan0
iface wlan0 inet static
address 192.168.1.111
netmask 255.255.255.0
gateway 192.168.1.1
network 192.168.1.0

wpa-ssid <name of your access point without quotes>
wpa-psk <the wifi password without quotes>
Run the test :
- Reboot the machine and execute ifconfig to check the IPs. As Eth0 is NOT auto you will not see any address, and the system will use the wifi one.
- Try to plug and unplug the cable and do various ping ...
This worked perfectly for me.
Guy

rom1v
Posts: 1
Joined: Sun Oct 27, 2013 9:33 am

Re: Network Problems with Ethernet and WiFi Both Configured

Sun Oct 27, 2013 9:36 am

Anyway, I found what the problem is. 'ifplugd' wasn't running or installed properly.
I had the same problem on a laptop (not a raspberrypi) with Debian Wheezy. When I unplugged eth0, then it remained configured, and took priority over wlan0.
I just installed ifplugd, now it works ;-)

Thanks a lot.

richardvk
Posts: 1
Joined: Fri Nov 01, 2013 8:15 am

Re: Network Problems with Ethernet and WiFi Both Configured

Fri Nov 01, 2013 8:19 am

I found using metric's to be the answer.

For eth0 I added:
metric 1

and for wlan0:
metric 2

under the respective config sections. The interfaces both have static IP's and are both on the same network. Both interfaces now come up, and if i boot with cable unplugged, wlan now comes up successfully. I can even unplug the cable while running and wlan takes over as primary.

alfox
Posts: 127
Joined: Sun Mar 22, 2015 11:06 am

Re: Network Problems with Ethernet and WiFi Both Configured

Mon Apr 13, 2015 2:44 pm

friguyb wrote:Hello,
I finaly found how to setup the network to use both or alternatively Eth0 and Wifi without any reconfiguration.

With my settings I can :
- Boot the PI without any wifi dongle nor cable, then plug the cable (plugin the wifi dongle reboots the PI)
- Boot the PI with both cable and wifi dongle
- Boot the PI only with one or them, usually wifi.

The main trick is to DO NOT set eth0 in auto !! otherwise booting only with the wifi dongle will not work.

Personally I use static adresses but dhcp will do it if you wish.
If you prefer dhcp just replace static by dhcp (2 times) and remove all the lines
containing adresses

All the configuration is done in /etc/network/interfaces only ( no wpa- things )

Here is my /etc/network/interfaces :

Code: Select all

auto lo
iface lo inet loopback

iface eth0 inet static
address 192.168.1.11
netmask 255.255.255.0
gateway 192.168.1.1
network 192.168.1.0

auto wlan0
iface wlan0 inet static
address 192.168.1.111
netmask 255.255.255.0
gateway 192.168.1.1
network 192.168.1.0

wpa-ssid <name of your access point without quotes>
wpa-psk <the wifi password without quotes>
Run the test :
- Reboot the machine and execute ifconfig to check the IPs. As Eth0 is NOT auto you will not see any address, and the system will use the wifi one.
- Try to plug and unplug the cable and do various ping ...
This worked perfectly for me.
Guy
I would like to know what does "auto wlan0" mean? Why auto?


I have this with the command "sudo nano /etc/network/interfaces"
What shoud I do with this line?"allow-hotplug wlan0"

Code: Select all

auto lo
# interfaces(5) file used by ifup(8) and ifdown(8)

iface eth0 inet dhcp


iface lo inet loopback

allow-hotplug wlan0
iface wlan0 inet dhcp

wpa-ssid navigare
wpa-psk bdilaely258


iface default inet dhcp



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

Re: Network Problems with Ethernet and WiFi Both Configured

Mon Apr 13, 2015 3:06 pm

Have you got rid of ifplugd, that insane piece of software messes with your interfaces so that the WLAN0 will go down when the ETH0 comes up.

Re-configure it using sudo apt-get purge ifpludg && sudo killall ifplugd
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.

Return to “Networking and servers”