How can I redirect a subdomain to an internal IP?

2

I have a FQDN let's say abc.com. with only one external IP and I use zoneedit.com ns servers.

I have configured www as a CNAME of abc.com. The web server is setup with IIS on local computer. What I want to do is to have a subdomain xyz of abc.com to be redirected to let's say 192.168.1.120 on local PC but to be accessible from web like http://xyz.abc.com/.

How do I make this work?

I tried to setup headers in IIS like for www.abc.com to port 80 192.168.104 (this is the IP for web server) and xyz.abc.com to port 80 192.168.120 (the other server which is NOT a web server).

Misu DF

Posted 2011-12-28T16:02:28.460

Reputation: 21

1

I think you will need to configure IIS on the web server to forward requests for xyz.abc.com to the other computer: http://serverfault.com/q/47537/77238

– William Jackson – 2012-10-09T14:30:41.310

Answers

2

Local addresses (like 192.168.*.*) aren't allowed on the Internet. They are managed by your local router and translated there.
If you only have one public IP then both subdomains will need to have that same IP. All traffic is not tagged as comming from a certain domain (HTTP-traffic almost always is though).

You can however use NAT forwarding. It is done by your router and forwards ports. You can forward traffic to port 80 to 192.168.1.104 and all other traffic to 192.168.1.120 but xyz.abc.com:80 and www.abc.com:80 will get resolved to your.public.IP.addresss:80 and your router won't be able to tell the difference.

micke

Posted 2011-12-28T16:02:28.460

Reputation: 3 001

Actually I've just made it work with the help of my router which has dd-wrt (v24sp2)on it. I added in DNSMasq following settings: address=/xyz.abc.com/192.168.1.122 ptr-record=122.1.168.192.in-addr.arpa,"xyz.abc.com" and I added '*' in CNAME on the DNS server(zoneedit.com) for the abc.com domain. For now it works on my local network but I needed to work from any public web browser.

Remember I have only one public IP. Any suggestions? – Misu DF – 2011-12-28T21:13:13.933

Yes, this works on the local network because you have a whole /16-subnet of IP addresses but on the other side of the NAT you have only one. – micke – 2011-12-28T22:10:11.207

So the question is the same: how do I make it work? Do I need an internal DNS Server ? And if Yes how can I set it up? – Misu DF – 2011-12-29T12:36:22.590

1

With Apache, you set up what are called Virtual Hosts. A web server will see the sub.domain being requested, and you can do with that request what you want at that point. A reverse proxy configuration can have that sub.domain request be sent to a different internal IP address.

I've only ever set this up on Apache, but I'm sure there is identical functionality in IIS. In any case Reverse Proxy is what you're looking for.

JoshP

Posted 2011-12-28T16:02:28.460

Reputation: 2 236

-3

No, simply there is no way around it. You can do port redirect on to specific machines in your firewall but external DNS servers do not allow LAN IPs.

Why would you want to do it anyway?

Also, if you have no control over your WAN IP's PTR entries, there is nothing you can do.

Bart

Posted 2011-12-28T16:02:28.460

Reputation: 1