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

We have a web server hosted out of our office, and it works fine when people access the site from outside the office.

The problem is that when people are inside the office and go to the website (www.example.com) it's very slow, as it goes out over the internet and comes back in.

Or LAN is Windows with Active Directory and our web server is CentOS with its own internet connection.

How can I set when users in my office want see website opens it from local network instead of going out of one internet connection and back in through the other?


Thank you I test this sulotion but I think I did wrong… I explain my network I have centos 5.8 server with 2 interface Eth1 with ip : 10.6.7.21 -> my modem range Eth0 with ip : 192.168.170.190 -> my office range (is other router for my windows network) In dns setting I set for www and .. my wan ip address : form exam 74.125.237.33 In my centos server I have 3 account (3website)

I want when I try from internal network with range 192.168.170.0 , website open with 192.168.170.190 and when users from external network want see website open from : form exam 74.125.237.33

right now external network with : form exam 74.125.237.33 work fine and no problem

share|improve this question

1 Answer 1

There's two common ways of doing this:

Override the DNS entries in your local DNS

This is a fairly common approach. If you have a very simple website (just running on a single domain), on your Active Directory DNS, create a new zone for example.com, and add an A record for www to point to the internal IP address of your web server. That way when your local computers attempt to access the website, they will get the internal IP address instead of the external one, but external users will still see your public IP address.

This works based on the assumption that your Active Directory DNS is not the NameServer for your public website, and that you have a different DNS provider for that (and if you don't... why..?)

Route internally

I'm going to also make the assumption that you have two routers - one for your office internet, and one for your web server. I don't know this for sure based on the info you've provided, but it's a common enough scenario.

What you need to do in this case is add a Static Route from your office router to your web server's router for the IP address in question.

Say for example your public IP address is 74.125.237.33 and your web server's router is 192.168.170.100. You would add a static route on your office router to route 74.125.237.33/32 (or 74.125.237.33/255.255.255.255) to 192.168.170.100.

Normally your router will forward any request it doesn't know what to do with to the upstream ISP via their gateway. This effectively makes your router aware of a better, shorter route to your web server, and it will use that instead of the ISP.

share|improve this answer

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.