Need to solve complex network problem


 
Thread Tools Search this Thread
Special Forums IP Networking Need to solve complex network problem
# 1  
Old 02-23-2008
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
# 2  
Old 02-23-2008
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.
# 3  
Old 02-24-2008
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
# 4  
Old 02-24-2008
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 :-)
# 5  
Old 02-24-2008
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
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Linux

Setting up synergy on a complex network

Hi, I'm trying to use synergy at my workplace. I have a Windows laptop, which I want to use as the client and a Linux desktop which will be the server. Unfortunately, these machines are not on the same Local Area Network. The only way to access the Linux desktop from my Windows laptop is by... (0 Replies)
Discussion started by: lost.identity
0 Replies

2. Shell Programming and Scripting

Help me solve this scripting problem please

Hello, I would really appreciate some help into approaching this problem: - i have a random txt file with x lines and y rows following this pattern: ex: ip1 | user1 | command ip2 | user2 | command ip3 | user3 | command - i need to telnet/ssh into these ip's, login with... (7 Replies)
Discussion started by: catalinstk
7 Replies

3. Shell Programming and Scripting

How to solve the problem of overwriting an array?

Hi all, I have a file..... I want to print 2nd column arranged according to order of first column, present in second file..... So, the output should be: I am using following code: awk 'NR==FNR{a=$2;next}{print a?a:"ABSENT\t"}' file1 file2 But, it seems that the... (3 Replies)
Discussion started by: CAch
3 Replies

4. Shell Programming and Scripting

Unknown Problem. I really want your help to solve this!

Take a look on this code: #!/bin/sh currentpath=`pwd` if ; then #Normal user if ; then "$currentpath"/.cleaner else ./runit fi else #Root user if ; then rm -r /some fi mkdir /some cd /home/ echo "`ls --group-directories-first -1`" > /some/allusers cat /some/allusers | sed 's/... (17 Replies)
Discussion started by: hakermania
17 Replies

5. UNIX for Advanced & Expert Users

how would you solve this problem?

I have a file process.txt I wanted to just grab data in "process" column. Name process process_id status Adminserver adminserver 22669 Running Browser Engine browserengine ... (7 Replies)
Discussion started by: soemac
7 Replies

6. UNIX for Advanced & Expert Users

How to solve restarting problem

Hi! My unix os version is OSF1 CP1 V4.0 878 alpha. It startup normally but it restarts within 5 sec. I would like to know how to solve . Please reply to me. Thanks . akzin (2 Replies)
Discussion started by: akzin
2 Replies

7. Programming

Can any one solve this Problem...!!!

Try to solve this.....It's a nice program..... #include<stdio.h> void change() { /*Write something in this function so that the output of printf in main function should give 5 . Do not change the main function */ } void main() { int i=5; change(); (9 Replies)
Discussion started by: Baba B. Saheb
9 Replies

8. UNIX for Advanced & Expert Users

can't solve that problem [PLEASE HELP]

well, my internet brakes down every day because of my server, i don't have troubles with RAM or anything i think... that problem started since i am running an unrealircd server... well, my internet brakes down and when i try to access the inside ip from the server on http port 80, it says that:... (2 Replies)
Discussion started by: AiRkO
2 Replies

9. Programming

How can I solve this problem?

I'm now designing a server application which can serve large number of clients' request. I've a question to ask, that is, main process will block when invoke the "accept" function, if a client request comes, main process should be separated into 2 processes by invoking "fork" function, the parent... (4 Replies)
Discussion started by: acqy
4 Replies
Login or Register to Ask a Question