18

I have used arp-scan in terminal to get the ipaddress as well as mac address, is there anyway i can get to know the hostname of the ipaddress that are there in the terminal? for example there are A-pc and B-pc and C-pc connected to the same router. I need to get the hostname the same way i got the result in arp-scan. Is there any command? please reply to this. Thank you.

PS: I dont want to use wireshark or any other s/w. It would be helpful if there was a terminal command.

0

4 Answers 4

14

Assuming you have a local DNS server set up, dig should do

dig +short -x 123.456.789.12

(Yes, that's not a valid IP, it's a Hollywood IP)

12

try nslookup

Note: All tools require a DNS that have a reverse lookup zone. (the default is forward lookup zone only). This is why it will work on most external domains (internet) because they are registered in DNS all over the internet. for internal network you need an internal DNS reverse lookup server. check the following link

3

To get the hostname from the IP address. The simplest way is to use the “host” utility . Just run…

# host 64.233.187.99
output is: #99.187.233.64.in-addr.arpa domain name pointer jc-in-f99.google.com.

This will query the name server and provide you with the hostname of the IP address.By default it will query the nameserver listed in the /etc/resolv.conf file.

2
  • i saw this in some site, but this doesnt give you the details of the pc connected to my modem/router right? like i am at 192.168.1.2 and i cant know a pc at 192.168.1.3
    – thanmai
    Sep 26, 2012 at 10:55
  • 1
    No , you can know but you must have a DNS rsolver. In the output you can see that it gives the hostname of the ip which belongs to google
    – user61928
    Sep 26, 2012 at 10:57
2

I'm assuming you want the netbios name?

sudo apt-get install nbtscan
echo will scan: $(hostname -I | cut -d ' ' -f 1)/24
nbtscan $(hostname -I | cut -d ' ' -f 1)/24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .