![]() |
|
|
|
|
|||||||
| IP Networking Questions involving TCP/IP, Routers, Hubs, Network protocols, etc go here. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
|||
|
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 |
|
|||
|
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 :-) |
|
|||
|
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 - - => 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 |
|||
| Google UNIX.COM |
| 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 |