notholmen
Posts: 31
Joined: Tue Dec 25, 2012 10:10 am

Re: WiFi ONLY works if Ethernet is plugged in

Sat Apr 02, 2016 7:36 am

ShiftPlusOne wrote:
rpi2user19 wrote:If anyone has succeeded in getting WiFi to work without plugging in Ethernet, I would appreciate a more precise explanation.
With the default setup, I either connect using the wifi applet on the desktop or put the appropriate network block in /etc/wpa_supplicant/wpa_supplicant.conf myself and it just works, with or without the ethernet cable being plugged in.
That's probably a great way of working if you are using the graphical interface...
I and I believe many with me are only using RPI's headless and will only interact with them through SSH so unfortunately, your suggestion won't work for us, right?

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6234
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: WiFi ONLY works if Ethernet is plugged in

Sat Apr 02, 2016 10:38 am

notholmen wrote:
ShiftPlusOne wrote:
rpi2user19 wrote:If anyone has succeeded in getting WiFi to work without plugging in Ethernet, I would appreciate a more precise explanation.
With the default setup, I either connect using the wifi applet on the desktop or put the appropriate network block in /etc/wpa_supplicant/wpa_supplicant.conf myself and it just works, with or without the ethernet cable being plugged in.
That's probably a great way of working if you are using the graphical interface...
I and I believe many with me are only using RPI's headless and will only interact with them through SSH so unfortunately, your suggestion won't work for us, right?
No, the applet was only one option. Editing wpa_supplocant.conf yourself is the other.

MayerPI
Posts: 1
Joined: Mon Apr 04, 2016 2:28 pm

Re: WiFi ONLY works if Ethernet is plugged in

Mon Apr 04, 2016 7:19 pm

I just got a Pi 3 and I'm having this same issue with the built in wlan0 interface. I found this thread and got inspired to figure this out. After a lot of troubleshooting this is what I've discovered about my setup.

Best I can tell, for me it's a layer2 ARP issue. I don't know exactly why it's happening the way it is but I at least know what is happening and I have a work around.

Here is my setup. Both eth0 and wlan0 are dhcp at this point. Both are getting addrs in the same 192.168.2.0/24 network.

eth0 = 192.168.2.80, mac = b8:27:eb:7e:73:9c
wlan0 = 192.168.2.73, mac = b8:27:eb:2b:26:c9

When the eth0 interface is plugged in and has an IP, I see on my macbook that the IP for wlan0 is assigned to the eth0 mac addr. This means that all traffic destined to wlan0 IP 192.168.2.73 will get switched to my eth0 mac addr. Therefore I'm not going directly to wlan0 through my wifi network but rather through the wired interface eth0.

Code: Select all

$ arp -a
? (192.168.2.73) at b8:27:eb:7e:73:9c on en0 [ethernet]
retropie (192.168.2.80) at b8:27:eb:7e:73:9c on en0 [ethernet]
I can confirm that all traffic destined to my wlan0 IP 192.168.2.73 is indeed going through eth0 on my pi. I ping 192.168.2.73 from my macbook and do a sudo tcpdump -i eth0 on my pi and I can see the ping packets going through eth0 to get to wlan0, because of the ARP entry. Notice how low the latency is on these pings. Obviously through the wired network.

Code: Select all

$ ping 192.168.2.73
PING 192.168.2.73 (192.168.2.73): 56 data bytes
64 bytes from 192.168.2.73: icmp_seq=0 ttl=64 time=2.929 ms
64 bytes from 192.168.2.73: icmp_seq=1 ttl=64 time=1.388 ms

pi@retropie:~ $ sudo tcpdump -i eth0 icmp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
17:28:28.581941 IP 192.168.2.63 > 192.168.2.73: ICMP echo request, id 47468, seq 0, length 64
17:28:28.582009 IP 192.168.2.73 > 192.168.2.63: ICMP echo reply, id 47468, seq 0, length 64
17:28:29.585164 IP 192.168.2.63 > 192.168.2.73: ICMP echo request, id 47468, seq 1, length 64
17:28:29.585243 IP 192.168.2.73 > 192.168.2.63: ICMP echo reply, id 47468, seq 1, length 64
Now, when the issue is happening I unplug the cable from eth0. I can check the arp table on my macbook and guess what? My wlan0 mac addr now has an incomplete mac addr entry. The network doesn't know how to route/switch to this IP.

Code: Select all

$ arp -a
? (192.168.2.73) at (incomplete) on en0 [ethernet]
retropie (192.168.2.80) at b8:27:eb:7e:73:9c on en0 [ethernet]

$ ping 192.168.2.73
PING 192.168.2.73 (192.168.2.73): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
At this point I at least have the issue identified, for me at least.

I then went in and added a static arp entry for my wlan interface. WOOT it works with eth0 down.

Code: Select all

$ sudo arp -s 192.168.2.73 b8:27:eb:2b:26:c9

$ ping 192.168.2.73
PING 192.168.2.73 (192.168.2.73): 56 data bytes
Request timeout for icmp_seq 0
64 bytes from 192.168.2.73: icmp_seq=0 ttl=64 time=1374.568 ms
64 bytes from 192.168.2.73: icmp_seq=1 ttl=64 time=373.899 ms
64 bytes from 192.168.2.73: icmp_seq=2 ttl=64 time=1695.843 ms
64 bytes from 192.168.2.73: icmp_seq=3 ttl=64 time=694.741 ms
Suddenly I can ping again. Notice the latency. Clearly this is going through the wifi network, and is wicked slow too. But that's a different issue all together.

This work around doesn't address the root issue but it does give folks a work around. Hope this helps someone. Maybe someone will read this and jump on where I left off.

User avatar
patrikg
Posts: 168
Joined: Sun Mar 18, 2012 10:19 pm

Re: WiFi ONLY works if Ethernet is plugged in

Mon Apr 04, 2016 8:11 pm

You should work with metric parameter on your system to set the default network interface.

e-educ
Posts: 1
Joined: Fri Apr 08, 2016 9:45 am

Re: WiFi ONLY works if Ethernet is plugged in

Fri Apr 08, 2016 9:55 am

On raspberry pi 3.
It seems that it is ssh over PI3 Wifi onboard that is not able to forward IPv4 packets with ToS != 0.
Solution:
In /etc/ssh/sshd_config add that line:
IPQoS cs0 cs0

and restart ssh service
sudo service ssh restart

Did the trick for me.

Regards

AndyPhillips
Posts: 1
Joined: Fri Apr 15, 2016 3:27 pm

Re: WiFi ONLY works if Ethernet is plugged in

Fri Apr 15, 2016 3:44 pm

This has been driving me nuts for about a week (off and on!). This is what I have found and how I fixed this:
Connected to SSH and ran ip route
Came back with both interfaces showing the correct gateway but the eth0 interface had a lower metric than the wlan0 interface (eth0 = 202, wlan0 = 303). Maybe this was the problem? After some reasearch I added a new metric for eth0:
sudo route add -net default gw 192.168.2.1 netmask 0.0.0.0 dev eth0 metric 404
This is higher than the one currently listed for eth0 and most importantly, higher than the wlan0.I ran ip route again and three routes are listed.
I then ran this command twice to delete all but '404';
ip route del default via 192.168.1.1
Did ip route again and all that was left was the newly created eth0 metric of 404.
Shutdown, disconnect ethernet cable and boot......yep, that now works!
Now when I run ip route I just get the wlan0 metric! Rebooted a couple of times and all seems to be well. I won't be using an ethernet connection on this one again, so I couldn't tell you what would happen if you plugged one back in....

Hope this helps someone.

Andy.

glaurent
Posts: 2
Joined: Fri Apr 15, 2016 10:57 pm

Re: WiFi ONLY works if Ethernet is plugged in

Fri Apr 15, 2016 11:18 pm

In my case (brand new RPi 3, raspbian), it wasn't an sshd config problem, it was the arp problem solved here

viewtopic.php?p=945716#p945716

by MayerPI - congratulations and thank you.

The symptom is that the Pi won't even respond to ping if ethernet is unplugged.

I had to add the arp entry using the WiFi IP and the Eth address of the WiFi interface as obtained from the Pi's ifconfig. This is not fully satisfactory, but will have to do for now, I guess.

truthadjustr
Posts: 6
Joined: Sun Apr 24, 2016 9:15 am
Contact: Website

Re: WiFi ONLY works if Ethernet is plugged in

Sun Apr 24, 2016 9:34 am

