You are not logged in.

#1 2022-03-10 18:27:54

dawnofman
Member
Registered: 2019-07-26
Posts: 140

[solved]"ip address add" without adding the default (metric=0) route ?

When I use the ip address command; eg:

ip address add local 192.168.77.10/29 dev eno1

a default route with metric=0 (for the directly connected interface) is automatically added to the route table and shown with ip route show.

I've been reading the man page for ip address and I cannot figure out how to prevent it to manually created it afterwards.

Use case ?

I want to place a specific route for a specific computer before it (overriding the default route):

eg: metric=1 192.168.77.12 via 192.168.78.11 ### specific computer going via elsewhere
eg: metric=2 192.168.77.10/29 via 192.168.77.9 ### instead of default metric=0

Last edited by dawnofman (2022-04-17 17:32:01)

Offline

#2 2022-03-10 20:04:08

Tarqi
Member
From: Ixtlan
Registered: 2012-11-27
Posts: 180
Website

Re: [solved]"ip address add" without adding the default (metric=0) route ?

dawnofman wrote:

I've been reading the man page for ip address [...]

Sure?

ip address add local 192.168.77.10/29 dev eno1 metric 2

Edit: I read your post again and might misunderstood it. If you want to route a specific IP via a specific gateway, just add the route. The metric should not be important if you have a correct network layout.

Last edited by Tarqi (2022-03-10 20:48:20)


Knowing others is wisdom, knowing yourself is enlightenment. ~Lao Tse

Offline

#3 2022-03-10 21:36:28

dawnofman
Member
Registered: 2019-07-26
Posts: 140

Re: [solved]"ip address add" without adding the default (metric=0) route ?

Tarqi wrote:

Sure?

Sure.

Tarqi wrote:

Edit: I read your post again and might misunderstood it. If you want to route a specific IP via a specific gateway, just add the route. The metric should not be important if you have a correct network layout.

from the man page: metric NUMBER ... priority of prefix route associated with address.

I didn't figure out that a metric following ip address add ... was for the default route created by it; somehow I thought of it as a way to bind it with another already-added custom route. My fault.

I suppose this will do the trick. Thanks for your advice smile !

Offline

Board footer

Powered by FluxBB