0

I have a problem when I'm doing an access using my DNS hosted at another server, which performs a redirect to my internal network.

example:

User attempting access to internal DNS: intranet.site.com: 8090 (182.12.1.1:8090> 192.168.1.151:80)

My router does not allow access.

I've tried unsuccessfully NAT ....

With iptables but I've got here in the company is directly ADSL Router bad!

1
  • Whatever device is handling internal DNS, make the entries there, don't include your external ip at all. Just internal.site.com:8090 = 192.168.1.151:80
    – DanBig
    Oct 2, 2013 at 20:52

1 Answer 1

1

The subject of your question makes the problem you are having seem obvious enough, but the question itself is very unclear... so I'm not entirely certain whether I'm answering the correct question.

It sounds like you have DNS set to return the external IP of your site, and when accessed from outside your network, this functions correctly through the modem+router's NAT (PAT) configuration, but when accessed from inside, internal machines can't access the server in this same way.

In my experience, a significant number of consumer-grade (and some more sophisticated) routers don't understand the concept that an internal request addressed to a port on the external IP is something you would want to have "hairpinned" back through the router, and natted back into the network.

So the answer to your question is probably "you can't do that with the equipment you have."

However, you can work around it in a couple of ways.

The router I use at home is an old Westell router. Configuration > Advanced LAN > DNS takes me to a screen called "Static Host Assignment" when I can enter any hostname, real or fake, and the IP address I want associated with that hostname. My internal machines use the router as their DNS server -- it proxies requests out to the ISP's DNS server -- but for the entries I make in this table, the addresses I've entered are the addresses that are returned to my internal machines when they try to access one of those hosts.

If I, for example, put "google.com" -> "192.168.1.2" in my DSL modem/router, then any computer in my internal network would try to connect to the server at 192.168.1.2 whenever anyone typed in "google.com".

If your router has a similar capability, you can put your internal server's hostname and address in the DNS settings of the router and internal machines will resolve that internal address. That won't help you with the port mapping, of course... I'm not sure what you're saying about 8090 -> 80. The internal machine would connect directly to the other internal machine, so if you are trying to translate ports, that wouldn't happen.

Or, if your machines don't use the router as your DNS server and you have an internal DNS server, static entries there could be used to solve this. Or, you could set up an internal DNS server and then re-read the previous sentence. :)

The other option is static entries in your /etc/hosts or C:\Windows\System32\Drivers\etc\hosts files on your individual machines. The hosts file overrides DNS, allowing you to set static IP addresses for certain hostnames. This doesn't scale very well, of course, but it is also a possible way to make this happen. I used this method for a while before I discovered that unexpected option tucked away in my DSL router's configuration.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .