LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   how to set preference and metric when configuring a satic route (https://www.linuxquestions.org/questions/linux-networking-3/how-to-set-preference-and-metric-when-configuring-a-satic-route-680080/)

Kanyong 10-30-2008 02:19 PM

how to set preference and metric when configuring a satic route
 
I am trying to figure out how to set preference and metric for a static route.

Based on the manual of "ip route" command, seems like both metric and preference options are acceptable. But when tried, I got failure. i,e

ip route add 1.1.0.0/16 via 2.2.2.2 metric 1 preference 5
ip: either "to" is duplicate or "metric" is garbage.

And, the linux "route" command only accept metric option. I can do the following succesfully.

route add -net 1.1.0.0/16 gw 2.2.2.2 metric 1

can anyone help me out?

Thanks a lot,
Yong

unSpawn 11-01-2008 05:02 AM

Quote:

Originally Posted by Kanyong (Post 3326412)
ip route add 1.1.0.0/16 via 2.2.2.2 metric 1 preference 5
ip: either "to" is duplicate or "metric" is garbage.

Using the right values for network and gateway the command finishes OK for me (iproute 2.6.18 and recent kernel 2.6)?..

davedave1 11-04-2008 04:42 AM

I'm not sure where you found 'preference'
But metric can be used to specify routes. The system will preferentially use the route with the lower metric so that will be enough.


Have a look at http://publib.boulder.ibm.com/infoce.../chgtcprte.htm


All times are GMT -5. The time now is 03:16 AM.