Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
set netifrc metrics
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Frautoincnam
Guru
Guru


Joined: 19 May 2017
Posts: 331

PostPosted: Sun Jan 19, 2025 8:23 pm    Post subject: set netifrc metrics Reply with quote

Hi all,

On a computer with ethernet interface eth0 and wifi interface wlan0, and dhcpcd launched at boot, if I configure netifrc with /etc/conf.d/net:
Code:
modules_wlan0="wpa_supplicant"
metric_eth0="200"
metric_wlan0="100"

the metrics are not taken into account (1002 for eth0 and 3005 for wlan0).
For them to be taken into account, I have to add to /etc/dhcpcd.conf:
Code:
interface eth0
    metric 200
interface wlan0
    metric 100


Why and above all, how to configure these metrics in /etc/conf.d/net?

Important: everything works fine apart from that. The 2 interfaces are perfectly functional. There is NO problem to solve elsewhere. So I do not want to change anything in my configuration except to set these metrics.

EDIT:
I think I found it, just after posting (as usual). It seems that I just need to remove dhcpcd from boot for the netifrc config to be fully taken into account.
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3948

PostPosted: Sun Jan 19, 2025 8:58 pm    Post subject: Reply with quote

You cant!
Unless you try something you probably shouldnt.
In dhcpcd.conf try
Code:


.....
source /etc/conf.d/net
interface eth0
    metric  $metric_eth0
interface wlan0
    metric $metric_wlan0
.....

This will probably have undefined behavior and maybe crash your daemon.
I feel you are getting too worried about such a trivial thing.Either dont use dhcpcd and configure static IPs via netifrc or use it and let it handle metric assignment.
_________________
:)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum