Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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.
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...
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.