Posts: 1
Joined: Thu Jun 14, 2018 2:43 pm

Force Internet traffic through wlan0

Thu Jun 14, 2018 2:51 pm


I currently have a setup where my rpi 3b (raspbian jessie), is connected to two routers, using eth0 and wlan0. I want to using eth0 only to communicate with another device in tha LAN. And i want to use wlan0 for WAN traffic via the router.

How can i ensure that only the network on wlan0 is used for internet traffic? this must require some action? I want to use the network on eth0 only for communicating with a device in the same LAN.

RPI eth0 -> router A -> Device in LAN. (RPI assigned dynamic IP in range 10.x.x.x)
RPI wlan0 -> router B -> any WAN traffic. (RPI assigned a static IP via router settings)

I do not have admin access to router A. Also, the static ip address on wlan0 is set up on the router by MAC binding, menaing i did not change any network configurations on the pi.

i have tried using the ip route command which does momentarily work, however, all settigns go back as they were after a reboot or if the etherenet cable is uplugged and plugged back in.

What else can i do to achieve this? I need to do this on a rpi 3b runnign jessie and on a rpi 3b+ running stretch. Any help would be appreciated.

User avatar
Posts: 1197
Joined: Thu Feb 14, 2013 2:22 am
Location: Jávea, Spain

Re: Force Internet traffic through wlan0

Thu Jun 14, 2018 5:27 pm

Try assigning metrics to interfaces wlan0 and eth0. A lower metric means a higher priority.

Yo have to edit the file /etc/dhcpcd.conf

Code: Select all

sudo nano /etc/dhcpcd.conf

and the add these four lines:

Code: Select all

interface wlan0
metric 10
interface eth0
metric 50
Check the metrics after reboot:

Code: Select all

ip route

Return to “Advanced users”

Who is online

Users browsing this forum: Google [Bot], Neil_G and 10 guests