mDNS (multicast DNS)
Some backstory, Back in 2017-18 I used to watch bunch of videos on raspberry Pi running like retro games, hacking, electronics stuff, it was awesome to see just how a tiny computer can do these sort tasks. It was dream for me buy a raspberry Pi but didn’t have budget.
Fast forward to today, I have money to buy a raspberry Pi easily but now I don’t want because i already own a linux machine, And the enthusiasm is longer there as it was few years ago.
Anyhow On the day of Onam 15th of September, 2024 I visited Geon’s Place to attend the onam feast, and it was really good especially the palada payasam, after eating whole bunch of rice and drinking 1.5 cups of payasam.
Me and along with shaheem went to Geon’s room There i saw a raspberry Pi, For the first time, and i remember it was connected to the router using a ethernet cable and we were SSHing into raspberry pi using cmd: ssh raspberrypi.local
And it caught my attention, though i didn’t have much idea at that time on how it was working, i thought maybe it is router assigning .local to devices connected via ethernet. But turns out it was mDNS.
Meet mDNS, Which stands for multicast DNS(Domain Name Server), and it requires zero configuration uses UDP multicast*.
It’s already implemented in the operating systems like mac and linux and also in windows 10 and onwards
On mac you can just goto settings > sharing And you will find your hostname.
Copy that hostname and Run a http server on your mac and bind it 0.0.0.0 so that anyone can access that your server in your local network.
Now goto your other computer and goto browser and type: hostname.local:port My case it was rolex.local:3000 and now you can access your web server which specifying the ip address your device. And it will work regardless your currently assigned IP as long as you’re on the same network.
Refs:
https://en.wikipedia.org/wiki/Multicast_DNS https://www.raspberrypi.com/documentation/computers/remote-access.html