LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-06-2016, 07:39 PM   #16
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449

Type in terminal, try it:

Quote:
nbtscan 192.168.1.101-192.168.1.151
 
Old 08-07-2016, 05:35 AM   #17
mangya
Member
 
Registered: Jul 2015
Distribution: CentOS
Posts: 89

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by JJJCR View Post
Type in terminal, try it:
It only identifies Windows machine in network. The command didn't even find hostname of machine from which it was executed (ubuntu), even though, hostname is specified in /etc/hosts file.

Code:
$ sudo nbtscan -r 192.168.1.0/24
Thanks anyway... at-least I get Windows hostname. Sad there is no such command to get hostnames of *nix machines.

Last edited by mangya; 08-07-2016 at 05:36 AM.
 
Old 08-07-2016, 07:20 AM   #18
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Do you have home router? If yes, add static dhcp entries for your machines indicating their hostnames, then done

Getting windows netbios name is usefull for a netbios connection but it's not neccessarly the same name as a dns name assigned to this machine
 
Old 08-07-2016, 05:41 PM   #19
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
Question

Quote:
Originally Posted by mangya View Post
It only identifies Windows machine in network. The command didn't even find hostname of machine from which it was executed (ubuntu), even though, hostname is specified in /etc/hosts file.

Code:
$ sudo nbtscan -r 192.168.1.0/24
Thanks anyway... at-least I get Windows hostname. Sad there is no such command to get hostnames of *nix machines.
type /etc/resolv.conf

post back the settings.
 
Old 08-08-2016, 01:51 AM   #20
mangya
Member
 
Registered: Jul 2015
Distribution: CentOS
Posts: 89

Original Poster
Rep: Reputation: Disabled
Code:
# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
search nix.lan

# cat /etc/hosts
127.0.0.1	localhost
127.0.1.1	ubu.nix.lan	ubu

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

# Physical Devices:
192.168.1.1 rtr.nix.lan rtr
192.168.1.7 ubu.nix.lan ubu
192.168.1.8 mob.nix.lan mob

# Virtual Machines
#192.168.1.100 c72.nix.lan c72
192.168.1.101 u16.nix.lan u16
192.168.1.102 w10.nix.lan w10

# nmap -sn 192.168.1.* | grep report
Nmap scan report for rtr.nix.lan (192.168.1.1)
Nmap scan report for mob.nix.lan (192.168.1.8)
Nmap scan report for 192.168.1.100
Nmap scan report for w10.nix.lan (192.168.1.102)
Nmap scan report for ubu.nix.lan (192.168.1.7)

# nbtscan -r 192.168.1.0/24
Doing NBT name scan for addresses from 192.168.1.0/24

IP address       NetBIOS Name     Server    User             MAC address      
------------------------------------------------------------------------------
192.168.1.0	Sendto failed: Permission denied
192.168.1.7      <unknown>                  <unknown>        
192.168.1.102    VM-WIN10         <server>  <unknown>        08:00:27:79:f1:6a
192.168.1.255	Sendto failed: Permission denied
Attached Thumbnails
Click image for larger version

Name:	nm.png
Views:	10
Size:	48.7 KB
ID:	22681  

Last edited by mangya; 08-08-2016 at 02:10 AM.
 
Old 08-08-2016, 02:36 AM   #21
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
basically you don't have a DNS server in your environment, that's why you're not able to resolve host names of *nix machines.

Install dnsmasq, as previously suggested before by one of the respondents in this post.

Check out this link on how to do it: http://blogging.dragon.org.uk/howto-...q-as-dns-dhcp/

Where do you get DHCP? Is it in your router?

If it is in your router and you don't want to waste time installing dnsmasq then configure hostnames on your router and point /etc/resolv.conf to the IP Address of your router.
 
Old 08-08-2016, 03:11 AM   #22
mangya
Member
 
Registered: Jul 2015
Distribution: CentOS
Posts: 89

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by JJJCR View Post
basically you don't have a DNS server in your environment, that's why you're not able to resolve host names of *nix machines.

Install dnsmasq, as previously suggested before by one of the respondents in this post.

Check out this link on how to do it: http://blogging.dragon.org.uk/howto-...q-as-dns-dhcp/

Where do you get DHCP? Is it in your router?

If it is in your router and you don't want to waste time installing dnsmasq then configure hostnames on your router and point /etc/resolv.conf to the IP Address of your router.
I get ip addresses from router's dhcp.

In an organised network setup, relation between hostnames and their corresponding ip addresses can be maintained in /etc/hosts, dnsmasq or dns server. But what if, the local network is not organised properly? Assuming I've been called to rectify some problem in someone else's network, and i have to do some survey to find out what is what?

The command 'nbtscan' returns hostname of any MS-Windows machine - even though it is not specified anywhere. I was looking for similar investigative command that will figure out hostname of linux machine irrespective of it mentioned anywhere or not.

All the commands, I presume will depend on some other files to figure-out the hostname of linux machine. The target machine is sure - not the one, that will tell its hostname to others.

I guess there is no such command.

Thanks
 
Old 08-08-2016, 04:45 AM   #23
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
nbtscan only tells you the hostname of a machine with netbios...

Thus only Windows machines that have had their name set will return the name, as that is part of the netbios protocol.

A "hostname" has nothing to do with a network identity. It is only a convention that the host name is associated with a TCP/IP number - and that name doesn't have to match the hostname.

I have had hosts with up to 4 different names - one for each network interface. The names then had name-eth0, name-eth1, name-eth2 name-eth3. But none had "name", as that made no sense. In other setups we had an admin net, SAN, and public net. But it was just a convention.

Having a single name for a host only works if you only have a single network interface...

Last edited by jpollard; 08-08-2016 at 04:47 AM.
 
1 members found this post helpful.
Old 08-08-2016, 04:59 AM   #24
mangya
Member
 
Registered: Jul 2015
Distribution: CentOS
Posts: 89

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
A "hostname" has nothing to do with a network identity. It is only a convention that the host name is associated with a TCP/IP number - and that name doesn't have to match the hostname.
That makes sense. Thanks for clarifying.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Hostname does not persist on LAN int0x80 Linux - General 3 12-07-2011 09:41 AM
lan connection between linux machine and windows machine arunsan842004 Linux - Laptop and Netbook 1 11-25-2008 05:44 AM
machine has adsl ethernet modem, to make it gateway over lan do i need more lan cards b0nd Linux - Networking 2 10-04-2005 10:19 PM
How do i use a hostname given by No-IP as my machine name? z-vet Linux - Networking 3 10-22-2004 08:06 PM
How to get another machine's hostname? afpe Linux - Networking 4 01-27-2003 07:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration