LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 07-01-2006, 11:18 PM   #1
kewlemer
LQ Newbie
 
Registered: Apr 2005
Location: Los Angeles, CA
Posts: 20

Rep: Reputation: 0
Problem with Static Routes


I have three boxes as following :-
1. Box A (eth0: 192.168.1.103)
2. Box B (eth0:192.168.1.100; eth1:192.168.1.101; eth2:192.168.1.102). Eth1 connects to A and Eth2 to C. And Eth0 to the Internet. So box B connects A to C and is connected to the Internet.
3. Box C (eth0: 192.168.1.104)

The set up is like this :-
Code:
[Box A] <=======> [Box B] <=========> [Box C]
I am trying to have A communicate with C. So this is what I did :-
1. On A and C, I have the corresponding interface of B as the default gateway.
2. On B, I did a
Code:
%route add -host 192.168.1.103 eth1
%route add -host 192.168.1.104 eth2
so that it sends data to A on its eth1 and data to B onto eth2.

Here is the routing table on C:-
Code:
[root@localhost ~]# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.1.103   0.0.0.0         255.255.255.255 UH        0 0          0 eth1
192.168.1.104   0.0.0.0         255.255.255.255 UH        0 0          0 eth2
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth1
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth0
[root@localhost ~]#
Now I can ping from A->B, B->A, C->B and B->C. But NOT from A to C.

I am not sure why because I have made sure that B knows how to route data by setting the static routes. But it's not routing it for some reason. When I run ethereal on B's eth1, I see that it's getting ARP requests from A for C (I tried pinging C from A). But it simply not forwarding it.

Any help will be greatly appreciated.

Thanks,
K
 
Old 07-02-2006, 12:57 AM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
Well, what are netmasks? You obviously have all the boxes in one subnet 192.168.1.* . But if a box in a subnet receives a packet from another box in the subnet for the third box in the same subnet it will think "Ah, we're on hub" and not forward it. Futhermore, ARP requests are never forwarded. You just failed to make A _route_ to C - if A sends ARP (inside-LAN) packets for it. So try again with A-B in 192.168.1.* and A-C in 192.168.2.* .
 
Old 07-02-2006, 03:44 PM   #3
kewlemer
LQ Newbie
 
Registered: Apr 2005
Location: Los Angeles, CA
Posts: 20

Original Poster
Rep: Reputation: 0
Hi Ruskin,

Thanks for the note. I tried that but no success

I felt that I could explain the problem better and here it is :-
http://www.linuxquestions.org/questi...65#post2317365


Thanks,
Harsha
 
Old 07-02-2006, 10:36 PM   #4
fotoguy
Senior Member
 
Registered: Mar 2003
Location: Brisbane Queensland Australia
Distribution: Custom Debian Live ISO's
Posts: 1,291

Rep: Reputation: 62
------------------------------------------------------
[Box A] <==========> [Box B] <===========> [Box C]
------------------------------------------------------
192.168.1.103<---->192.168.1.101
255.255.255.0 255.255.255.0
eth0 eth1
------------------------------------------------------
192.168.2.1<--------> 192.168.2.2
255.255.255.0 255.255.255.0
eth2 eth0
------------------------------------------------------
192.168.1.100
255.255.255.0
eth0
[to Internet]
------------------------------------------------------


From what i can see you have box B with 2 cards with the same network ID, yet you have box C on a conpletely different class C network, which is good. you should do the same for box A.

Also as a industry standard most admins will put all gateway address to end with 254, this makes it much easier for people to understand the layout of the routes, maybe try something like this:

------------------------------------------------------
[Box A] <==========> [Box B] <===========> [Box C]
------------------------------------------------------
192.168.3.103<---->192.168.3.254
255.255.255.0 255.255.255.0
eth0 eth1
------------------------------------------------------
192.168.2.254<--------> 192.168.2.2
255.255.255.0 255.255.255.0
eth2 eth0
------------------------------------------------------
192.168.1.100
255.255.255.0
eth0
[to Internet]
------------------------------------------------------

Then you may need to turn on ip_forwarding in the kernel to allow the packets to be forwared to the different network cards at the command line type:

echo 1 > /proc/sys/net/ipv4/ip_forward
 
Old 07-05-2006, 05:26 PM   #5
kewlemer
LQ Newbie
 
Registered: Apr 2005
Location: Los Angeles, CA
Posts: 20

Original Poster
Rep: Reputation: 0
Thanks for the note fotoguy. I did just what you mentioned and have it working.
 
Old 07-06-2006, 01:18 AM   #6
fotoguy
Senior Member
 
Registered: Mar 2003
Location: Brisbane Queensland Australia
Distribution: Custom Debian Live ISO's
Posts: 1,291

Rep: Reputation: 62
Quote:
Originally Posted by kewlemer
Thanks for the note fotoguy. I did just what you mentioned and have it working.
Good to hear you have it working.
 
  


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
How do I config static routes? mikezang Linux - Networking 4 10-31-2005 10:29 AM
Max Static Routes? roundst Linux - Networking 2 07-28-2005 02:51 AM
automatic static routes? eantoranz Linux - Networking 5 07-19-2005 08:30 PM
Setting static routes on LAN cranium2004 Linux - Networking 3 01-06-2005 11:57 PM
static-routes in Mandrake 10.0 tallthom Mandriva 1 09-27-2004 12:51 AM

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

All times are GMT -5. The time now is 12:36 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