Red Hat 9 Multiple gateway routing configuration problem
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.
Red Hat 9 Multiple gateway routing configuration problem
I have two NICs installed on a system in my uni.
eth0 has ip belonging to the LAN. This is a DHCP based system and assigns a default gateway by itself(something like 172.16.1.254). I connect to this system via this connection. Since my computer is not on the same subnet as this system(foo), 172.16.1.254 is required. Also the same gateway provides internet connectivity to the system foo.
Apart from this, this system is supposed to act as an http server. For this purpose, it has an additional connection, eth1. It has a static, "real" (non NAT-ed) IP, say 64.17.12.31.
I establish an ssh tunnel to this system and use it for internet browsing through a local socks proxy which uses this tunnel.
What i want is that the system should use the static connection only to serve http requests which come to it on the public ip. For all other purposes it should use the local gateway(172.16.1.254).
this is wat i have done so far
ip route add 64.17.12.0/28 dev eth1 src 64.17.12.31 table 2
ip route add default via 64.17.12.29 table 2
ip route add 172.0.0.0/8 dev eth0 src 172.16.1.31 table 1
ip route add default via 172.16.1.254 table 1
ip route add default dev eth0 via 172.16.1.254
ip rule add from 64.17.12.31 table 2
ip rule add from 172.16.1.31 table 1
This is wat i have achieved:
ip route gives output:
64.17.12.128/28 dev eth1 scope link
172.16.1.0/24 dev eth0 proto kernel scope link src 172.16.1.31
169.254.0.0/16 dev eth1 scope link
172.0.0.0/8 via 172.16.1.254 dev eth0
127.0.0.0/8 dev lo scope link
default via 172.19.1.254 dev eth0
ip rule gives output:
0: from all lookup local
32761: from 172.16.1.31 iif eth0 lookup 1
32762: from 64.17.12.31 iif eth1 lookup 2
32763: from 64.17.12.31 iif eth1 lookup 2
32764: from 172.16.1.31 lookup 1
32765: from 64.17.12.31 lookup 2
32766: from all lookup main
32767: from all lookup 253
Now, according to what i've learnt during the last few nights of reading tutorials, this should work flawlessly.
Just to clarify, i intend to make a rule so that all requests to a particular interface are served only over that interface. All other traffic is to be routed through the other interface.
When i tested this, with tcpdump, i could see the packets coming in through eth1, but responses going out through eth0, but with the source ip corresponding to eth1. No wonder all http requests are timing out.
Please advise me on how i can do something about this, or even troubleshoot.
There are multiple subnets. subnet mask allocated by dhcp server is 255.255.255.0, and my ip is 172.17.2.1, which would lie on a different subnet. Thats why i think both the gateways are important. And the solution u mentioned, is IP specific. What i noticed in tcpdump was, that packets were coming in to the right ip. they were being sent out also from the same, correct ip. but they were being sent on the wrong interface. ie, packets sent from the ip of interface eth1, were being sent on eth0. They are probably being dropped at the next hop coz they have an invalid src ip.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.