How does ping -a know the hostname of my Raspberry Pi 4? - sockets

My Raspberry Pi 4 B is connected (for the first time) to the WiFi of my PC (running Windows). Then the raspberry(ip) showed up in the list in Network Scanner of MobaXterm. What surprised me is that the list also shows the name of my Pi. And ping -a ip also shows the name.
How does this work?

When the Raspberry Pi connects to your WiFi it doesn't just get an IP address assigned. It also gets a host name assigned. It either sends its own host name to the DHCP server or the DHCP server assigns a host name.
Now, when you have an IP address, you can do a reverse search. Usually DNS works in the way that you give it a name and it returns the IP address. But there is also reverse search, give it an IP address and get a name back.
In your local network the DHCP server and your DNS resolver work together. Whenever a reverse search for a local IP address is made, the answer is fetched from the DHCP server. And the DHCP server answers with the host name from step one.
In most WiFi routers dnsmasq does this for you, on a Windows machine it is built into Windows.

Related

How can I find the IP of a device not on my network but is connected to my Laptop via ethernet cat5 cable?

I need to find out the devices IP so that I can manually set my laptops computer to the devices network and reconfigure the devices IP. I have only its MAC address which was acquired from the devices label. I am new to networking trouble shooting. I am hoping to do this using Windows PowerShell, but I also have wireshark and linux available.
This might help you if the firewall is not active on that device.
In one cmd.exe ping your broadcast address, assuming your ip is 192.168.0.X
ping -t 192.168.0.255
In another cmd.exe window type arp -A to see your ARP table aka MAC to IP address table, because you mention you have the MAC you should be able to see the IP
arp -A
How it works? This will send ping packets to the broadcast address, everybody on your broadcast domain will see the packet and respond to it, once they respond they will be added to your computer ARP table.

How to fix server IP address could not be found when trying to reach a raspberry Pi from the internet?

I am trying to set my raspberry pi as a web server just to play around.
I changed the DNS record of my domain to point to my IP address.
then I forwarded the requests of port 80 to my raspberry pi internal IP address from the router.
I can reach the raspberry pi from my internal wifi connection using its ip address. However, I can't reach it using my domain name. I am getting this " server IP address could not be found." error.
Tried to clean cashe from chrome, and tried another browser ..etc. didn't work.
Any Ideas?
EDIT: ping works and no packages are lost
+
I waited 2 days already
When changing DNS it will take some time before all nameservers get changes.
You can read more about it here
You can try and go to your public IP. Then you should be able to visit your webserver, if you have forwarded it correct.

Connecting GNS3 to Internet.. curious about the IP

BTW!! I am able to connect to the internet via GNS3 Router. My question is about the IP Address that's assigned to the router!
Here it goes:
So this is my set up in GNS3:
Router 1 ---> Cloud (using my local MS loopback interface)
I had been struggling to get my router to the internet for a while. I'd run ipconfig and found that my wireless connection had an IP of 10.x.x.x with a gateway of .1. So obviously, I was trying to manually assign my MS loopback a random address of like 10.x.x.25 (/24, so still within the same subnet). But it never worked!!
Finally gave up, and then a new idea hit me. I set my MS loopback as "receive IP via DHCP", and also my GNS3 router interface that's facing the loopback cloud as "receive IP via DHCP".
They both received an IP Address of 192.168.x.x, and it connected to the internet as well. Duh.. no wonder my manual 10.x.x.x didn't work.
I did an ipconfig/all.... I just could not see a 192.168.x.x subnet in there at all.. no trace of it, just 10.x.x.x was present.
Where DID this 192.168.x.x IP come from? Difference between 10.x and the 192.x address?
Any help would be appreciated!
Nevermind, I think I figured it out. 10.x would be an IP address if it was handed out by my home router.
Here, since I allowed my Loopback to link up with my real router, my PC is behaving as a DHCP server instead, on behalf of my real home router. So 192.168.x is a pool belonging to my PC which handed out an IP to my virtual GNS3 router.
A traceroute to a google dns server revealed the works behind the scenes. It reach the 192.168.x.1 and THEN went to the 10.x.x.1. So my PC is like a proxy right?

get virtual machine information on Host

How to retrieve virtual machine data such as ip address on the HOST .
I've created virtual machines using qemu-system-x86_64.
At time of asking, it was not possible to query the guest IP address from virsh. Modern libvirt though supports the "domifaddr" command in virsh which lets you query the DHCP assigned IP address for guests that are connected to libvirt's "default" network. It does not work for guests using direct bridging to the LAN.
Second, there is now also the ability to setup an NSS module on the host, so you can login to guests based on their hostname, instead of raw IP. Again this works for guests using the default network

Can't connect to my webserver from external source

I am having problems connecting to my website from a source outside my local network. I had another server before running the same site. The only difference is the old one was FreeBSD and now I'm trying it on Linux.
Here is my setup: I'm using Apache2. The server is behind a Netgear router. I'm using a Freedns host name. I have ddclient updating my ip.
Here is what happens: I can look at my site from the server in Chrome or my phone connected to the local wifi. It works using either the host name or ip address. It does not load from my cell phone or from my desktop using a proxy for either the host name or the ip address (the external one from googling my ip and from the router's wan info page). When I try the proxy with the host name I get "conection timed out" error, and when I try the ip address I get "couldn't connect to host error".
Here is what I've tried: I enabled port forwarding to the server from and to port 80 to my lan ip address. I disabled the firewall on the server. I double checked that the host name is directed to the right ip address. I ensured that the ip address does indeed point to my router. I've watched wireshark on my server while trying to connect and don't see any incoming requests when I try to load it from my phone.
It seems like maybe my port forwarding isn't working, but on my router it says that that port forwarding rule is active.
I'm out of ideas as to why what else could be going wrong.