Jason Adams's picture


Just to get it out of the way: Yes, I'm very new — though less new than I was two months ago! Go Linux!

Anyway, I have LAPP installed and running on a local server. Other folks use a Web Application I made and installed on the server, and it runs great. But I'd like them to be able to access it from the host name, and not the IP (albeit it is static). For the life of me, I can't figure how to do this either from Webmin or the command line.

Help? :)

Jeremy Davis's picture

I have found that the best and most reliable way is to set up a local DNS server. I have one running as a VM and it works well.

Another option is to just add an entry to the hosts file of each PC that uses it.

I have found using hostnames without DNS (eg WINS) to be very flakey and unpredictable in the past and abandoned it some time ago. Although perhaps newer routers are better at passing on WINS requests?

Jason Adams's picture

Thanks Jeremy! I'm downloading the turnkey core, I'll install bind9 to that, and go from there.

If I set up a local domain, I assume I have to set up the DNS address for the server on every machine I plan on using the domains on. And, out of curiosity, if I were to set up (as illustration) Google.com, and my DNS server is first on the DNS list, would I effectively redirect them to the local address? I'm essentially overwriting global domains locally, am I not?

Thanks again!

Jeremy Davis's picture

But you can forward requests to your existing (external) DNS provider so any addresses your server doesn't recognise it will forward on (so your users can still use google for example).

If your other users are currently getting their IPs via DHCP then you can also set up your DNS server as DHCP and give them your DNS IP address automatically (but don't forget to disable the existing DHCP if you do that).

Also I notice from your post on the TKL-PVE-OVZ announcement that you are using Proxmox. IIRC if you install BIND to a OVZ container, you'll have to use bridged networking (veth) for BIND to work properly (it won't start if using venet).

Also FYI there is a BIND Webmin module in the TKL repo if you're interested, IIRC it should install like this:

apt-get install webmin-bind8

(Don't worry it works fine with BIND9)

Jason Adams's picture

Thanks for the heads up on the webmin. I installed it and, pathetically, can't seem to find how to access it — rest assured, it's there somewhere.

Honestly, I'm finding there's a much steeper learning curve to setting up a DNS server than I'd anticipated. I'm hunting through various resources like the HOWTO, but confess that much of the commands are Greek to me. Intuitively I follow what you're saying, but putting that into action is proving to be a bit more difficult than previously hoped.

I can't seem to find it, so how does a DNS server fit into a network? It sounds like routers much have an internal DNS server, which handles the DHCP designation. So I would set the router to static and have the DNS Server manage the DHCP itself? In my mind, DNS servers proceed IP designation; but this suggets it preceeds it? I assume the router remains as the Gateway?

I think what's really killing me is the muddleness as to the order of operations, and what performs which operations when? How does the DNS Server both assign a DHCP address to a machine and bind the address to a domain name?

If the person who answers all those questions lives in the Detroit area, I owe them a drink. ;)


Edit: You were correct in how I intalled the core as an OpenVM. And I quickly figured out I needed to use a bridged network card, so I am. So does this mean I'm sharing an IP with the Proxmox VE or need to assign a unique one elsewhere? Trying the access the webmin on port 10000 on the proxmox IP doesn't work.

Jeremy Davis's picture

With mention of DHCP. There actually isn't any need to set up your own DHCP server. Most consumer grade routers include a DHCP server so you can probably just add your DNS to that (as the first option). The only reason I do this is because I have found DHCP on consumer grade router/modems to be flakey at times (although no doubt that depends on the quality of the hardware you have - mine is all cheapo!). So creating a DHCP server is optional.

The Webmin module should appear under servers IIRC. In mine it's called "BIND DNS Server". But perhaps you need to restart Webmin (I don't recall)?

Now to clarify a few things for you:
DNS - turns urls into ip addresses. It's as simple as that! So when you type in a url your computer queries a DNS server so it can connect to an IP. In most home and SOHO useage scenarios a consumer grade router provides basic caching of DNS and forwards and DNS requests not cached to your ISP's DNS servers (or another public DNS server). DNS servers are sometimes also referred to as nameservers (AFAIK the terms are completely interchangable).
DHCP - allocates an IP to your PC (unless it has a static IP already set, then DHCP is irrelevant). Your DHCP server will also provide the IP of your DNS server and your internet gateway. Again in home and SOHO useage scenarios the consumer grade router provides DHCP. It is also often provides the internet gaeway (assuming that it is a router/modem) as well as a DNS cacher/forwarder (as mentioned above).

So here is the workflow I would suggest for you:

  1. Install and configure your basic DNS server VM. You will need to configure your DNS server to have a static IP (by default veth will get your VM a dynamic IP via your existing DHCP server - probably your router/modem). The easiest way to do that is using the TKL confconsole (lauch with the 'confconsole' command).
  2. Test by manually configuring your desktop with a static IP and pointing DNS requests to your new DNS server VM. The nslookup commandline utility is very useful for testing your nameserver. It is available for Win and Linux. If you wish to configure all the clients manually with static IPs and point DNS to your new server you can stop here (ie ignore steps 3+).
  3. Once you have it all working as you'd like, then adjust the configuration of your existing DHCP server (probably in your router/modem) to provide the IP of your new DNS server. (May require a router restart to stick).
  4. Reset your PC to use DHCP and test that it works as expected. In Win this may require reboot, in Linux just restart networking. I'd also test from other PCs to ensure it's working for everyone.
  5. (Optional) Set up DHCP (either on your DNS server or in a new VM). You need to make sure you disable any existing DHCP servers on the network (you can only have one per network...) Some router/modems do DHCP relaying (to your DHCP server) and this seems to work well in my experience.

As for the specifics of setting up your DNS server, I set my BIND/DNS server up ages ago (it's a v2009.x TKL Core appliance) so I'm a little rusty on how I set it all up. I do recall that I initially set it up manually (copy and paste was easier than setting it all up through Webmin IMO) but I now use the Webmin interface to update it and add clients. I don't recall where I got my info from when I set it up, but I would suggest a more simple tutorial like this one on Ubuntu forums. This Ubuntu wiki page may also be useful (although I only had a quick glance).

Good luck and let us know how you go.

Add new comment