Hi Cube

Maximum route metric on Linux

Ever wondered what is the maximum route metric value you can configure on Linux? man interface and man ip state that route metric is a number, but don’t specify its range.

# ip route add 192.168.113.0/24 via 10.0.10.1 metric 0
# ip route add 192.168.113.0/24 via 10.0.10.1 metric 4294967295
# ip route add 192.168.113.0/24 via 10.0.10.1 metric 4294967296
Error: argument "4294967296" is wrong: "metric" value is invalid

# ip route
192.168.113.0/24 via 10.0.10.1 dev eth0
192.168.113.0/24 via 10.0.10.1 dev eth0  metric 4294967295

It looks like Linux route metric is an unsigned 32-bit integer, ranging from 0 to 4294967295. As you already know a route with the lowest metric is preferred.

Post navigation

Leave a Reply