All of lore.kernel.org
 help / color / mirror / Atom feed
* route sorting
@ 2011-10-17 12:22 Mr Dash Four
  2011-10-17 13:20 ` Marcin Mirosław
  0 siblings, 1 reply; 6+ messages in thread
From: Mr Dash Four @ 2011-10-17 12:22 UTC (permalink / raw)
  To: netfilter

When I execute "route" to display my routing table all entries are 
sorted by ip address (when -n is specified). This seems to be a bit 
different from previous kernel versions (I am using 3.0.6) - 2.6.38 for 
example - where the routing table used to show the most specific netmask 
first (at the top), which is what I really wanted as it was very easy to 
judge how a particular ip address is going to be routed. When I execute 
"route" now I can't get it to show the routing table the way I want and 
the way it was done in previous kernel versions. Any suggestions?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: route sorting
  2011-10-17 12:22 route sorting Mr Dash Four
@ 2011-10-17 13:20 ` Marcin Mirosław
  2011-10-17 15:07   ` Tyler J. Wagner
  0 siblings, 1 reply; 6+ messages in thread
From: Marcin Mirosław @ 2011-10-17 13:20 UTC (permalink / raw)
  To: Mr Dash Four; +Cc: netfilter

W dniu 17.10.2011 14:22, Mr Dash Four pisze:
> When I execute "route" to display my routing table all entries are
> sorted by ip address (when -n is specified). This seems to be a bit
> different from previous kernel versions (I am using 3.0.6) - 2.6.38 for
> example - where the routing table used to show the most specific netmask
> first (at the top), which is what I really wanted as it was very easy to
> judge how a particular ip address is going to be routed. When I execute

Hello,
i can't help you with "sorting problem" but i can see the real problem 
is "i want to know which path will be used for given address ip". I 
suggest to use iproute2, e.g.: ip r g <address_ip>
This is output:
# ip r g 4.5.6.7
4.5.6.7 via 88.198.102.193 dev eth0  src 88.198.102.195
     cache

Regards

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: route sorting
  2011-10-17 13:20 ` Marcin Mirosław
@ 2011-10-17 15:07   ` Tyler J. Wagner
  2011-10-17 15:37     ` Mr Dash Four
  0 siblings, 1 reply; 6+ messages in thread
From: Tyler J. Wagner @ 2011-10-17 15:07 UTC (permalink / raw)
  To: Marcin Mirosław; +Cc: Mr Dash Four, netfilter

On 2011-10-17 14:20, Marcin Mirosław wrote:
> Hello,
> i can't help you with "sorting problem" but i can see the real problem is
> "i want to know which path will be used for given address ip". I suggest to
> use iproute2, e.g.: ip r g <address_ip>
> This is output:
> # ip r g 4.5.6.7
> 4.5.6.7 via 88.198.102.193 dev eth0  src 88.198.102.195

To clarify, that's "ip route get <ip>". You can use shortcuts, but for
examples for beginners that may not be wise.

Another reason to use iproute2 ("ip") is that "route" is deprecated, and
cannot display all of the things iproute2 now reveals. Such as multiple
routes, metrics, or sources (such as from zebra/quagga). Finally, "ip rule"
helps you to see policy routes like source-based routing. "route" cannot do
any of that.

Regards,
Tyler

-- 
"Never underestimate the bandwidth of a station wagon full of tapes
hurtling down the highway.
   -- Andrew S. Tanenbaum

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: route sorting
  2011-10-17 15:07   ` Tyler J. Wagner
@ 2011-10-17 15:37     ` Mr Dash Four
  2011-10-17 19:32       ` Jan Engelhardt
  2011-10-17 21:41       ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Mr Dash Four @ 2011-10-17 15:37 UTC (permalink / raw)
  To: Tyler J. Wagner; +Cc: Marcin Mirosław, netfilter


>> Hello,
>> i can't help you with "sorting problem" but i can see the real problem is
>> "i want to know which path will be used for given address ip". I suggest to
>> use iproute2, e.g.: ip r g <address_ip>
>> This is output:
>> # ip r g 4.5.6.7
>> 4.5.6.7 via 88.198.102.193 dev eth0  src 88.198.102.195
>>     
>
> To clarify, that's "ip route get <ip>". You can use shortcuts, but for
> examples for beginners that may not be wise.
>   
Yeah, I figured that one out. I use iproute2 to build my routing table, 
but never thought of using it to trace route paths as the "old" route 
was more convenient - to me anyway.

> Another reason to use iproute2 ("ip") is that "route" is deprecated, and
> cannot display all of the things iproute2 now reveals. Such as multiple
> routes, metrics, or sources (such as from zebra/quagga). Finally, "ip rule"
> helps you to see policy routes like source-based routing. "route" cannot do
> any of that.
>   
Yeah, that helped - thank you both! I think I also found a little 
discrepancy while executing "ip rule list <number>" (wrong syntax, 
obviously) - it shows me "'ip rule show' does not take any arguments." 
error message. Should that be ""ip rule list" does not take any 
arguments." instead?

I am still curious though why the sorting order in the old "route" has 
changed from one kernel version to the next?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: route sorting
  2011-10-17 15:37     ` Mr Dash Four
@ 2011-10-17 19:32       ` Jan Engelhardt
  2011-10-17 21:41       ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: Jan Engelhardt @ 2011-10-17 19:32 UTC (permalink / raw)
  To: Mr Dash Four; +Cc: Tyler J. Wagner, Marcin Mirosław, netfilter


On Monday 2011-10-17 17:37, Mr Dash Four wrote:
>  
> Yeah, that helped - thank you both! I think I also found a little discrepancy
> while executing "ip rule list <number>" (wrong syntax, obviously) - it shows me
> "'ip rule show' does not take any arguments." error message. Should that be
> ""ip rule list" does not take any arguments." instead?

show and list are equal, and FWIW, the number you see is not a rule number,
but a priority.

> I am still curious though why the sorting order in the old "route" has changed
> from one kernel version to the next?

Possibly because the kernel changed its way, and ye olde broken
net-tools does not sort it on its own. (Similar to how
getdents/readdir is not required to return entries in sorted fashion)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: route sorting
  2011-10-17 15:37     ` Mr Dash Four
  2011-10-17 19:32       ` Jan Engelhardt
@ 2011-10-17 21:41       ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2011-10-17 21:41 UTC (permalink / raw)
  To: mr.dash.four; +Cc: tyler, marcin, netfilter

From: Mr Dash Four <mr.dash.four@googlemail.com>
Date: Mon, 17 Oct 2011 16:37:59 +0100

> I am still curious though why the sorting order in the old "route" has
> changed from one kernel version to the next?

Because the underlying datastructure used to hold the table
has changed.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-10-17 21:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-17 12:22 route sorting Mr Dash Four
2011-10-17 13:20 ` Marcin Mirosław
2011-10-17 15:07   ` Tyler J. Wagner
2011-10-17 15:37     ` Mr Dash Four
2011-10-17 19:32       ` Jan Engelhardt
2011-10-17 21:41       ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.