Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a LAN at home sitting behind the router (Linksys WRT54G). The IP addresses assigned to the Linux boxes are

  • 192.168.0.101
  • 192.168.0.102
  • 192.168.0.103

The Router is also connected to the modem provided by my ISP, to access the internet. Now, the router is assigned the IP address 192.168.0.1 and is also configured to start assigning IP addresses starting from 192.168.0.100 using DHCP protocol.

Now I have an application which requires to have FQDNs (Fully Qualified Domain names) for like each machine - something like

  • phx1.mylocalnet.com
  • phx2.mylocalnet.com
  • phx3.mylocalnet.com

Is this possible to do?

share|improve this question
add comment

migrated from stackoverflow.com Jul 8 '11 at 9:28

This question came from our site for professional and enthusiast programmers.

4 Answers

… or you could keep all of your machines with dynamically-assigned addresses, and:

  • have local DNS servers providing split horizon DNS service, with all of your DHCP clients configured to register themselves with the local content DNS server when they obtain leases off the DHCP server; or
  • have local DNS servers, again providing split horizon DNS service, and a DHCP server (ISC's DHCP server for one can do this. Your router's DHCP server probably cannot.) that registers name→address mappings itself with the local content DNS server, directly, so that the DHCP clients don't have to.

The second has the considerable advantage that one only needs to give the DHCP server permissions to perform DNS updates, not every machine on the entire LAN. But it does lock you in to particular vendors' DNS servers. BillThor mentions dnsmasq, which is one of a few softwares that is both content DNS server and DHCP server all in one.

share|improve this answer
add comment

Look at dnsmasq to serve up DNS and cache DNS results. You can install this on one system and edit /etc/resolv.conf for other hosts. You can either use dnsmasq to replace your router as the DHCP server, or assign static addresses. For servers I would assign fixed addresses, client are fine either way.

share|improve this answer
add comment

First, you need to start by assigning them static IP addresses, or if your router supports it, you can give them a reserved IP address using your DHCP server. I would just assign them IP addresses out of the DHCP Server's range, like 192.168.0.21-23. This is so the IP addresses will not change, and break the next step. The other poster did not mention this.

Then, unless you want to also set up a DNS server (I agree with the other poster: Overkill), you will need to add the entries to the HOSTS file as he said.

share|improve this answer
add comment

There's several ways to do it, one being to setup one of your machines to be your nameserver (and have it tell your network phx1.mylcoalnet.com is 192.168.0.101, etc). This is a less hack-ey approach, but it's harder to implement and might be overkill.

An easier approach, would be just tricking the machine that hosts the FQDN-application using a hosts file (it exists on both Linux and Windows under /etc/hosts and Windir\system32\drivers\etc\hosts). If required, you could even add those same entries on all machines on your network.

This assumes my understanding of the issue is correct, and you do not actually have a real domain you'd like to use. If I've misunderstood you, then the solution would still be the first one, except you'd want to set that NS to be the primary nameserver for your domain.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.