Jump to content

Forward domains to different local machines


proskater123
 Share

Recommended Posts

Ok so I own two different domain names.

Mine.net

Mine.info

I want to forward both to my static ip address. Same address for both. But i would want mine.net to go to my local machine

10.0.0.105

and mine.info to go to

10.0.0.111

What software or hardware will i need to do this or is it even possible? I was thinking about using the headers but no idea how.

any ideas?

Link to comment
Share on other sites

You only want to use these domains on you LAN?

If thats the case then you didnt even need to spend money, you could have just set up a DNS server for you to use on your LAN.

If you wanted to be able to connect to services running on these machines from the internet then you just need to forward the proper ports in your router to the machines.

Link to comment
Share on other sites

If you have one internet IP address to share between the two computers you cannot assign the two domains to two machines at the same address. If you are thinking this is possible because web servers can this is not the case. A web server can host multiple sites on a single IP address because the client literally tells the server what host it is trying to reach and the http protocol has this feature as part of the specification, not all protocols (probably relatively few) can do this. It may be possible to achieve some thing similar to what you want depending on what you are doing.

Link to comment
Share on other sites

Enter a cname record on both hosts dns that point to the IP address of your home IP. When people get to the servers by name, they will resolve to the ip of your home machine.

Link to comment
Share on other sites

Enter a cname record on both hosts dns that point to the IP address of your home IP. When people get to the servers by name, they will resolve to the ip of your home machine.

I dont think that's will work properly. If I interpreted it correctly, this is what he's trying to implement. (I had the same question, but couldn't find a way to do it.)

20uq4iv.jpg

Link to comment
Share on other sites

Now Im confused. Maybe if he drew us a diagram of his physical network and where all these things sit it would be easier to understand. If its how you say in your picture above, then he would still need some sort of dns or edge server behind the router that handles the addresses for requests from the internet, or NAT configurations to redirect from the router to the servers.

Link to comment
Share on other sites

in a way my set up is like what Psychosis said. Its not really just a website. Its the entire port range. So if I went to mine.net all the ports will go to 10.0.0.5 and same for the other. Is there a router that will be able to activly forward all the traffic based on the domain requested?

Link to comment
Share on other sites

in a way my set up is like what Psychosis said. Its not really just a website. Its the entire port range. So if I went to mine.net all the ports will go to 10.0.0.5 and same for the other. Is there a router that will be able to activly forward all the traffic based on the domain requested?

You need two internet IP addresses.

A web server can host multiple domains because it knows the hostnames of the sites, and when the client requests the site it tells the server which one it's after, so the server returns that one. It only works with a single server, once you have multiple servers you need some clever routing rules to send traffic in the correct direction.

http://httpd.apache.org/docs/2.0/vhosts/name-based.html

Link to comment
Share on other sites

No ;) I know why you'd want them, but why as per the OP would you want them to resolve to different local IP's? Prehaps I'm missing something?

The only reason I can them wanting to do this is for something like RDP/VNC so they can connect straight through via Hostname?

Link to comment
Share on other sites

He wants to run 2 servers behind NAT, each providing different services, with 1 public IP using a DNS aware NAT service. The only way I could think of doing this would be for HTTP, and using a 3rd server as a load balancer of sorts to proxy requests. Bloody complicated for no real gain.

Link to comment
Share on other sites

He wants to run 2 servers behind NAT, each providing different services, with 1 public IP using a DNS aware NAT service. The only way I could think of doing this would be for HTTP, and using a 3rd server as a load balancer of sorts to proxy requests. Bloody complicated for no real gain.

The only benefit would be been able to physically separate each web site... except... shared hosting is cheap because lots of sites are hosted on a single box... so at this point you may as well get lots of internet IP address because you already bought two servers.

Link to comment
Share on other sites

Yes, you can forward to multiple IP's on a per-port basis, thats quite easy. However getting your router to forward requests made to the same port on to 2 different internal IP's based purely on the domain name used in the request is a lot more complex. You would need something that could read the requests and proxy them on to the different servers based on that. If your going to do that with apache sites, its a hell of a lot easier to forward the relevant ports to a single server and use shared hosting.

Link to comment
Share on other sites

If both machines are running different websites on port 80.

You cant forward the port to both of them.

So what you should do is put both websites on 1 server.

Once both websites are on 1 server, Im going to assume you are using apache, Create a Virtualhost host for the different domains.

Then forward port 80 to the webserver.

so if you request blah.info it will send you to the webroot you set up for blah.info

and if you request blah.com it will send you to the webroot you set up for blah.com

Link to comment
Share on other sites

If both machines are running different websites on port 80.

You cant forward the port to both of them.

So what you should do is put both websites on 1 server.

Once both websites are on 1 server, Im going to assume you are using apache, Create a Virtualhost host for the different domains.

Then forward port 80 to the webserver.

so if you request blah.info it will send you to the webroot you set up for blah.info

and if you request blah.com it will send you to the webroot you set up for blah.com

I think with Vhosts and mod_rewrite you can also point to different machines on th elocal network. You can use one machine to host apache and 1 domain, another with apache and the second domain, but have the 1st machine handle all requests for domains, pointing to localhost for one, and some other IP on the lan for the other.

If Im following correctly, I think thats whats going on in this post here: http://www.leveltendesign.com/blog/nickc/v...ation-localhost

Link to comment
Share on other sites

You still have the issue that external clients will see one IP, and one IP alone. You need to have something listening on this single IP which then proxy's the request to one of 2 internal (and non publicly routable) IPs upon which a server is listening for request to that domain. You cannot simply re-direct the request to the IP because that IP will not be routable for clients outside your NAT and the connection will fail. So, you can either user a complicated proxy, multiple CPE IP's or simple apache shared hosting. This is pretty much the only way to do what the OP was asking for.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...