- How to Find a Hostname for an IP Address
- Related
- Querying DNS
- Without DNS
- How to find IP Address from hostname in Windows Linux and Unix
- Finding IP address from hostname in UNIX and Linux
- 1) IP address using hostname command in Unix/Linux
- 2) IP address using ping command in UNIX or Linux
- 3) IP address using nslookup command in UNIX or Linux
- 4) How to find the IP address using the ifconfig command
- IP Address from hostname in Windows Linux and Unix
- Now, let’s see some examples to convert hostname to IP address in Windows, Linux, and other UNIX based systems.
- 1. How to find the IP address of your computer in Windows
- 2. How to find the external IP address of your network or computer
- 11 comments :
- Resolve host name to an ip address
- 5 Answers 5
- Get hostname from MAC address on Windows
- 3 Answers 3
- hosts — файл трансляции доменных имен в сетевые адреса узлов — IP-адреса
- Файл host — имена узлов в IP-адреса
- OS Windows — файл hosts
How to Find a Hostname for an IP Address
Related
You can find the hostname of any computer with a public IP address by passing the address to any Domain Name System (DNS) server. However, since the computers on a small business network have private IP addresses, you can only discover their hostnames if the network has a local DNS server. To discover the hostname of a computer with a private IP address and no local DNS server, you need to use a Windows utility to query the host itself.
Querying DNS
Click the Windows Start button, then «All Programs» and «Accessories.» Right-click on «Command Prompt» and choose «Run as Administrator.»
Type «nslookup %ipaddress%» in the black box that appears on the screen, substituting %ipaddress% with the IP address for which you want to find the hostname.
Find the line labeled «Name» underneath the line with the IP address you entered and record the value next to «Name» as the hostname of the computer.
Without DNS
Click the Windows Start button, then «All Programs» and «Accessories.» Right-click on «Command Prompt» and choose «Run as Administrator.»
Type «nbtstat -A %ipaddress%» at the command prompt in the black window that opens, substituting the IP address for «%ipaddress%.»
Review the results and find the NETBIOS table. Locate a row where the type is «UNIQUE» and find the hostname of the computer in the «Name» column for that row.
- The Group entry from the «nbtstat» approach tells you the name of the computer’s workgroup.
- The «nbtstat» utility requires NETBIOS on the local network.
Steve McDonnell’s experience running businesses and launching companies complements his technical expertise in information, technology and human resources. He earned a degree in computer science from Dartmouth College, served on the WorldatWork editorial board, blogged for the Spotfire Business Intelligence blog and has published books and book chapters for International Human Resource Information Management and Westlaw.
How to find IP Address from hostname in Windows Linux and Unix
Finding IP address from hostname in UNIX and Linux
1) IP address using hostname command in Unix/Linux
2) IP address using ping command in UNIX or Linux
/test ping trading_system
3) IP address using nslookup command in UNIX or Linux
/test nslookup trading_system
4) How to find the IP address using the ifconfig command
IP Address from hostname in Windows Linux and Unix
Now, let’s see some examples to convert hostname to IP address in Windows, Linux, and other UNIX based systems.
1. How to find the IP address of your computer in Windows
2. How to find the external IP address of your network or computer
11 comments :
Incoming Search term
lan ping determine ip of hostname
get hostname ip addresses java linux
get ip from hostname linux
search hostname of a machine
how to find hostname unix hostname
how to get computername from ip address
how to find ip for hostname in lan
how to find hostname on linux
display hostname ip address
find ip address from hostname in windows
finding remote computer name linux
get ip address from hostname windows
get ip from hostname windows
get the exact ip address via ifconfig for a specific device in windows
host name to ip windows
how to find ip address and host name
how to find ip address in unix
how to find ip address of an hostname
linux find address for host name
unix command to my ip address
unix find ip from hostname
bash script for ip address from hostname
December 2, 2011 at 7:27 AM heera said.
Thanks . I was looking for exact same information, command to find hostname from ip address. we have linux machines in our lan network and I just joined. this unix tips will surely help me lot.
December 4, 2011 at 11:57 PM unixman said.
hostname -i will not work to find IP address of another computer, it will only work for current host. I think only available option to get IP address of another computer is «nslookup»
December 5, 2011 at 8:56 PM Anonymous said.
how to check the loction of my friend while chatting.
please help me one of my friend told me he is in us but i think he is telling lie so please help me to guess from where he is calling .
send the answer at papadonpart2@gmail.com
January 3, 2012 at 5:22 AM Jimm said.
how to find IP address in Unix operating system which doesn’t have nslookup command ? is there way to determine IP address without using nslookup
January 10, 2012 at 5:15 PM King said.
Thanks for this. i was looking for this «nslookup» command
May 30, 2012 at 2:05 AM Anonymous said.
Hello Javin, How will you convert an IP address to Hostname in Java? Can you please write about that? Thank you sir.
July 17, 2013 at 11:15 PM Samir said.
I am using linux system for my office work first time even though I have hosted all my website at linux hosting servers. There are few things I should have learned before like you let us know about ip host, pinging commands at linux system. I am a fast leaner yet I think it will take a month to get used to it as always typed wrong command and right click is something which we always used at windows.
July 24, 2013 at 1:38 AM Anonymous said.
You can also use ‘host’ command to display IP address associated with any DNS name (or hostname). It’s a DNS lookup utility similar to nslookup but it doesn’t print name of DNS server used to resolve addresses. In fact, host command output is much cleaner than nslookup, you will see something like this
host yahoo.com
yahoo.com has address 130,.40.23.19
yahoo.com has address 130,.40.23.29
It will print all IP address associated with a DNS name and registered in DNS server.
August 4, 2015 at 8:03 PM Anonymous said.
@Anonymous, indeed I would prefer host and nslookup any day than other commands, but you should aware that there is something called nscd which keeps a cache of most used queries on naming server. If a host got IP address change but still resolving to old IP address then this is one place you should check. Sometime name server can also be faulty.
Resolve host name to an ip address
I developed a client/server simulation application. I deployed client and server on two different Windows XP machines. Somehow, the client is not able to send requests to the server.
I tried below options:
Pinged server machine successfully from client using ip-address.
Pinged client machine successfully from server using ip-address.
Checked netstat command line tool from both machines. Server is in LISTENING mode and client is in SYS_SENT mode. But the foreign address it is using to send is host name not the ip address.
Pinged server machine unsuccessfully using host name from client.
Pinged client machine successfully using host name from server.
I feel the problem is when the client is trying to connect to the server using the host name.
Could you please let me know how to force an application to use an ip address instead of a host name? Is there any other way to map the host name to an ip address?
5 Answers 5
Go to your client machine and type in:
substituting the real host name of your server for server.company.com , of course.
That should tell you which DNS server your client is using (if any) and what it thinks the problem is with the name.
To force an application to use an IP address, generally you just configure it to use the IP address instead of a host name. If the host name is hard-coded, or the application insists on using a host name in preference to an IP address (as one of your other comments seems to indicate), then you’re probably out of luck there.
However, you can change the way that most machine resolve the host names, such as with /etc/resolv.conf and /etc/hosts on UNIXy systems and a local hosts file on Windows-y systems.
Try tracert to resolve the hostname. IE you have Ip address 8.8.8.8 so you would use; tracert 8.8.8.8
You could use a C function getaddrinfo() to get the numerical address — both ipv4 and ipv6. See the example code here
This is hard to answer without more detail about the network architecture. Some things to investigate are:
- Is it possible that client and/or server is behind a NAT device, a firewall, or similar?
- Is any of the IP addresses involved a «local» address, like 192.168.x.y or 10.x.y.z?
- What are the host names, are they «real» DNS:able names or something more local and/or Windows-specific?
- How does the client look up the server? There must be a place in code or config data that holds the host name, simply try using the IP there instead if you want to avoid the lookup.
Windows XP has the Windows Firewall which can interfere with network traffic if not configured properly. You can turn off the Windows Firewall, if you have administrator privileges, by accessing the Windows Firewall applet through the Control Panel. If your application works with the Windows Firewall turned off then the problem is probably due to the settings of the firewall.
We have an application which runs on multiple PCs communicating using UDP/IP and we have been doing experiments so that the application can run on a PC with a user who does not have administrator privileges. In order for our application to communicate between multiple PCs we have had to use an administrator account to modify the Windows Firewall settings.
In our application, one PC is designated as the server and the others are clients in a server/client group and there may be several groups on the same subnet.
The first change was to use the functionality of the Exceptions tab of the Windows Firewall applet to create an exception for the port that we use for communication.
We are using host name lookup so that the clients can locate their assigned server by using the computer name which is composed of a mnemonic prefix with a dash followed by an assigned terminal number (for instance SERVER100-1). This allows several servers with their assigned clients to coexist on the same subnet. The client uses its prefix to generate the computer name for the assigned server and to then use host name lookup to discover the IP address of the assigned server.
What we found is that the host name lookup using the computer name (assigned through the Computer Name tab of the System Properties dialog) would not work unless the server PC’s Windows Firewall had the File and Printer Sharing Service port enabled.
So we had to make two changes: (1) setup an exception for the port we used for communication and (2) enable File and Printer Service in the Exceptions tab to allow for the host name lookup.
Get hostname from MAC address on Windows
How can I Get Hostname from IP address/MAC address on Windows? (Win7, if it’s version dependent)
I know that arp -a will give me a table of IP and MAC. Is there something similar for Hostname and MAC/IP?
3 Answers 3
If you start with a MAC address, you first need to get the IP address. This means that you need access to a device that has the IP address associated with the MAC. As per the question, arp -a will list the MAC addresses and corresponding IP addresses. In order to populate that list, the machine will have had to at some point issued an arp request, saying «who has IP x.x.x.x» — the owner will reply and upon receipt, the arp table will be populated.
In order for this to work, both devices must be on the same layer 2 network — the same switch/vlan. You can trigger arp requests manually by pinging every IP on the network, or using a utility like nmap to do them all in one go.
Once you have the IP address, you are relying on a name resolution service to do a reverse lookup and return a hostname that is associated with an IP.
In DNS this is achieved through PTR records. For each IP address, there is a PTR record in which is stored the associated hostname. However, there is no obligation to store PTR records so they may not be present, in which case the lookup will fail.
They look like this:
The IP address in the PTR record is reversed. So to get the hostname of 10.11.12.13, we say to DNS «Give me the PTR record for 13.12.11.10.in-addr.arpa.»
It returns the above record. You can achieve this in by doing
When nslookup is given an IP address, it will try to do a PTR lookup.
As per the other reply, if the IP belongs to a Windows machine, you can also do nbtstat -A 10.31.46.59 (note the uppercase -A)
hosts — файл трансляции доменных имен в сетевые адреса узлов — IP-адреса
Файл host — имена узлов в IP-адреса
OS Windows — файл hosts
В файле hosts содержатся строки записей, которые состоят из IP-адреса, и одного или нескольких имен узлов. То есть в нём происходит перевод понятных для пользователей имен узлов в числовые адреса (IP-адреса)
После символа # размещены комментарии
Запись:
145.255.14.187 google.com, позволяет перейти на сайт поисковой системы Google, без обращения к системе доменных имён — DNS.
Первоначально преобразование доменных имен в IP-адреса производилось только с использованием hosts, который составлялся и рассылался на каждую из машин в локальной сети.
Файл hosts OS Windows находится в каталоге — C:\Windows\System32\drivers\etc\
IP — Internet Protocol (ай-пи. протокол Internet ) — В сети Internet для физического обмена данными (на аппаратном уровне), управления передачей данных, процессами в сети и маршрутизации потоков данных, используется протокол IP.
hosts — текстовый файл, содержащий базу данных доменных имен и используемый при их трансляции в сетевые адреса узлов. Запрос к этому файлу имеет приоритет перед обращением к DNS-серверам.
DNS (Domain Name System — система доменных имён) — используется для получения IP-адреса соответствующее имени хоста. Спецификация доменной системы — RFC 1035
IP-адрес (ай-пи-адрес) — уникальный сетевой адрес узла в компьютерной сети, построенной по протоколу IP. В сети Интернет требуется глобальная уникальность адреса; в случае работы в локальной сети требуется уникальность адреса в пределах сети. В версии протокола IPv4 IP-адрес имеет длину 4 байта, а в версии протокола IPv6 IP-адрес имеет длину 16 байт.
Администратор: Командная строка
Если ввести в адресную строку браузера -145.255.14.187
Хотя IP для имени — google.com, сервер Google, по IP определил, что вы из России и перевёл на русскую версию поисковой системы.
На предыдущей странице после ввода команды httpd.exe -S
была получена — Ошибка синтаксиса в строке 10 C: /Apache24/conf/extra/httpd-userdir.conf:
Неверная команда «UserDir», возможно, опечатка или заданный модуль не входит в конфигурацию сервера
Файл hosts находится в C:\WINDOWS\system32\drivers\etc\hosts
В каталоге C:\WINDOWS\system32\drivers\etc\ (%WinDir%\System32\Drivers\Etc) откройте в приложение «Блокнот» файл hosts
Можно и из командной строки
C:\Windows\system32>notepad C:\Windows\System32\drivers\etc\hosts
Этот файл содержит сопоставления IP-адресов именам узлов. каждый
Запись должна храниться на отдельной строке.
IP-адрес должен быть размещены в первом столбце, за которым следует соответствующее имя хоста.
IP-адрес и имя узла должны быть разделены по крайней мере одним пробелом.
Поэтому, в секциях — вместо символа » * » нужно указать IP-адрес из из указанного диапазона.
Для обращения к вашему сайту по доменному имени, например — namesite.ru, нужно, в файле конфигурации httpd-vhosts.conf, создать секцию . В директивах которой указать пути к каталогу, подкаталогам и папкам вашего сайта.
Этот файл содержит сопоставления IP-адресов именам узлов.
Каждая запись должна быть на отдельной строке.
IP-адрес должен быть помещен в первой колонке, за которым следует соответствующее имя хоста.
IP-адрес и имя узла должны быть разделены по крайней мере одним пробелом
Символ ‘#’ — это знак комментария. Записи после него игнорируются. Можно использовать после доменного имени.
localhost — («локальный хост», этот компьютер) — стандартное, официально зарезервированное, доменное имя для частных IP-адресов.
То есть, ни один сайт, в сети WWW, не может иметь доменное имя localhost и IP-адрес из указанного диапазона 127.0.0.1 — 127.255.255.255 (RFC 2606).
Использование адреса 127.0.0.1 позволяет устанавливать соединение и передавать информацию для программ-серверов, работающих на том же компьютере, что и программа-клиент, независимо от конфигурации аппаратных сетевых средств компьютера (не требуется сетевая карта, модем, и прочее коммуникационное оборудование, интерфейс реализуется при помощи драйвера псевдоустройства в ядре операционной системы). Таким образом, для работы клиент-серверных приложений на одном компьютере не требуется изобретать дополнительные протоколы и дописывать программные модули.
Обычно адресу 127.0.0.1 однозначно сопоставляется имя хоста «.localhost»
— управление доступом к каталогам пользователей.
На реальных сайтах хостинг провайдеров каталоги для сайтов пользователей обычно называются:
Используемое в данном примере доменное имя — namesite.ru (имясайта.ru) пока, чтобы не повлечь возникновение дополнительных ошибок, не изменяйте на своё. Это можно будет сделать позднее.
Примеры в документации Apache используют каталоги /www/htdocs и /www/docs. Создайте на диске C:/ каталог — www и в нём подкаталог для размещения сайтов. Например — docs