How to resolve local domain name?

My Belkin router has an option to set a local domain name, which, I suspect, allows me to address hosts within my own network using this domain. By default, this is set to be "Belkin".

Is it possible to call hosts within my network like this, e.g. ping foobar.belkin instead of ping 192.168.2.4?

The thing is, my routers internal page shows all set hostnames (so dhclient seems to work) and the router itself is reachable as router.belkin, but no other hosts are.

My problem here is that the router knows each hosts name, but the hosts don't know each others name. How can I fix that?

Note: Nmap showed that port udp/53 for DNS is open on my router, but I can't find any way to configure it on the Web-interface.

Add:// It's a "Belkin F7D3302 v1"

4

7 Answers

In general the router won't act as a DNS server but they'll often act as a DNS proxy. That is, in DHCP they'll give out their own IP as the DNS server and then they'll turn around and hit the real DNS servers. If it's doing this then I'd think you could resolve those local, .belkin, names.

Check ipconfig /all and see if the Default Gateway and DHCP Server have the same IP. If not then enter nslookup, then enter "server ROUTER_IP" at the prompt and try to do a lookup on google.com. If that works then there's probably a setting in the router to have it give it's own IP as the DNS server that's not checked.

If the machines on your LAN run a relatively modern operating system, then you can access them by appending ".local" to their host name, like this :

ping MACHINE_NAME.local

To get the name from a given IP, use

avahi-resolve-address MACHINE_IP

To see all connected machine names and IPs on the local network, use something like this BASH command :

px-lan-scan () { LOCAL_MASK=$(ip -o -4 addr show | awk -F '[ /]+' '/global/ {print $4}' | cut -d. -f1,2,3) GATEWAY=$(route -n | \grep '^0.0.0.0' | awk '{print $2}') if [ $1 ] ; then range=$1 ; else range="10" ; fi for num in $(seq 1 ${range}) ; do IP=$LOCAL_MASK.$num if [[ $IP == $GATEWAY ]] ; then MACHINE="gateway" ; else MACHINE=$(avahi-resolve-address $IP 2>/dev/null | sed -e :a -e "s/$IP//g;s/\.[^>]*$//g;s/^[ \t]*//") ; fi ping -c 1 $IP>/dev/null if [ $? -eq 0 ] ; then echo -e "UP $IP \t ($MACHINE)" ; else echo -e "DOWN $IP" fi done
}
4

Sure, this is what I do with my router at home.

Your router should be able to do this as long as you have its DNS serving abilities turned on so that it processed DNS requests for the your LAN for that domain (it'll forward requests for other domains to your usual DNS servers such that your web browsing isn't broken on the clients).

You need to make each client use the router for their DNS lookups, which they likely will out the box assuming you're also using DHCP.

4

The short answer is (for the most part) no. Your router (in most cases) is not a dns server. You can however set static entries for all of your devices and then add them to your host list within the given devices.

The Belkin F7D3302 does not support serving DNS.

3

I've had the exact same problem.

The problem seems to be that if you try to address a local host name, the router automatically appends ".belkin" assuming belkin is what you have set as your local domain name. Changing it to something else will not solve the problem and you can't leave this blank.

As xaccrocheur said above, most modern OSs will access most things by appending .localSo... I have done a sort of work-around which works well with most of my machines. I changed the Local domain name setting on the router to local

I can now access MOST devices by host name only

Install and configure dns server within the local network, register it on all hosts, enter the internal dns server first in the list of dns servers on the Belkin router. Then you will have what you want.

3

While I do not suggest doing this, it would give you the desired result (being able to ping local hostnames without setting up a separate DNS server)

  1. On your primary computer, browse to C:\Windows\System32\drivers\etc
  2. open the hosts file using notepad
  3. scroll to the bottom of your hosts file
  4. add a new line below the last commented line in the file that looks like this

192.168.2.1 router.belkin

192.168.2.2 hostname

192.168.2.3 hostname2

Save the hosts file.

Now try to ping hostname and hostname2, you should see the following

ping hostname2
Pinging hostname2 [192.168.2.3] with 32 bytes of data:
ping hostname
Pinging hostname2 [192.168.2.2] with 32 bytes of data:

Again, this is not how I would do it. I would opt to setup a DNS server myself, but if you do not have that option this is a quick and dirty alternative.

Oh dont forget if you plan on doing this, add yourself to the security permissions on the hosts file so you can write to the file. Also do not forget to copy this hosts file to all of the other machines on your network.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like