Abdelrhman
Posts: 15
Joined: Sun Jan 14, 2018 2:57 pm

Setting internet connectivity priority to WiFi

Fri Apr 06, 2018 12:37 pm

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 .

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Setting internet connectivity priority to WiFi

Fri Apr 06, 2018 1:06 pm

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

Abdelrhman
Posts: 15
Joined: Sun Jan 14, 2018 2:57 pm

Re: Setting internet connectivity priority to WiFi

Fri Apr 06, 2018 1:44 pm

Thank you so much i will try tonight.

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Setting internet connectivity priority to WiFi

Fri Apr 06, 2018 1:50 pm

To ensure it worked, run this from a command line:

Code: Select all

route
It will display the metric for each interface.

Avedis Tchamitchian
Posts: 1
Joined: Mon Sep 30, 2019 6:32 pm

Re: Setting internet connectivity priority to WiFi

Mon Sep 30, 2019 6:36 pm

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 ?

Return to “Networking and servers”