LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Connecting 2 routers (http://www.linuxquestions.org/questions/linux-networking-3/connecting-2-routers-291526/)

godong 02-17-2005 03:41 PM

Connecting 2 routers
 
Hi,

I tried to setup a linux server to route packets between 2 routers, here is my configuration:


Linux Server:
eth 0 (192.168.1.2) -> to Router A
eth 1 (10.1.1.2) -> to Router B

Other Devices:

router A (192.168.1.1) -> client 1 and linux server connected to it's LAN

router B (10.1.1.1) -> client 2 and linux server connected to it's LAN

client 1 (192.168.1.3) -> to Router A
client 2 (10.1.1.3) -> to Router B

Both routers doesn's have internet connection (WAN port is not used), I want to be able to connect client 1 to client 2 without internet connection. To do so, I want the linux server to act as the router between this 2 private networks. Right now client 2 is invisible to client 1, but client 1 and client 2 are both visible to the linux server. I added an entry for static routes on both routers:

router A:
Destination Network : 10.1.1.0
Destination Netmask : 255.255.255.0
Gateway : 192.168.1.2

router B:
Destination Network : 192.168.1.0
Destination Netmask : 255.255.255.0
Gateway : 10.1.1.2

The Gateways are the IP addresses of the Linux server, my problem now is that it didn't work, I believe I need to set some rules to forward the packet from eth 0 to eth 1, vice versa. Anyone have any suggestion on what should I do (Perhaps some iptables rules, or routed)? I'm running Linux Enterprise AS 3.0.

Thanks.

cowanrl 02-17-2005 05:07 PM

In your set up there, you have no need for routers A and B. Eth0 of the Linux server and client1 can both connect to the same switch or hub. Client1's default gateway should be eth0's IP address of 192.168.1.2. Eth1 of the Linux server and client2 can both connect to the same hub or switch. Client2's default gateway dould be eth1's IP address of 10.1.1.2.
To start the Linux server forwarding packets between eth0 and eth1, enter this command as root:

echo 1 > /proc/sys/net/ipv4/ip_forward

For routerA and routerB to actually be routers, they'll need to have 2 interfaces on them with IP addresses on different subnets.


All times are GMT -5. The time now is 04:47 PM.