Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have two routers connected to each other. Both the routers are connected to the WAN using two different ISPs.

Router A is used for the day to day browsing in the office while Router B is connected to a web server that serves pages to public.

When someone from Router A wants to access our website from Router B, the connection is getting through the WAN. I want to redirect that particular through the LAN instead. Is there any way to do it using the Router A (D-Link DIR-655)?

To summarise, if people in the office want to access pages from 60.51.223.223 (WAN of Router B), the traffic should go through Router B, which resolves the request locally. Router B is a client under Router A.

This is the network map:

Network diagram

Thank you for any help.

share|improve this question
    
A network diagram would be REALLY helpful, or a description that includes what IP addresses are where and what is connected to the ports on the routers. Also, the "Router B is a client under Router A" statement is not making sense to me. –  tomjedrz Nov 18 '09 at 5:34
    
I have updated the question with a network diagram. –  Nirmal Nov 19 '09 at 5:59

4 Answers 4

up vote 2 down vote accepted

As justinsteven noted, you can use DNS or local hosts files to direct the web site traffic to the internal IP address. Then set a route on each router for the other internal network, and all will work. If the two routers are "consumer grade" this might not be possible.

However ...

This configuration is not very secure, and would be keeping me awake at night. There is no real firewall, the web server is publicly accessible and has unfettered access to the rest of the network. The possibility of routing loops and performance problems is very real. I would take the cable connecting the internal networks out immediately. Sending that traffic through the internet is wise, since you don't have a properly configured network.

A far better solution is to get a good firewall (I like Astaro), plug both ISP connections into it as well as both internal networks, and configure it. Astaro offers a basic version of the software for free, so you can put 4 NICs into an older PC and away you go.

share|improve this answer
    
Thanks for your answer. After setting up a DNS Server, why should we setup a route on both the routers? Won't the DNS server forward the request without the routes? –  Nirmal Nov 20 '09 at 1:14
    
If the routers are just routers, No. If the routers have built in switches and those switches are connected, it might. The DNS server an IP address. Something has to tell the router where to send traffic for an address not in the subnet of any of it's interfaces. –  tomjedrz Nov 20 '09 at 2:12
    
You are right! But if you see the diagram, the web server is under the same subnet as of the Router A's LAN. Thanks for your help! I am going to give it a try. –  Nirmal Nov 20 '09 at 3:22
    
I didn't notice the same subnet. So if you are using the DSL routers with switches, getting the name to resolve internally to the internal address will do the trick. You still need a firewall. –  tomjedrz Nov 21 '09 at 0:32
1  
I got everything to work as expected. Actually the Astaro firewall itself has got a software router in it. So I managed to eliminate the two separate networks, merged them together, and have setup routing policies for conditional WAN access. Thanks for your suggestion! –  Nirmal Nov 23 '09 at 11:22

Add a route on Router A that uses Router B as the gateway for the networks which Router B serves. (Make sure that Router B has a route back to Router A.)

If this doesn't solve your problem, I highly suggest you reword your question - a network diagram should help.

share|improve this answer
    
Included the network diagram. Please see whether it's clear. –  Nirmal Nov 18 '09 at 7:43

Have a look at the Advanced\Routing tab.

In your example, you'd have something like this:

Name: Whatever
Destination IP: 60.51.223.223
Netmask: 255.255.255.255
Gateway: IP Address of the other router (B)

For further information have a look at the help page.

share|improve this answer
    
I tried that, but the Gateway accepts only a WAN IP and not a local IP. –  Nirmal Nov 18 '09 at 7:00
1  
That's because you have the interface drop down set to WAN. Change it to the interface that connects to router B. –  joeqwerty Nov 18 '09 at 15:08
    
Thanks for that suggestion. But there is no other option under interface. Only WAN is available. Is there any method to create a new interface? –  Nirmal Nov 19 '09 at 5:54

It's not the cleanest solution, but if you have an internal name server, you could add an A record for the website's name and give it the internal server address. If you're only talking about a handful of internal machines, you could do this on each via the hosts file.

share|improve this answer
    
Thanks! Your answer gave a spark! –  Nirmal Nov 20 '09 at 3:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.