3

I'm using Ethernet to connect the pi to remote desktop and Wi-Fi to connect the pi to Internet but raspian is always trying to connect to Internet through Ethernet. I've tried to edit the IP routing table and delete the Ethernet from the table,It works, but each time I reboot the pi, I'll need to do it again because it gets back to Ethernet having the high priority.

Deleting Ethernet entry from IP routing table

My question is: Is there any permanent solution to this problem?

  • Are you using DHCP to build your interfaces, or have you assigned to them statically? – stevieb Apr 2 '17 at 22:56
  • I'm using static IP for Ethernet and DHCP for Wi-Fi – Alaa Apr 3 '17 at 6:58
2

I've just had exactly the same problem.

The trick is to set the ethernet interface metric to a lower priority (which means a higher metric value) in the /etc/dhcpcd.conf file.

Contrary to my initial expectations - this file is used to configure the statically assigned ethernet interface, despite it not using dhcp for its config. It contains the sort of settings you'd find in /etc/network/interfaces in older versions.

interface <ethernet-interface-name>
metric 350
static ip_address=192.168.1.1
static routers=
...

Make sure this metric value is higher than the metric for your wlan0 when you use route to view your route configuration, and you'll find your internet is now routed via wlan0.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.