The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > IP Networking
Google UNIX.COM


IP Networking Questions involving TCP/IP, Routers, Hubs, Network protocols, etc go here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how would you solve this problem? soemac UNIX for Advanced & Expert Users 7 03-29-2008 04:29 PM
Can any one solve this Problem...!!! Baba B. Saheb High Level Programming 9 10-10-2005 09:42 PM
can't solve that problem [PLEASE HELP] AiRkO UNIX for Advanced & Expert Users 2 01-22-2004 09:31 AM
How can I solve this problem? acqy High Level Programming 4 12-30-2003 06:32 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-23-2008
Registered User
 

Join Date: Oct 2004
Posts: 60
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Need to solve complex network problem

I have a Red Hat linux server X on a x.x.0.0 network. This machine also has to communicate with another server Y on a network called y.y.0.0

Server X has two network interfaces.

eth0 is configured on the x.x.0.0 network and has a default gateway on the x.x.0.0 network.

In order to communicate server Y on the y.y.0.0 network I'm planning on configuring eth1 with a y.y.0.0 IP address and gateway. I then want to add a static route on eth0 that uses eth1's IP address as a gateway.

Example (using fictional IP addresses):

SERVER X -> eth0 192.168.0.1 (add static route 20.10.0.0 gw 20.10.0.1)
-> eth1 20.10.0.1

SERVER Y -> 20.10.0.10

My logic tells me that if I then request to talk to server Y the request will go to eth1 via the static routed on eth0. eth1 is on the same network as server Y, so the request should then be able to reach server Y

Could someone please confirm that his is correct (or incorrect for that matter).

Cheers
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-23-2008
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,253
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
If server X has an interface on the 192.168.0.0 network then it knows how to easily reach 192.168.0.0 addresses. A second inferface on another network won't change that. It should be able to reach either network as needed with out any routes.
Reply With Quote
  #3 (permalink)  
Old 02-24-2008
Bughunter Extraordinaire
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 933
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
You need an "interface route" for every interface, that is: a route with the network your interface is in as destination and your interfaces adress as gateway.

Example: you have an interface with the adress 192.168.1.100 which is part of the network 192.168.1/24. Add a route to destination network 192.168.1.0 with gateway 192.168.1.100.

As you have two interfaces you should have two of these interface routes, one for each interface. You then should define a "default route", which is a catch-all for every packet not already dealt with by the interface routes. This route should point to a gateway router on one of the networks you already participate in with your interfaces.

I can't understand what a static route between your interfaces (from eth0 to eth1 or vice versa) is supposed to achieve. If you want to send packets coming in on one interface over to the other network: this is the functionality of a router/gateway. Switch on IP-forwarding to accomplish this but be careful to understand what you are doing when you do this. You might easily compromise any network security by doing so.

bakunin
Reply With Quote
  #4 (permalink)  
Old 02-24-2008
Registered User
 

Join Date: Oct 2004
Posts: 60
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Hi all

I think the bit where I'm getting confused is the default gateway. I understand it's a catch-all for requests that can't be resolved on the two network interfaces. However, the default gateway is connected to eth0 as specified in /etc/sysconfig/network-scripts/ifcfg-eth0. Shows you how little I understand of networking on a linux system.

Thanks all for answering my question. I shall steer clear of static routes :-)
Reply With Quote
  #5 (permalink)  
Old 02-24-2008
Bughunter Extraordinaire
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 933
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
The "default route" may be shown as an attribute for eth0 but *every* IP host has one and exactly one default route.

A route is telling the IP stack (and, regardless of the number of interfaces, there is only one IP stack per host) that "everything directed to network <destination> is to be sent to <gateway>, <gateway> will know how to handle it". "<network>" in this regard is a bit of a stretch, it can be a "network" consisting of only one host, if the subnet mask is all bits set to 1.

A "default" route is nothing different from that, just that "destination" is not a network or a host, but "everything not covered by other rules".

For instance:

your IP networks: 192.168.1/24, 192.168.2/24 in each of them your own IP adress will be 100. There is a router on network 192.168.1, which connects the network(s) to the world and has the adress 1 in the network.

Your IP address layout:

eth0: 192.168.1.100 / 255.255.255.0
eth1: 192.168.2.100 / 255.255.255.0

Your routing table (i do that on an AIX box, so it looks a bit different from Linux):
Code:
# netstat -rn
Routing tables
Destination        Gateway           Flags   Refs     Use  If   Exp  Groups

Route Tree for Protocol Family 2 (Internet):
default            192.168.1.1       UG        9    229328 en0      -      -   =>
192.168.1/24       192.168.1.100     U         0         0 en0      -      -   =>
192.168.2/24       192.168.2.100     U         0         0 en1      -      -   =>
The IP stack will now work like that: if it has to send a packet to a destination on one of "its own" networks (192.168.1/2.x) it will do so using eth0 or eth1, depending on rule 2 or 3.

If it has to send a package to 192.168.3.100 (or any other network), it will first consult all the rules it knows (2&3), finding out that no one fits. Now it falls back on its default route, which tells it to send it faithfully to 192.168.1.1, a host who (hopefully) will know what to do with it. Now it again looks up how to find 192.168.1.1 and - bingo! - it knows from rule 2 how to reach that host.

If the router would be moved from 192.168.1.1 to 192.168.2.1 you would have to change the default route and in the same way the packet would leave the host via eth1 instead of eth0.

I hope this clears things up.

bakunin
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes


The 50 most popular UNIX and Linux searches.
Google Search Cloud for The UNIX and Linux Forums
421 service not available, remote server has closed connection ^m automate ftp autosys awk trim bash eval bash exec bash for loop command copy/move folder in unix couldn't set locale correctly curses.h cut command in unix daemon process export command in unix find grep find mtime find null character in a unix file grep multiple lines grep or grep recursive hp-ux ifconfig inaddr_any inappropriate ioctl for device lynx javascript mailx attachment mget mtime ping port remove first character from string in k shell replace space by comma , perl script scp recursive segmentation fault(coredump) sftp script snoop unix stale nfs file handle syn_sent tar exclude tar extract to folder test: argument expected unix unix .profile unix forum unix forums unix interview questions unix simulator unix.com vi select all vi substitute vi+substitute+end+of+line+character while loop within while loop shell script


All times are GMT -7. The time now is 04:59 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101