Change routes with multipath?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Change routes with multipath?

Rudy Baker
Hello everyone,

I hope I posted this in the right area, I don't usually join mailing lists
so I am still a bit of a noob.

Anyways, hoping someone could help me out. I am coming up empty on my
searches figuring this out.

If I have 2 default gateways configured with priorities, how would I modify
the priorities using "route change"? I would prefer not to have to delete
the route and re-add them.

$ sudo route add -mpath default 64.4.4.4 -priority 1
$ sudo route add -mpath default 129.2.2.2 -priority 15
$ sudo netstat -rn | grep default
~
# default           64.4.4.4       UGS        3     3308     -     1 em0
# default            129.2.2.2       UGS        0        0     -    15 em1

If I try to change priorities:

$ sudo route change -mpath default 129.2.2.2 -priority 1
~
# route: writing to routing socket: No such process
# change net default: gateway 129.2.2.2: not in table

Any hints as to how I can change priority on a default multipath route? I
would appreciate it greatly.

Thanks for reading.

Reply | Threaded
Open this post in threaded view
|

Re: Change routes with multipath?

Martin Pieuchot
On 26/03/15(Thu) 14:07, rizz2pro . wrote:

> Hello everyone,
>
> I hope I posted this in the right area, I don't usually join mailing lists
> so I am still a bit of a noob.
>
> Anyways, hoping someone could help me out. I am coming up empty on my
> searches figuring this out.
>
> If I have 2 default gateways configured with priorities, how would I modify
> the priorities using "route change"? I would prefer not to have to delete
> the route and re-add them.
>
> $ sudo route add -mpath default 64.4.4.4 -priority 1
> $ sudo route add -mpath default 129.2.2.2 -priority 15
> $ sudo netstat -rn | grep default
> ~
> # default           64.4.4.4       UGS        3     3308     -     1 em0
> # default            129.2.2.2       UGS        0        0     -    15 em1
>
> If I try to change priorities:
>
> $ sudo route change -mpath default 129.2.2.2 -priority 1
> ~
> # route: writing to routing socket: No such process
> # change net default: gateway 129.2.2.2: not in table
>
> Any hints as to how I can change priority on a default multipath route? I
> would appreciate it greatly.

Does it work with "-priority 2"?  The number "1" is special and reserved
for routes representing local (your own) addresses.  I just realized
that this is not (and should) be documented.

Reply | Threaded
Open this post in threaded view
|

Re: Change routes with multipath?

Rudy Baker
Hey, thanks for replying.

It doesn't seem to work with any number at all actually.

If I didn't have multipathing enabled, these work:

$ route change default -priority 1
$ route change default -priority 15
$ route change default -priority 6

But having multipath setup, it seems like it doesn't know which route to
change or how to handle it:

$ route change -mpath default 64.4.4.4 -priority 1
$ route change -mpath default 64.4.4.4 -priority 6
$ route change -mpath default 64.4.4.4 -priority 15

# route: writing to routing socket: No such process
# change net default: gateway 64.4.4.4: not in table

I guess normally you don't need to specify the gateway in the command
without multipath because there is only one gateway. But I need to be
specific.

If I try

$ sudo route change -mpath default -priority 7

Then it lets the system choose which route to change and I get very mixed
results (sometimes one interface gets the priority..and sometimes the other
one!)

I might be wrong, but if you might know of a way to do it, I would
appreciate any hints. Hope it's not a bug?

Thanks for the help,

RZ


On Thu, Mar 26, 2015 at 6:24 PM, Martin Pieuchot <[hidden email]> wrote:

> On 26/03/15(Thu) 14:07, rizz2pro . wrote:
> > Hello everyone,
> >
> > I hope I posted this in the right area, I don't usually join mailing
> lists
> > so I am still a bit of a noob.
> >
> > Anyways, hoping someone could help me out. I am coming up empty on my
> > searches figuring this out.
> >
> > If I have 2 default gateways configured with priorities, how would I
> modify
> > the priorities using "route change"? I would prefer not to have to delete
> > the route and re-add them.
> >
> > $ sudo route add -mpath default 64.4.4.4 -priority 1
> > $ sudo route add -mpath default 129.2.2.2 -priority 15
> > $ sudo netstat -rn | grep default
> > ~
> > # default           64.4.4.4       UGS        3     3308     -     1 em0
> > # default            129.2.2.2       UGS        0        0     -    15
> em1
> >
> > If I try to change priorities:
> >
> > $ sudo route change -mpath default 129.2.2.2 -priority 1
> > ~
> > # route: writing to routing socket: No such process
> > # change net default: gateway 129.2.2.2: not in table
> >
> > Any hints as to how I can change priority on a default multipath route? I
> > would appreciate it greatly.
>
> Does it work with "-priority 2"?  The number "1" is special and reserved
> for routes representing local (your own) addresses.  I just realized
> that this is not (and should) be documented.

Reply | Threaded
Open this post in threaded view
|

Re: Change routes with multipath?

Renato Westphal
2015-03-27 13:40 GMT-03:00 rizz2pro . <[hidden email]>:

> Hey, thanks for replying.
>
> It doesn't seem to work with any number at all actually.
>
> If I didn't have multipathing enabled, these work:
>
> $ route change default -priority 1
> $ route change default -priority 15
> $ route change default -priority 6
>
> But having multipath setup, it seems like it doesn't know which route to
> change or how to handle it:
>
> $ route change -mpath default 64.4.4.4 -priority 1
> $ route change -mpath default 64.4.4.4 -priority 6
> $ route change -mpath default 64.4.4.4 -priority 15
>
> # route: writing to routing socket: No such process
> # change net default: gateway 64.4.4.4: not in table
>
> I guess normally you don't need to specify the gateway in the command
> without multipath because there is only one gateway. But I need to be
> specific.
>
> If I try
>
> $ sudo route change -mpath default -priority 7
>
> Then it lets the system choose which route to change and I get very mixed
> results (sometimes one interface gets the priority..and sometimes the other
> one!)
>
> I might be wrong, but if you might know of a way to do it, I would
> appreciate any hints. Hope it's not a bug?
>
> Thanks for the help,
>
> RZ
>
>
> On Thu, Mar 26, 2015 at 6:24 PM, Martin Pieuchot <[hidden email]> wrote:
>
>> On 26/03/15(Thu) 14:07, rizz2pro . wrote:
>> > Hello everyone,
>> >
>> > I hope I posted this in the right area, I don't usually join mailing
>> lists
>> > so I am still a bit of a noob.
>> >
>> > Anyways, hoping someone could help me out. I am coming up empty on my
>> > searches figuring this out.
>> >
>> > If I have 2 default gateways configured with priorities, how would I
>> modify
>> > the priorities using "route change"? I would prefer not to have to delete
>> > the route and re-add them.
>> >
>> > $ sudo route add -mpath default 64.4.4.4 -priority 1
>> > $ sudo route add -mpath default 129.2.2.2 -priority 15
>> > $ sudo netstat -rn | grep default
>> > ~
>> > # default           64.4.4.4       UGS        3     3308     -     1 em0
>> > # default            129.2.2.2       UGS        0        0     -    15
>> em1
>> >
>> > If I try to change priorities:
>> >
>> > $ sudo route change -mpath default 129.2.2.2 -priority 1
>> > ~
>> > # route: writing to routing socket: No such process
>> > # change net default: gateway 129.2.2.2: not in table
>> >
>> > Any hints as to how I can change priority on a default multipath route? I
>> > would appreciate it greatly.
>>
>> Does it work with "-priority 2"?  The number "1" is special and reserved
>> for routes representing local (your own) addresses.  I just realized
>> that this is not (and should) be documented.

You got it right, you can't change a multipath route. It's a
limitation of the kernel API and there's nothing you can do about it.

I came across this problem too when I was working on ldpd(8):
https://github.com/rwestphal/openbsd-ldpd/blob/renato-2015/kroute.c#L1344

If removing a route and re-adding it with a new nexthop poses a
problem to you please let us know so we can think about a solution.

PS: please don't top post on @misc.

--
Renato Westphal