2

So, I have a raspberry pi 3, and it is set up with WiFi and Ethernet (with no internet access, a cheap switch).

Both has assigned static ip addresses assigned, and Ethernet is used for ssh and vnc only. But the problem is, it will not access internet from the raspberry pi, as I suspect it is trying to use Ethernet.

I am wondering how can I route all my web access via WiFi? but still keep the Ethernet access available?

  • 1
    As you have not provided any detail of HOW you have configured networking no one can say. You might try Metric in route. – Milliways Nov 6 '16 at 1:25
  • Hello Milliways, I assigned static ips through sudo dhcpcd.conf, sorry I am new to networking. – Recursive Nov 6 '16 at 3:23
  • You have still not provided any detail. It is a loss to me why people bother asking questions, but then fail to provide detail of what they have done. What changes did you do? – Milliways Nov 6 '16 at 5:38
  • For anyone else chasing similar issues, there's good info here: raspberrypi.org/forums/viewtopic.php?t=213957 which also references knight-of-pi.org/… – Dave F Apr 7 at 7:04
3

Besides assigning IP addresses you need to check routing (or forwarding); yes, even if you are just running a host without forwarding traffic between networks, the routing table is involved in finding the proper next hop -- and thus network interface -- to take towards a particular destination address.

Since you have not given details about your specific setup with respect to not only IP addresses, but also netmasks, and the default route(s), it's not really possible at this stage to diagnose your problem.

You can show the routes that your host uses using the ip -4 route show command. I suspect that you may have either have more than a single default route, or may have assigned the same subnet to both Wifi and Ethernet interfaces (with consequences you don't want, see below).

An (IP) subnet is formed by doing a binary AND of an IP address and the associated netmask. For instance, 192.168.0.1 AND 255.255.255.0 gives 192.168.0.0 as the subnet.

While there are perfectly valid cases where the same IP subnet gets assigned to more than a single interface, I doubt this is what you want to do in your case. In this case the Ethernet interface gets a better so-called metric, because it's deemed "better". In consequence, all your outgoing traffic to the same subnet takes the black-hole Ethernet interface from which it will never reach your Internet router, which is reachable trough the WiFi interface instead.

You'll need to assign a separate IP subnet to the devices that are connected to your Ethernet switch. If your main subnet is 192.168.0.0, then you make use 192.168.1.0 (same netmask 255.255.255.0).

If you in fact assigned the same subnet to both interfaces, ip -4 route show should give you two routes to 192.168.0.0/255.255.255.0 (assuming my example), but one going through WiFi, while the other one goes to Ethernet.

2

For those who is interested in the future, I got it to work by lowering the metric in dhcpcd.conf for the wireless setup.

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.