Page 1 of 1

How to make Metric

Posted: 2019/12/20 09:17:00
by zemzema
Hello,

for couple of days I trying to make metric command work in route-eth0 but without any success.

I disabled NetworkManager, and configured everything manually.

Configuration for ifcfg-eth0 is:

TYPE=Ethernet
BOOTPROTO=static
IPV6INIT=no
NAME=eth0
UUID=5faa96ff-6037-4733-9952-35f7beee2e34
DEVICE=eth0
ONBOOT=yes
IPADDR=10.10.2.211
PREFIX=24
GATEWAY=10.10.2.1
DNS=8.8.8.8
NM_CONTROLLED=no
USERCTL=no


Configuration in route-eth0 is:
METRIC0=800
ADDRESS0=10.168.10.5
NETMASK0=255.255.255.255
GATEWAY0=10.10.2.1


RESULT:
------------------------------------------------------
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.10.2.1 0.0.0.0 UG 0 0 0 eth0
10.10.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.168.10.5 10.10.2.1 255.255.255.255 UGH 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0


Some help please!

Re: How to make Metric

Posted: 2019/12/20 09:59:57
by TrevorH
I suspect that the reason it doesn't work is because there is no METRICn= documented in /usr/share/doc/initscripts-9.49.47/sysconfig.txt. There is only METRIC= and it says it applies to the default route.

Also, what are you trying to do? The route you're adding is also pointing to the default route that exists so I don't think it serves any purpose.

Re: How to make Metric

Posted: 2019/12/20 11:14:27
by zemzema
This was just example, to check on simple setup to test METRIC.

Re: How to make Metric

Posted: 2019/12/21 07:25:37
by aks
Routing metrics only apply to routes - not interfaces. As Trevor said, metrics applied to an interface applies only to the default route.

What are you trying to do? If you want to load balance or favour some interface over another, then you should be looking at bonding.