1

I am having problems using Wi-Fi to access the internet on my Raspberry Pi when I connect the Pi to my laptop over ethernet.

Wi-Fi works fine and I can access the internet on the Pi when there are no other connections.

I am trying to SSH or VNC into the Pi which is causing the problems. As soon as I connect to the Pi using Ethernet direct to my laptop the internet stops working.

I can VNC or SSH into the Pi over Wi-Fi and the internet works fine via this method.

The pi has the latest Raspbian Stretch Image (2018-06-27). It has also been updated. The only other thing I have done is add a static IP address in /etc/dhcpcd.conf

Does anyone have any ideas or could point me in the right direction. I have found a few threads but they all seem to lead to a dead end.

Greenonline
  • 2,740
  • 4
  • 23
  • 36
CBert
  • 13
  • 4
  • I do not believe you can connect via Ethernet without a crossover cable.Can somebody smarter verify that? – Jan Hus Aug 10 '18 at 03:23
  • 2
    most modern (less than 10 years old) ethernet ports auto-detect such things – Jaromanda X Aug 10 '18 at 05:48
  • What you want is to Prioritize routes to go over wifi rather than over ethernet - https://www.raspberrypi.org/forums/viewtopic.php?t=189582 – Jaromanda X Aug 10 '18 at 05:52
  • It is unclear for me what you try. If you only plug in the ethernet cable from your laptop into the RasPi and then connect to the RasPi via WiFi with ssh from another device can you then connect to the internet in the ssh console? Or do you try to get into the internet with your laptop via ethernet cable to the RasPi? Please address me with @Ingo. – Ingo Aug 10 '18 at 08:58
  • Without detail no one can provide an answer! See How to set up networking/WiFi and post details of your network and settings if this does not help. – Milliways Aug 10 '18 at 14:11
  • @JaromandaX Thank You! That is exactly what I needed to do. I have added the metric parameter to prioritize WiFi.

    Now my Pi can access the internet using WiFi when connected to my laptop via Ethernet.

    – CBert Aug 10 '18 at 23:54

2 Answers2

1

As per the answer on raspberrypi forum

You could also try the metric parameter. Lowest metric has priority. In /etc/dhcpcd.conf add

interface eth0
metric 300

interface wlan0
metric 200

note: if you use predictable network interface names, the interface names may be something like

enx010203040506

and

wlx010203040506

instead of eth0 and wlan0 respectively (where 010203040506 dpends on the MAC address of the interface) - or a combination! For instance, my Rpi3B uses enx... and wlan0 but by Rpi1B uses enx... and wlx... - and I'm not sure why!

edit: found the reason ... the built in wifi for pi3 and 0W are not "usb devices" therefore are not modified - whereas an external wifi, and the onboard ethernet port on Pi1,pi2 are usb devices

Jaromanda X
  • 2,415
  • 1
  • 13
  • 14
  • Awesome! Thank you for the explanation as to why this occurs on the Pi3. Really helpful. – CBert Aug 11 '18 at 02:23
0

Thank You to JaromandaX for providing the link below that solved the issue. https://www.raspberrypi.org/forums/viewtopic.php?t=189582

The following code prioritized the WiFi to allow the RPi to access the internet (over WiFI) whilst also connected to a laptop via Ethernet.

interface eth0
metric 300
interface wlan0
metric 200
CBert
  • 13
  • 4