Bipra
Posts: 3
Joined: Fri Mar 29, 2019 2:23 pm

Raspberry pi3 cannot connect to wifi if connected to VLAN

Fri May 03, 2019 1:11 pm

Hello All,

I am having a problem of connecting to the internet from Raspberry pi 3. My raspberry pi is connected to a VLAN that does not have access to the internet. The Pi is also connected to the wi-fi but when we add the VLAN connection to the Pi it seems the pi automatically switches to the VLAN and it looses the connection to the internet via wifi. Is there any way that I can make bothe the connections work at the same time as I need internet connection to store data from the PI to a cloud database at the same time I need the VLAN to stay connected to the PI.

Thanks
Bipra

epoch1970
Posts: 5203
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Raspberry pi3 cannot connect to wifi if connected to VLAN

Fri May 03, 2019 2:54 pm

Look at the output of “route” when both are connected,
You should see wlan0 with routes of “metric” value 303 (300-ish) and those on eth0.vlan with metric values in the 200, perhaps even priority 0.
Identical routes are differentiated by metric, lowest number wins. 2 default routes is a clear case of identical routes.

To solve your issue, you want to have a lower metric (higher priority) on the routes you wish the system use, i.e. those via wlan0.
In dhcpcd.conf, you can do that by adding, e.g. “metric 0” right under the line “interface wlan0”
That would give max priority to routes passing via wlan0, so these routes would be preferred by the system.
Alternatively you can specify a high metric value to demote other interfaces, e.g. “metric 500” for eth0.vlan

If you’re not using dhcpcd, the syntax will vary but the principle should stay the same.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Return to “Troubleshooting”