LinuxQuestions.org
Help answer threads with 0 replies.
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 08-26-2007, 06:09 PM   #1
neo_kryptik
LQ Newbie
 
Registered: Aug 2007
Posts: 4

Rep: Reputation: 0
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.
 
Old 08-27-2007, 01:31 PM   #2
rossonieri#1
Member
 
Registered: Jun 2007
Posts: 359

Rep: Reputation: 34
hi,

very simple,
take a look at your http server config,
search for listen to address.
which interface/ip addr it is listening to?

you dont need to specify a route for your LAN if you only have 1 subnet.

HTH.
 
Old 08-27-2007, 04:40 PM   #3
neo_kryptik
LQ Newbie
 
Registered: Aug 2007
Posts: 4

Original Poster
Rep: Reputation: 0
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.
 
Old 08-29-2007, 02:26 AM   #4
neo_kryptik
LQ Newbie
 
Registered: Aug 2007
Posts: 4

Original Poster
Rep: Reputation: 0
BUMP
Someone help me please!
 
Old 08-29-2007, 10:21 AM   #5
rossonieri#1
Member
 
Registered: Jun 2007
Posts: 359

Rep: Reputation: 34
BUMP

OK, so lets assuming your preference that your server listening to all ip 0/0 ya?

the problem is that your LAN routes (0 - directly connected)takes over the route - it has lower metric compares to the default gateway (1).

do check the route metric.

HTH.

Last edited by rossonieri#1; 08-29-2007 at 10:26 AM.
 
  


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
Routing using Red Hat Enterprise 4 ES Amdas Linux - Networking 1 07-13-2007 07:43 AM
Routing with Red Hat Enterprise 4 Amdas Linux - Networking 1 07-11-2007 02:50 PM
Red Hat 7.3 and multiple gateways on multiple interfaces bluefmc Linux - Networking 2 11-19-2004 05:01 PM
Multiple Hard Drive Problem with Red Hat 9.0 swap01 Linux - Hardware 1 08-11-2004 05:13 PM
routing with Red Hat 8.0 ?? jaitropfaim Linux - Networking 4 02-16-2003 07:51 AM

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

All times are GMT -5. The time now is 01:03 PM.

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