Как удаленно узнать имя хоста Linux без использования DNS?

31007
JohnnyFromBF

Если я хочу узнать, как называется имя хоста удаленного Linux-компьютера в моей локальной сети, как я могу добиться этого, если у меня нет доступа через SSH и т. Д.?

Вероятно, зависит, если Linux является частью домена WINS, я полагаю.

6
Какая информация у вас есть? David Schwartz 11 лет назад 0
Только IP-адрес машины. JohnnyFromBF 11 лет назад 0

3 ответа на вопрос

5
barbaz

You'd have to specify the term hostname more closely. If you are looking for the name as it is known to the DNS server that you don't want to use - there is no way of knowing except for actually asking that DNS server.

If you are simply guessing, nmap can be of good use. For example, if there is a smbd running on that server, the output of nmap -A might look like this:

Host script results: | smb-security-mode: | Account that was used for smb scripts: guest | User-level authentication | SMB Security: Challenge/response passwords supported |_ Message signing disabled (dangerous, but default) |_smbv2-enabled: Server doesn't support SMBv2 protocol |_nbstat: NetBIOS name: FOOBAR, NetBIOS user: <unknown>, NetBIOS MAC: <unknown> | smb-os-discovery: | OS: Unix (Samba 3.5.6) | Computer name: foobar | Domain name: lan | FQDN: foobar.lan | NetBIOS computer name: |_ System time: 2013-03-14 17:02:27 UTC+1 

Other services might give hints about the name of the machine as well.

Это было бы решением, конечно, это зависит от того, кто слушает кого-то. JohnnyFromBF 11 лет назад 0
2
terdon

In the absence of a DNS server, this might work:

traceroute 1.2.3.4 

Alternatively, if the server in question is exporting Samba shares, you could do this:

smbclient -L 1.2.3.4 

This depends on whether you have a working DNS server set up on your LAN that has the necessary information. If it does, this command should do what you need:

nslookup 1.2.3.4 

or

host 1.2.3.4 

Finally, another useful command is

arp -a 
Там нет DNS-сервера .. JohnnyFromBF 11 лет назад 0
@ Ян, да, я наконец прочитал заголовок, а не только текст твоего вопроса, и понял это. Сожалею. В любом случае, опции `traceroute` и` smbclient` могут работать. terdon 11 лет назад 0
traceroute также использует DNS для разрешения имен barbaz 11 лет назад 2
@barbaz спасибо, не был уверен в этом. terdon 11 лет назад 1
2
Ярослав Рахматуллин

Fingerd (and xinetd) are easy to set up and require no maintenance.

$ finger root@10.3.0.3 [10.3.0.3:79] Welcome to Linux version 3.5.7-12-tryggve at tryggve.lan ! (...)