Page 1 of 1

Setting internet connectivity priority to WiFi

Posted: Fri Apr 06, 2018 12:37 pm
by Abdelrhman
Hello,
I am using raspberry pi 3 model b with Raspian , i connect the pi to a router and give it a static IP to easily access it using VNC but at the router doesn't have an internet connection so i need to connect to my WiFi and it connects to it but there is no internet connection.
I figured that the pi even it is connected to the WiFi but it uses the Ethernet connectivity.
So how i could change the priority to WiFi connectivity without damaging my Ethernet connection to easily access the pi using VNC .

Re: Setting internet connectivity priority to WiFi

Posted: Fri Apr 06, 2018 1:06 pm
by SurferTim
If you are assigning the static network settings in /etc/dhcpcd.conf, use the metric parameter to set priority. The lowest metric has priority. The ethernet interface has a metric of 202 by default, so:

Code: Select all

interface wlan0
metric 200

Re: Setting internet connectivity priority to WiFi

Posted: Fri Apr 06, 2018 1:44 pm
by Abdelrhman
Thank you so much i will try tonight.

Re: Setting internet connectivity priority to WiFi

Posted: Fri Apr 06, 2018 1:50 pm
by SurferTim
To ensure it worked, run this from a command line:

Code: Select all

route
It will display the metric for each interface.

Re: Setting internet connectivity priority to WiFi

Posted: Mon Sep 30, 2019 6:36 pm
by Avedis Tchamitchian
modifying the /etc/dhcpcd.conf and seting wlan0 to lowest metric number works after reboot.
but when rebooting again it fails which means i need to redit my /etc/dhcpcd.conf.

is there a way to have the metric priority for wlan0 forever ? i mean without editing the /etc/dhcpcd.conf every time ?