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 cisco router by which I connect my 2 pcs running ubuntu to the internet. I get the ip address by DHCP. When I check the list of pcs connected to the router, the router admin page shows ip addresses alongside hostnames. It seems that by using DHCP the router has somehow been able to catch the hostnames from "/etc/hostname" or /etc/hosts", am I right? The thing is that if I change the name of my pc by editing the file "/etc/hostname" and even "/etc/hosts", the router still stores the previous hostname, even when reset, how can I make the router store the updated hostname?

On the other hand, how can I find out the hostnames of the computers connected to my network? nmap doesn't seem to do the job. Do I have to set up a domain for all the computers in the network? How could I do this?

share|improve this question

3 Answers 3

There are a few ways that the router could know about the name of computers connected to it.

  • NetBIOS
  • DNS, if the router is running an internal DNS service.
  • The DHCP server could also store it, as the name of the system request a DHCP lease is part of the requesting process.

There are some others by the probably are not worth noting, like WINS.

As for finding the names of systems on your network you can use a tool called nbtscan.

share|improve this answer

When your PC is turned on, it uses the DHCP protocol to request an IP-address and network settings, part of the information provided by the PC is it's name. The DHCP server remembers this and adds it to it's internal DNS database. This works when the same computer (your Cisco router) acts as both DHCP and DNS server.

See DHCP (Dynamic Host Configuration Protocol) Basics

 DHCPREQUEST 
 …
 DHCP: Host Name              = JUMBO-WS

Or MS Technet: Appendix D: DHCP Packets

DHCP Request

The remainder of the frame (300 or 548 bytes) is the DHCP Discover portion. Its details include:

- The Host Name - lists the computer name of the client computer.

share|improve this answer

Well, the router itself has a list of hostnames. For some routers, they are actually running a version of linux themselves. Typically, a router will find a set of hostnames through a DNS resolution protocol:

http://en.wikipedia.org/wiki/Domain_Name_System

share|improve this answer
    
I'm sorry, I didn't realize until after I posted what you were actually asking. Take a look at this post: fixunix.com/networking/… You may need to setup a DNS server if you want to control how the names are resolved on your local network. –  jwir3 Nov 8 '12 at 17:17
    
Basically, what's probably happening is that the DHCP server is getting the hostname from the clients when they request an address. As such, the hostname (along with the IP address) is cached until the DHCP expires. Try manually expiring the DHCP leases and see if you get new hostnames, after changing the hostname on the local machine. –  jwir3 Nov 8 '12 at 17:19

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.