Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.