Link to home
Create AccountLog in
Avatar of sfun28
sfun28

asked on

resolve specific sub-domains to internal IP addresses

Hi Experts!  I have 2 dynamic dns host names that point to my router (dd-wrt).  Lets say:
sub1.domain.com  and sub2.domain.com
with port mapping, everything works fine with external calls to these hosts

internally, I'd like map these hosts to internal IP addresses.  so if a request goes out for a webservice that sits inside my firewall, I don't want the request to leave the router just to find out that it points back to the router.  I can think of a few ways to do this:
1. can i tell my router about sub1.domain.com... and tell it to always route those requests to the appropriate machines?
2. maybe I can tell each individual machine about sub1.domain.com... and specifcy which internal IPs to map each host to?

not sure what the right approach is nor even the right vocabulary about how to discuss this issue.
Avatar of tigermatt
tigermatt
Flag of United Kingdom of Great Britain and Northern Ireland image

Much easier - if you have a DNS server in your network, just add the entries to that internal DNS server with the appropriate static IP addresses on the record. You may need to create a new DNS zone for domain.com if it does not yet exist.

Please post back if you need more information.

-tigermatt
ASKER CERTIFIED SOLUTION
Avatar of JFrederick29
JFrederick29
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of sfun28
sfun28

ASKER

Sorry...I failed to mention that I don't have a DNS server.  I just have a few computers behind a router/cable-modem.  The hosts file seems like a good solution.  Is there some config on the router (i'm using dd-wrt) that would accomplish the same task (so that I only have to update in one place)
Does it work as is, meaning, can you connect to the external IP via the router (U-Turn on the router)?  If that works, I would simply use that "feature" and not worry about it traversing the router.  The router won't be able to handle the hosts file configuration unfortunately so you will have to update it manually or push it to each PC via a script of some sort.
Avatar of sfun28

ASKER

HI JFrederick29 - i'm not quite sure what you mean when you asked whether I can connect to the external IP via the router.  All of the machines behind the router can connect to sub1.domain.com, ...
With my webservices, i've noticed slow response time when using sub1.domain.com, but when I just use localhost, its super fast.  since I know, internally, that sub1, sub2, ... should point to specific internal IP addresses, I just want to configure that.  does this make sense?
Yeah, makes sense.  That is what I was asking.  I would go the hosts file route if you notice a performance difference.
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of sfun28

ASKER

Hi tigermatt,
That's a good observation...and its making wonder exactly what's causing the delays i'm seeing.  to be very specific, my web services are hosted as windows services using Windows Communication Foundation technology, part of the .net platform.  I've noticed that I get connection and data transfer timeouts when I use the full host name, but when i just localhost, everything runs smoothly.  so i'm not really sure where in the process things are getting held up.

in any case, i just wanted to throw that out there in case other people are experiencing the same thing and want to discuss.  otherwise, the hosts file seems like the way to go.
Hi sfun28, just wondered why I wasn't split some of the points?
Avatar of sfun28

ASKER

oh...sorry, i didn't know you could do that.  the ultimate solution was the hosts file which JFrederick29 just proposed.  i'm happy to split points - how would I do that?  sorry for the trouble.
Avatar of sfun28

ASKER

i mean to say "...which JFrederick29 first proposed"
It's up to you, but just thought that the info I posted on the routing side of it may have helped. If you like I can request this is reopened so you can reclose and split points?
Avatar of sfun28

ASKER

yes please!
Avatar of sfun28

ASKER

upping points, and splitting
sfun28, thanks a lot :-)