How to handle metric when editing /etc/config/network ?

MistaRoboto

New Member
Joined
May 30, 2023
Messages
5
Reaction score
0
Credits
53
Previously I have used Linux devices only with GUI - now slowly switching to nonGUI. More specifically: I am editing files in the etc/config and then restarting the demons to commit. In order to find out how, I change things in the GUI, then compare the content of the etc folder to see / note the changes.

I have run in to a question concerning "network"

If I change the LAN or WAN from DHCP to static a metric is assigned automatically, if I do it in the GUI.
How ever if I want to change these settings "manually" as in editing the etc/config files myself, how do I decide which metric settings are right?

Rephrasing: How does a GUI decide the metric automatically? / How do I figure out the correct metric manually?


Thank you!
 


how do I decide which metric settings are right?
NIC Metric determines which NIC is preferred to use for network activity related to routing table.

A NIC with lower metric is preferred over NIC with higher metric.

Rephrasing: How does a GUI decide the metric automatically? / How do I figure out the correct metric manually?
That's entirely depends on the program in question, the program, a GUI, will determine a metric based on link speed.
If your 1st NIC is ethernet and 2nd nic is wireless then very likely ethernet will be assigned lower metric due to faster link speed,
how much lower depends on the difference between link speeds between NIC's.

If you want to figure it out manually do the math with some correlation formula or simply assign lower metric to NIC with higher link speed.
It's doesn't really matter, if you have 2 NIC's just assign lower metric to faster NIC.
 
Wow that was quick!
And easy to understand! Thanks!

I will only use LAN and WAN, so I guess there are not as many possibilities considering for my use cases LAN is mostly static and WAN mostly static and sometimes dhcp.

As I understand it, dhcp handles metric automatically, and it is only static ones that need this information.
Please correct me if I am wrong...

As LAN and WAN are both on-board NICs I guess none of them are really faster than the other.
 
I have another idea:

Instead of using the "etc/config/network" file, I could also use SSH and ifconfig - my guess would be that this also takes care of metric automatically, so I don´t have to deal with it...
 
As I understand it, dhcp handles metric automatically, and it is only static ones that need this information.
Please correct me if I am wrong...
I'm not sure if DHCP determines NIC metric, NIC metric is assigned by system depending on link speed and routing table.
DHCP will provide network manager an IP, DNS, Bcast address etc. and this will be inserted into routing table by system which will then assign metric depending on NIC link speed which is unrelated to DHCP.

In other words, if you use DHCP, NIC metric is assigned automatically by your system (ex. Linux or it's network daemon) not by DHCP.

If however you statically assign an IP then then the info that DHCP would give you is handled by you instead, NIC metric is still handled by system unless you manually assign it.

As LAN and WAN are both on-board NICs I guess none of them are really faster than the other.
Not true, you need to check which is faster, it's possible both are same and then you need to choose which is preferred by assigning a metric.

See how to check below:
 

Staff online

Members online


Latest posts

Top