LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-15-2013, 12:52 PM   #1
andrewex2013
LQ Newbie
 
Registered: Nov 2013
Posts: 4

Rep: Reputation: Disabled
Help needed with local DNS networking


Hello I need help with local DNS networking. On my network I have a server with 6 virtual servers all with there own local IP address like shown below.

Virtual Server 1 – 192.168.1.201
Virtual Server 2 – 192.168.1.202
Virtual Server 3 – 192.168.1.203
Virtual Server 4 – 192.168.1.204
Virtual Server 5 – 192.168.1.205
Virtual Server 6 – 192.168.1.206

Lets say I install Apache and put up a website on Virtual Server 2 and Virtual Server 3. I then can enter the local IP address while I am on the network and the website will load fine.

If I forward port 80 in my routers admin panel to 192.168.1.202 or 192.168.1.203 I can access the site by typing in my public IP address into the URL bar.

So now I can go to Godaddy and change the A record of one of my domains and when I go to the site everything loads fine.

This works fine and dandy if I only want to utilize one of my virtual server. What I would like to do is forward my public IP address at Virtual Server 1 and then it gets routed through Local DNS to Virtual Server 2 or Virtual Server 3 depending on the domain that was entered. I think the right way to do this is using Bind DNS and setting up zone files. I have tried to get this working but cant get the local DNS to route. Any help or direction is greatly appreciated!
 
Old 11-15-2013, 01:13 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,334

Rep: Reputation: Disabled
If you have only one public IP address, you can only forward port 80 to a single server on the inside. No amount of DNS trickery can get around that limitation.

Web sites can be identified by name. When a browser connects to a web server and asks for a site, it includes a "host:" header identifying the site in question, hence it is possible to serve multiple sites from the same server.

In theory, you could put all your sites on the same virtual server, but you could have good reasons for not wanting to do so (security, different software versions for different sites and so on).

If you want to distribute sites across multiple servers without getting additional public IP addresses, you will need to add a reverse proxy in front of the web servers. Port 80 will be forwarded to the proxy, which in turn forwards the request to the right virtual server.

You can use web server software (like Apache) to set up a reverse proxy, or you can use dedicated proxy software like Squid or Varnish.
 
Old 11-15-2013, 01:17 PM   #3
andrewex2013
LQ Newbie
 
Registered: Nov 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thank you very much for the information I will start looking into that. So Bind DNS and zone files pointing to the local IP address wont work. I was reading online you can setup a local DNS server and once it gets to your network it can be routed from there.
 
Old 11-15-2013, 01:30 PM   #4
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,334

Rep: Reputation: Disabled
Don't confuse name resolution with routing, and neither has much to do with the names of web sites.

When a web browser wants to access a web page, it asks the OS to resolve the name (like "www.linuxquestions.org") into an IP address. It then contacts port 80 on the host with that IP address, and sends an HTTP request for the site in question:
Code:
GET / HTTP/1.1
host: www.linuxquestions.org
[--- other headers may follow, identifying the browser, OS etc. ---]
Exactly one instance of name resolution is ever performed in that scenario, and it's done on the client side. Your local DNS zones in bind are never consulted.

The web server then usually does one of three things:
  • it looks at the host header, finds the site, and serves up a web page
  • it looks at the host header, doesn't recognize the site, and serves the default site instead
  • it looks at the host header, doesn't recognize the site, but has no default site definition and returns an error message
However, the web server may in fact be be a reverse proxy, which may act as a redirector and/or load balancer. In that case, there's a fourth option:
  • it looks at the host header, consults a configuration file, sends an identical request to another server, and returns the results to the client
In that case, the reverse proxy configuration file may refer to an IP address or the internal host name of your virtual server. In the latter case, your internal DNS zone is indeed consulted (by the proxy server) to resolve the name into an IP address.
 
Old 11-15-2013, 01:32 PM   #5
andrewex2013
LQ Newbie
 
Registered: Nov 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
Makes total sense. Thank you so much for taking the time out of your day to help me out. :-)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can a local DNS Server be used to handle dns requests going out to the internet baronobeefdip Linux - Server 1 07-03-2012 03:19 AM
Bind.DNS Help needed on Split DNS server manya Linux - Server 3 10-28-2010 08:39 AM
Redirect local DNS query to remote DNS server on non standard port? rock_ya_baby Linux - Server 8 04-13-2010 04:31 AM
How to configure DNS for a local LAN (at least I think I want DNS) FlyingPenguin128 Linux - Networking 8 12-11-2005 04:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration