Issue
I´m using Raspberry Pi 4 and Windows 10 machine And I setup a custom hostname in the raspberry by $ sudo raspi-config and then when I use hostname in the raspberry it is given me the new hostname. But I´m traying to get this hostname from my Windows machine and it is not give my.
pi@PLC:~ $ hostname -I
169.254.100.158 192.168.1.72 fd18:5644:3369:d200:f282:15d1:9085:858
pi@PLC:~ $ hostname
PLC
When I ping my raspberry or nmap or arp -a does not given me any Host-name response any suggestion. For example when I ping to 8.8.8.8 C:\Users\n-orb>ping -a 8.8.8.8 it is given me the Hostname but if I ping the Raspberry it is not given me the hostname.
C:\Users\n-orb>ping -a 8.8.8.8
ping to dns.google [8.8.8.8] with 32 bytes
C:\Users\n-orb>ping -a 168.254.100.158
ping to 168.254.100.158 with 32 bytes
C:\Users\n-orb>ping 192.168.1.72
ping to 192.168.1.72 with 32 bytes
Does anyone know how to get the hostname.?
Solution
Resolving an IP address to a hostname is done via Reverse DNS Lookup. Reverse DNS Lookup is actually nothing special, it's just normal DNS Lookup in the "magic" sub-domain in-addr.arpa.
When you try to resolve the IP address 192.168.1.72
to a hostname, what is actually happening, is that the DNS resolver is trying to resolve the PTR
record for the hostname 71.1.168.192.in-addr.arpa.
So, when you want your IP address 192.168.1.72
to resolve to the hostname PLC
, you need to configure your DNS server so that it responds to a PTR
query for 71.1.168.192.in-addr.arpa.
with the response PLC
in exactly the same way that, for the other direction, you set up your DNS server so that it responds to an A
query for PLC
with the response 192.168.1.72
.
Answered By - Jörg W Mittag Answer Checked By - Marilyn (WPSolving Volunteer)