?
Solved

how to find hostname ipaddress and mach address from ubuntu desktop

Posted on 2011-10-14
8
Medium Priority
?
470 Views
Last Modified: 2012-05-12
Dear Experts:
Iam having a network of 150 desktops of windows environment but iam using ubuntu desktop and Iam  looking for the solution to find computer name and the ipaddress assigned for it also the mac address, when i execute arp -a iam getting the message like below:
arp -a
? (192.168.1.5) at 00:09:0f:c4:a7:04 [ether] on eth0
? (192.168.1.192) at 00:50:56:9a:d8:c1 [ether] on eth0
even though there are many desktops in the network which are turned on still only few gets displayed like the above and also hostname is not getting displayed.
with the help of experts i got a for statment when tried executing
for ii in $(seq 1 254)do  ping -c 1 192.168.2.$ii > /dev/null 2>&1  arp -n | grep "^192.168.2.${ii} " | grep -v incompletedone
iam getting the error, posted below for your reference.
for ii in $(seq 1 254)do  ping -c 1 192.168.2.$ii >/dev/null 2>&1  arp -n | grep "^192.168.2.${ii} " | grep -v incompletedone
-bash: syntax error near unexpected token `>'
Please help to find hostname and ipaddress assigned for the host and mac address,
IPADDRESS,HOSTNAME and MAC address

Thanks in advance.
0
Comment
Question by:D_wathi
  • 4
  • 4
8 Comments
 
LVL 35

Expert Comment

by:torimar
ID: 36970034
You will get the hostname via:
$ hostname

Open in new window


and the other info via:
$ ifconfig

Open in new window


In the output, look for "inet addr" and "hw addr" of your networking device
0
 

Author Comment

by:D_wathi
ID: 36970090
Sir, thanks for the reply. Iam looking for the solution how to find out a particular IP address or group of ip address which is known to me and their associated hostname and mac address . but not with the ns lookup as name sever is not there . please help.

1. i know the ip address 192.168.1.75 , only this information i have in the network iam having around 150 desktops among these any one will be this 192.168.1.75 but do not know this ip address belongs to which hostname and its mac address. as name server is not availble hence i will have to find out fro some commands from the ubuntu desktop. please help.
0
 
LVL 35

Expert Comment

by:torimar
ID: 36970189
Sorry for not studying your OP well enough.

Well, this obviously recurs to another question you have already finalized, but which does not seem to produce the required effects. In that case, it would be advisable to ask your question inside the respective old thread, because experts' solutions are expected to work, and if they don't the expert needs to improve them.

You could also post a link to the present thread in the old one, or specify a "related question" when posting the new question, which will send a notification about the new thread to all experts who participated in the old one.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:D_wathi
ID: 36980175
Thank you very much for the help. now everything is work but for the hostname identificaton as per the below:

for ii in $(seq 1 25)
    do
      ping -c 1 192.168.1.$ii >/dev/null 2>&1
      arp -n | grep "^192.168.1.${ii} " | grep -v incomplete
    done

for ii in $(seq 1 25)
> do
>  ping -c 1 192.168.1.$ii >/dev/null 2>&1
> arp -n | grep "^192.168.1.${ii} " | grep -v incomplete
> done
192.168.1.1              ether   00:e0:18:2e:c4:b4   C                     eth0
192.168.1.2              ether   00:13:21:20:e8:76   C                     eth0
192.168.1.3              ether   00:21:5a:eb:45:68   C                     eth0
192.168.1.4              ether   00:30:6e:07:07:72   C                     eth0
192.168.1.5              ether   00:09:0f:c4:a7:04   C                     eth0
192.168.1.7              ether   00:21:5a:eb:45:66   C                     eth0
192.168.1.17             ether   18:a9:05:d1:fe:d3   C                     eth0

-----------------------------------------------------------
Request to please help me only one additional information for the above output that is hostname.
Thanks in advance.
0
 
LVL 35

Accepted Solution

by:
torimar earned 2000 total points
ID: 36983756
As I see it, you are basically looking for the netbios names of those computers, given the fact that in Windows the hostname is a combination of netbios name plus primary dns suffix which - in the same subnet - will be identical for all machines connected.

Did you try nmblookup?
It comes with the Samba suite, which no doubt you will have installed, and it displays the netbios names of  windows machines.
Here's more on what you can do with it: http://www.howtoforge.com/automatic_discovery_mounting_smb_networkshares
0
 

Author Comment

by:D_wathi
ID: 37052087
Thanks for the reply and soultion when executed nnmblookup with the ipaddress of the system which is part of this domain iam getting an message
name_query failed to find name 192.168.1.233.

Attached nmblookup log and smb.conf, please  help.
nmblookup.docx
smb.docx
0
 

Author Comment

by:D_wathi
ID: 37052782
Sir, when i try with nmblookup -A <ipaddress> iam getting the detailed log which gives all , hostname , mac address etc. good. but when executed the nmblookup with ipaddress or nmblookup with -B and ipaddress iam getting other hosts details but for one host winxp which is a memeber of this domain. (iam not this winodws xp system listed) please find previously attached nmblookup.dc and help me why is this is there any changes to be done on smb.conf , have attached the smb.conf as well. Please help
0
 
LVL 35

Expert Comment

by:torimar
ID: 37053033
If nmblookup works fine with all hosts except one then this obviously means that Samba is configured correctly, but the one problematic host probably is not. So its not the smb.conf on the server that needs checking, but the client configuration on that computer (192.168.1.233).
 
Are you sure its configuration is identical to the others? Are there firewalls maybe which could block the name lookup? Can the problematic host be queried and addressed from other machines in the network?

I'm sorry, but I don't have more time to look into this today. It's sunday, and I'm on my way to see my family.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introducing Priority Question, our latest feature.
A new hacking trick has emerged leveraging your own helpdesk or support ticketing tools as an easy way to distribute malware.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Suggested Courses
Course of the Month15 days, 2 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question