Sunteți pe pagina 1din 5

How To Access Your Machines Using DNS Names with DD-WRT

Weve shown you how to statically set the IPs on your network, now lets flip that DNS switch for added elegance and ease of use. Todays guide will show you how to access your machines using DNS names on your DD-WRT enabled router. Image by Henk L

Preface
On our How To Set Up Static DHCP on Your DD-WRT Router guide, weve talked about making sure that your clients will always get the same IP address from the router. So now if you want to access one of the machines on your network, as you know its IP, you can use that but using IPs just doesnt have the same elegance as using names. Also, with the usefulness of static IPs dwindling due to the rise of UPnP, and the inconvenience of setting up static reservations (having to find the MACs and alike) What if you dont want to remember IPs at all? That is where DNS comes in.

The Problem
Your trying to reach from one machine/device on your network to the other using its IP address (using ping for example) and it works. However, when trying to do the same using its hostname like mydesktop or mylaptop? it is a hit and miss sometimes it works. usually it doesnt :\

What is going on?


Your devices dont know who and how they should ask for the name to IP translation, because they are missing a key configuration, the DNS suffix. When a computer needs to translate a name to an IP address (called resolve) it has a couple of ways to do it, one of the ways is to ask a Domain Naming System (DNS) server. However, to be able to do so, the client must ask the question in the form of a Fully Qualified Domain Name (FQDN). An FQDN consists of the hostname like mydesktop and the DNS zone it belongs to like geek.lan. So in our example, the FQDNs for the hosts would be mydesktop.geek.lan and mylaptop.geek.lan respectively. When a client doesnt have the DNS zone at hand, it is unable to ask the DNS about a flat name (a name that doesnt specify the DNS zone). That is, to actually reach your host by name, you would need to ping mydesktop.geek.lan. However, if the DNS suffix was defined in some way (either manually or automatically), the client will automatically try to append it to the requested hostname and ask a DNS server if it can help with the resolve. With that said, if the DNS suffix is not defined, the client does try to find out the name on its own, using a DNS broadcast. The problem with that is that not all clients are configured to answer, or are actually configured to deliberately not answer such a request. In contrast, it would simply be annoying to specify the FQDN every single time.

The solution
In order to have the full infrastructure that will fix this problem, one only needs to set the DNS suffix on the DHCP scope of the *router. Doing so will both make it so the router will now have a dynamic DNS server service that clients can register themselves to, make it so the DHCP service it self will do the same for none-selfregistering hosts and deliver the DNS suffix as part of the DHCP lease given to the clients. Therefore making the entire solution a self sustaining, default behaving solution that solves all the problems in one fail swoop. neat, A? *When using DD-WRT with other routers, your mileage may vary. To do this, go into your routers Administration page:

Go into > Services Change, Used Domain to be LAN & WLAN Choose a Domain name, weve used geek.lan for this example, but you can use *whatever you want. While using Static DHCP reservations is optional for this procedure, if you chose to implement it, it is recommended that you set the hostname, to match the one that is set on the machine/devices OS. Now if it just so happens that the devices OS, doesnt register a name in DNS (like phones) this is a good way to force one on it. Click Save > Apply Settings.

*The one exception to that rule, is that if you use .local, while your windows machines will probably do just fine, your Linux machines will adhere to the mDNS (Multicast DNS) standard and will again ignore the DNS server. There is a workaround, but its beyond the scope of this guide. Now to check that the settings have taken affect, go to the command line and issue an ipconfig. You should see that your DNS suffix is currently none-existing as below:

Issue an ipconfig /release followed by an ipconfig /renew, and you should see something like:

Repeat the procedure on at least one more machine and try pinging, using only the hostname name. You should see that the client has auto-magically understood that the full name of the device youre pinging is hostname.dns.zone, and was able to translate (resolve) the FQDN to a ping-able IP:

Troubleshooting
As this guide is about using DNS like the How to Remove Advertisements with Pixelserv on DD-WRT guide was, If you run into problems there are a couple of things to do:

Clear your personal machines DNS cache. This is because of a DNS cache, that may fool your computer into thinking it already knows the hostname, without consulting the DNS for it. On windows this would be ipconfig /flushdns. Make sure your client is using the router as the DNS and that it resolves the FQDN. Especially when using a VPN or a network that is more complex then the normal router to computer setup, it is possible that your client computer is simply not using the router as its DNS. It is very easy to see using the command nslookup below what is the DNS server the client is using. If the IP is not the same as the

router, you have found the problem.

Thats it you should be all set

S-ar putea să vă placă și