Link to home
Start Free TrialLog in
Avatar of Goutham
GouthamFlag for India

asked on

how to find hostname ipaddress and mach address from ubuntu desktop

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.
Avatar of torimar
torimar
Flag of Germany image

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
Avatar of Goutham

ASKER

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.
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.
Avatar of Goutham

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of torimar
torimar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Goutham

ASKER

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
Avatar of Goutham

ASKER

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
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.