I just want to share my own experience here. When I received my raspi3 with a default raspbian (jessie) OS, I connected the following:

- connect the HDMI cable to my LCD TV and my raspi3
- connect a mouse into the USB port
- connect a keyboard into the USB port

Finally, I connected a cellphone powerbank to the power micro-USB port in my raspi3. I am then led to a graphical GUI. Using the mouse, I click the WIFI icon discovery and selected my home's ESSID.

RESULT = I have WIFI connection. I disconnected the hdmi,mouse,keyboard and i'm working via ssh thereafter.

Then I noticed a slowness in my ssh terminal which is very frustrating. I already did the 'apt-get update' software update stuff. I relocated my raspi3 near to wifi but the problem is the same. When I ping to my raspi, the latency was extraordinarily high!

But then, it got solved by one-liner (iwconfig wlan0 power off) via here viewtopic.php?f=28&t=138312

mspisars
Posts: 2
Joined: Wed May 04, 2016 2:33 pm

Re: WiFi ONLY works if Ethernet is plugged in

Wed May 04, 2016 3:07 pm

For me, it was having ip=192.168.0.201 for my static IP in the cmdline.txt file.
Set the static ip in /etc/dhcpcd.conf for Jessie or /etc/network/interfaces for older versions.

No need to mess with the routing tables or anything else.

notholmen
Posts: 31
Joined: Tue Dec 25, 2012 10:10 am

Re: WiFi ONLY works if Ethernet is plugged in

Sat May 14, 2016 11:40 pm

Okay, So I need to try asking again since no suggestion either work or I'm just doing it very wrong.

Connection to the pi only works with the ethernet plugged in and I believe it's something with the routing.
Even tried addint another WiFi USB... didn't work.. :cry:
Please see my settings:

/etc/network/interfaces

Code: Select all

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet static
        address 192.168.10.66
        netmask 255.255.255.0
        network 192.168.10.0
        broadcast 192.168.10.255
        gateway 192.168.10.1



auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
        wpa-ssid "WiFi"
        wpa-psk "PASSWORD"
wireless-power off

auto wlan1
allow-hotplug wlan1
iface wlan1 inet dhcp
        wpa-ssid "WiFi"
        wpa-psk "PASSWORDi"
wireless-power off
command: routel

Code: Select all

~$ routel
         target            gateway          source    proto    scope    dev tbl
        default       192.168.10.1                                     eth0 
  192.168.10.0/ 24                   192.168.10.66   kernel     link   eth0 
  192.168.10.0/ 24                   192.168.10.82   kernel     link  wlan1 
  192.168.10.0/ 24                   192.168.10.11   kernel     link  wlan0 
      127.0.0.0          broadcast       127.0.0.1   kernel     link     lo local
     127.0.0.0/ 8            local       127.0.0.1   kernel     host     lo local
      127.0.0.1              local       127.0.0.1   kernel     host     lo local
127.255.255.255          broadcast       127.0.0.1   kernel     link     lo local
   192.168.10.0          broadcast   192.168.10.66   kernel     link   eth0 local
   192.168.10.0          broadcast   192.168.10.82   kernel     link  wlan1 local
   192.168.10.0          broadcast   192.168.10.11   kernel     link  wlan0 local
  192.168.10.11              local   192.168.10.11   kernel     host  wlan0 local
  192.168.10.66              local   192.168.10.66   kernel     host   eth0 local
  192.168.10.82              local   192.168.10.82   kernel     host  wlan1 local
 192.168.10.255          broadcast   192.168.10.66   kernel     link   eth0 local
 192.168.10.255          broadcast   192.168.10.82   kernel     link  wlan1 local
 192.168.10.255          broadcast   192.168.10.11   kernel     link  wlan0 local
            ::1              local                   kernel              lo 
        fe80::/ 64                                   kernel            eth0 
        fe80::/ 64                                   kernel           wlan1 
        fe80::/ 64                                   kernel           wlan0 
        default        unreachable                   kernel              lo unspec
            ::1              local                     none              lo local
fe80::20b:81ff:fe92:546a              local                     none              lo local
fe80::213:efff:fe80:2e04              local                     none              lo local
fe80::ba27:ebff:fee8:e79b              local                     none              lo local
        ff00::/ 8                                                      eth0 local
        ff00::/ 8                                                     wlan1 local
        ff00::/ 8                                                     wlan0 local
        default        unreachable                   kernel              lo unspec
Tried added this:
sudo route add default gw 192.168.1.1
But nothing.. :oops:
I really don't know what I'm doing wrong here.

I have an updated RaspberryPi2 with minibian on it (only terminal access)
Please let me know how I can fix this very anoyig issue...
My Pi is ready to be deployed with a 5000mah battery and UPS in an enclosure but it's really annoying to need a network cable when I don't need an electricity cable anymore! :)

Thanks for all help and suggestions!

moreincubus
Posts: 1
Joined: Thu May 26, 2016 10:16 am

Re: WiFi ONLY works if Ethernet is plugged in

Thu May 26, 2016 10:21 am

I also spent some time on this problem, using Minibian.
But I have it solved finally.
Simply change the order in /etc/networks/interfaces
wlan0 first then eth0:

Code: Select all

auto lo
iface lo inet loopback

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
wireless-power off

auto eth0
iface eth0 inet dhcp
Hope this helps.

d.woo
Posts: 1
Joined: Tue Jun 07, 2016 10:54 am

Re: WiFi ONLY works if Ethernet is plugged in

Tue Jun 07, 2016 10:57 am

moreincubus wrote:I also spent some time on this problem, using Minibian.
But I have it solved finally.
Simply change the order in /etc/networks/interfaces
wlan0 first then eth0:

Code: Select all

auto lo
iface lo inet loopback

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
wireless-power off

auto eth0
iface eth0 inet dhcp
Hope this helps.
This works for me with Pi 3

zob
Posts: 5
Joined: Sun Feb 15, 2015 5:23 pm

Re: WiFi ONLY works if Ethernet is plugged in

Thu Jun 23, 2016 7:27 pm

moreincubus wrote:I also spent some time on this problem, using Minibian.
But I have it solved finally.
Simply change the order in /etc/networks/interfaces
wlan0 first then eth0:

Code: Select all

auto lo
iface lo inet loopback

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
wireless-power off

auto eth0
iface eth0 inet dhcp
Hope this helps.
This worked for me also moreincubus, thanks a lot.
My setup is raspberry pi with moodeaudio http://moodeaudio.org/
And I had the issue with wifi only working when ethernet was connected.
(I wonder if swapping these now means that ethernet will only work with wifi connected, oh well...)

Hoagie
Posts: 119
Joined: Sun Sep 23, 2012 7:19 pm

Re: WiFi ONLY works if Ethernet is plugged in

Sat Oct 08, 2016 3:52 pm

Thanks.

Putting the wlan0 section before eth0 sorted this for me too.

UglyKidJoe
Posts: 3
Joined: Thu Aug 11, 2016 9:03 am

Re: WiFi ONLY works if Ethernet is plugged in

Mon Jan 16, 2017 8:13 pm

Hi all,

I'm really struggling with this issue. Is there any confirmed solution?

My setup looks like this...

/etc/network/interfaces:

Code: Select all

# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
IP route

Code: Select all

[21:03:39] pi@openHABianPi:~$ ip route
default via 192.168.178.1 dev eth0
192.168.178.0/24 dev eth0  proto kernel  scope link  src 192.168.178.21
192.168.178.0/24 dev wlan0  proto kernel  scope link  src 192.168.178.147
[21:03:45] pi@openHABianPi:~$
/etc/wpa_supplicant/wpa_supplicant.conf:

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
  ssid="Wifi ARMINDO"
  psk="48325186269424865444"
}
I've been searching forums solidly for a week but I can't get it fixed. The moment I unplug my ethernet cable from my Pi 3 the SSH session freezes. I also can't connect via a web browser unless the ethernet is plugged in (trying to see port 8080 which is my Openhab setup)

When I ping both eht0 and wlan0 they both reply when ethernet is plugged in. Unplug it and the request times out

I've not got much experience in networking, so any advice would be much appreciated.

Thanks in advance

Cuppieinc
Posts: 1
Joined: Thu Feb 16, 2017 7:29 pm

Re: WiFi ONLY works if Ethernet is plugged in

Thu Feb 16, 2017 7:38 pm

I had the same problem. After testing several configurations in my interfaces config the following worked for me :
Both wlan0 and eth0 are setup static. For wlan0 I added the allow-hotplug and removed the auto. For eth0 I removed both allow-hotplug and auto (see config below). Now wireless is active after reboot without eth0 patched.

allow-hotplug wlan0
iface wlan0 inet static
address x.x.x.x
netmask x.x.x.x
gateway x.x.x.x
dns-nameservers x.x.x.x
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

iface eth0 inet static
address y.y.y.y
netmask y.y.y.y
gateway y.y.y.y
dns-nameservers y.y.y.y

Ernst
Posts: 1337
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: WiFi ONLY works if Ethernet is plugged in

Thu Feb 16, 2017 10:18 pm

UglyKidJoe wrote:Hi all,
I'm really struggling with this issue. Is there any confirmed solution?
The solution is very simple: do not use WiFi and Ethernet within the same subnet.

I suggest that you try the following: disconnect all sessions, remove ethernet cable, wait a minute or so and try to connect to the pi with ssh. If it does not work try a reboot without the ethernet cable.

The cause is very simple, when there are multiple interface with an address in the same subnet with the same gateway address the interface with the lowest metric will be used for outgoing traffic.

What this means is that if you connect with ssh to the ip-address on wlan0 (high metric) your data will be received on that interface but the reply will be transmitted on eth0 (low metric). When you pull the ethernet cable the interface is configured down and this will interrupt the traffic flow and may very well cause a problem with the encrypted traffic needing to change interface.

Good practice is to have each interface on a different subnet or, if multiple interfaces in the same subnet, to use only one interface at a time and disable the other interfaces.
The road to insanity is paved with static ip addresses

andrewtroup
Posts: 2
Joined: Thu Mar 09, 2017 2:49 am

Re: WiFi ONLY works if Ethernet is plugged in

Wed Mar 22, 2017 12:51 am

***EDIT*** After further testing, simply moving eth0 below wlan0 is the better solution.

auto lo
iface lo inet loopback

allow-hotplug wlan0
auto wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

auto eth0
iface eth0 inet dhcp

---
Hi All,
I fought this for awhile, but then got it working!

Based-on the previous post, I decided to disable eth0. It's preferable to move the eth0 configuration below wlan0 if that works for you. I simply commented out the eth0 entries, so it now looks like below. Obviously make sure your wlan0 configuration is perfect before doing this. If my wlan ever breaks, I'll just plug the pi into a monitor and fix it.

auto lo
iface lo inet loopback

#auto eth0
#iface eth0 inet dhcp


allow-hotplug wlan0
auto wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Everything is working now, even after several reboots.

Andrew

dugdod
Posts: 1
Joined: Tue Dec 17, 2013 3:27 am

Re: WiFi ONLY works if Ethernet is plugged in

Mon May 15, 2017 12:31 am

SUCCESS FINALLY!
I have a headless RPi2 B
  • Running latest Raspbian GNU/Linux 8 (jessie)
    WiFi dongle: Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
My situation was similar: I could not get wifi access unless I 1st booted with the ethernet cable plugged in. After booting, I could unplug the ethernet and I could still access it wirelessly. I need it to boot wirelessly for my situation (remote camera). As suggested, I moved the eth0 stanza below the wlan0 stanza, but I could still not boot wirelessly:

$ ip route always returned this:

default via 10.0.0.1 dev eth0
10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.220
10.0.0.0/24 dev wlan0 proto kernel scope link src 10.0.0.221

Success (for my situation)
I tried everything in various posts to no avail. I struggled with this issue for hours, and I had no luck until I disabled eth0 altogether (as Andrew suggests)

Now it boots with no ethernet plugged in and ssh, samba, etc now works great wirelessly. :D
$ ip route returns this:
default via 10.0.0.58 dev wlan0
default via 10.0.0.1 dev wlan0 metric 303
10.0.0.0/24 dev wlan0 proto kernel scope link src 10.0.0.221
10.0.0.0/24 dev wlan0 proto kernel scope link src 10.0.0.221 metric 303

My successful /etc/interfaces:
auto lo
iface lo inet loopback

allow-hotplug wlan0

iface wlan0 inet static
address 10.0.0.221/24
gateway 10.0.0.58
network 10.0.0.0
broadcast 10.0.0.255
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

iface default inet dhcp


I wish there was a way to force WiFi to be the default (with ethernet still a possibility) but I could not find it.
I HTH someone; this was a painful journey of fruitless, frustrating attempts until I did this.

MrEngman
Posts: 4051
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: WiFi ONLY works if Ethernet is plugged in

Mon May 15, 2017 3:31 am

Not surprised you've had problems with the way you've done your set up.

With Jessie DO NOT edit file /etc/network/interfaces. To set a static IP edit file /etc/dhcpcd.conf as per https://www.modmypi.com/blog/how-to-giv ... ess-update and edit file /etc/wpa_supplicant/wpa_supplicant.conf to configure the wifi network to connect to.

As an example my Pi 2 can connect using a static IP on the wifi with file set as follows:

File /etc/network/interfaces, the default and not edited, and read the first few lines of the file although they were not included in the very earliest Jessie images -

Code: Select all

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

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug ra0
iface ra0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
File /etc/dchpcd.conf with the wifi static address set up at the end of it.

Code: Select all

# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU.
# Some interface drivers reset when changing the MTU so disabled by default.
#option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private

# A hook script is provided to lookup the hostname if not set by the DHCP
# server, but it should not be run by default.
nohook lookup-hostname

interface wlan0

 static ip_address=192.168.16.100/24
 static routers=192.168.16.2
 static domain_name_servers=192.168.16.2
And file /etc/wpa_supplicant/wpa_supplicant.conf

Code: Select all

country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="network-name"
        psk="network-password"
}
And this set up works with the ethernet cable connected or not.

However, I do not usually set my Pis to use static IPs as my router always retains the same addresses for each Pi when using DHCP. But just tried this to see how it would behave and it connected with this new IP, now set as static, immediately with no problems.


MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

giupo
Posts: 1
Joined: Wed Jun 28, 2017 10:00 am

Re: WiFi ONLY works if Ethernet is plugged in

Wed Jun 28, 2017 10:03 am

If anyone still has this issue, try to remove the "ip" definition in the "/boot/cmdline.txt"

Just my 2 cents,
Giuseppe

duanem
Posts: 2
Joined: Mon Nov 27, 2017 5:43 am

Re: WiFi ONLY works if Ethernet is plugged in

Fri Dec 01, 2017 3:21 am

I really want the suggestion from ernst that the problem is related to both interfaces being on the same interface to be correct. But that suggestion is demonstrably incorrect.

I turned on the RaspberryPi with no Ethernet plugged (after several days). The Wifi is up (as shown by my dhcp server). However, I cannot connect to the SSH interface.

Once I plug in the Ethernet interface, the wifi interface responds.

Still digging for the proper solution.

djfourmoney
Posts: 1
Joined: Wed Dec 06, 2017 6:56 pm

Re: WiFi ONLY works if Ethernet is plugged in

Wed Dec 06, 2017 7:02 pm

My problem and it seems since day one (I got my Pi last week, Cyber Monday) my Pi connects to both Ethernet and WiFi but pull the Ethernet cable from it and I lose both.

WiFi connects to the router/gateway but sends no data over it.

WiFi is on .12 and Ethernet is on .11 of the IP's from the router.

Now I have to re-flash the OS because I thought using a GUI would solve this problem that I had in command line (headless). But ticking the disconnect Ethernet box put me in a state where I can't connect to the Pi at all.

Thoughts?

Glasairman
Posts: 12
Joined: Fri Mar 16, 2012 9:55 am
Location: Munich, Germany

Re: WiFi ONLY works if Ethernet is plugged in

Tue Dec 19, 2017 9:06 pm

I had the same problem after converting to systemd-networkd
I traced it to a line in /etc/dhcpcd.conf

denyinterfaces wlan0

I changed it to #denyinterfaces wlan0
and the problem disappeared

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: WiFi ONLY works if Ethernet is plugged in

Tue Dec 19, 2017 9:49 pm

Glasairman wrote:
Tue Dec 19, 2017 9:06 pm
I had the same problem after converting to systemd-networkd
I traced it to a line in /etc/dhcpcd.conf

denyinterfaces wlan0

I changed it to #denyinterfaces wlan0
and the problem disappeared
You would only use the denyinterfaces when using a bridge, because the bridge gets the network settings, not wlan0 or eth0.

Return to “Troubleshooting”