LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-03-2009, 11:37 AM   #1
chicken76
Member
 
Registered: Mar 2009
Distribution: Slackware
Posts: 121

Rep: Reputation: 2
routing metrics


I have the following problem: I need to route packets to an IP address (referring to IPv4 only) that is part of a subnet that's directly connected, through another interface, a tunnel to be exact.
For example on interface eth1 setting the ip 192.168.1.1/netmask_255.255.255.0 would create a route to 192.168.1.0/24 with a default metric of 0 (zero). I need to route packets to a specific ip in that subnet through a tunnel interface called tunnel1. Ideally, I would do "ip route add 192.168.1.55/32 dev tunnel1". This would produce another route with a metric of 0 (zero) to that IP.

The question is: how to set up the metrics so that packets destined for .55 would go through the tunnel; and towards the rest of the hosts in that /24 subnet through eth1?
 
Old 03-03-2009, 12:42 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
just use the same or lower metric to the one for the local interface. if it's lower it will override straight off, but if it's a more specific subnet, e.g. /32 vs /24 then that will also override it.

route add -host 1.2.3.4 gw a.b.c.d metric 1

Last edited by acid_kewpie; 03-03-2009 at 12:44 PM.
 
Old 03-03-2009, 12:49 PM   #3
chicken76
Member
 
Registered: Mar 2009
Distribution: Slackware
Posts: 121

Original Poster
Rep: Reputation: 2
Ok, so if I understand correctly when faced with the same metric in two routes that match an IP, the more specific one (that is, the higher number of bits in the mask) has precedence?

Thank you for the info.

Could you guide me to some online documentation resources where the routing decisions are explained in detail?
 
Old 03-05-2009, 02:30 PM   #4
baldy3105
Member
 
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 891

Rep: Reputation: 184Reputation: 184
Correct, routers should always prefer the longest match. Only if the routes are the same length should metrics then be taken into account.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Tools to Chart Software Metrics l_long_island General 0 11-21-2008 08:45 AM
Apache Metrics ral0r3us Linux - Server 7 07-06-2008 05:00 PM
LXer: Linux vs. Windows Metrics -- Nothing Is Quite What It Seems To Be LXer Syndicated Linux News 0 05-02-2008 02:40 AM
LDAP Metrics cmontr Linux - General 0 01-24-2008 09:19 AM
Cedega font metrics GT_Onizuka Linux - Games 4 10-13-2004 11:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration