Swacblooms🦋

Making the Moves
Menu
  • Home
  • Motivation
  • Education
  • Programming
  • About
  • Contact
  • Privacy Policy
Home
Programming
Easy SSH Via Local DNS
Programming

Easy SSH Via Local DNS

Samson Amaugo March 23, 2021

Hola 🖐…..

Sometimes you might find it hard to keep track of the IP address of your devices in your local network. Imagine having three Raspberry pi’s and keeping track of their IP when you want to SSH into them in a local network.

Most Debian OS’s if not all come installed with the Avahi mDNS. The Avahi mDNS serves as a local DNS and it makes use of the .local extension which is used as a specially used domain and reserved for personal use and local networks.

So instead of sshing into your Raspberrypi by doing ssh pi@xx.xx.xx.xx you can ssh into your Raspberrypi using its hostname with the .local extension e.g

ssh pi@raspberrypi.local

To view the hostname of your Raspberrypi, run this command:

hostname

And to change the hostname of your Raspberrypi, run this command:

hostnamectl set-hostname [custom-name]

So in a scenario where you have three Raspberrypis, you can run these commands:

# Run this in your first Raspberrypi
hostnamectl set-hostname mypi-1
# Run this in your second Raspberrypi
hostnamectl set-hostname mypi-2
# Run this in your third Raspberrypi
hostnamectl set-hostname mypi-3

After running these commands you would need to reboot your router so that it can have the updated list of hostnames 😁

To ssh into your first Raspberrypi, you can simply run

ssh pi@mypi-1.local

This is easier than using its IP address.

Another good thing about the Avahi mDNS is that it binds your device’s IP address to its local domain so even when the IP address of your device changes, you don’t need to worry about that because sshing using your device’s hostname with the .local extension would still work.

Also, note that this setup isn’t only restricted to Raspberrypi, you can as well change the hostname of your Debian computer using the same commands above 😜

Thanks and I hope you enjoyed learning a little bit about the Avahi mDNS.😅

Prev Article
Next Article

Related Articles

React-ref callback
Okay guys this is a continuation of the previous react …

React- Callback Refs

Corona
Hello, you are welcome to read this post. I’m sure …

Making a Corona Data Fetcher (API)

About The Author

Samson Amaugo

I am Samson Amaugo. I am a full-stack developer and I specialize in DotNet and the MERN stack.

Leave a Reply

Cancel reply

Search Site

Recent Posts

  • Running Entity Framework Migrations in an Aspire-Bootstrapped Orleans Project
  • Using XDebug in Laravel Sail (VSCODE)
  • Custom Redis Streams Provider for Orleans
  • Creating a Custom File Storage Provider for Microsoft Orleans
  • Incremental Generators In C#

Categories

  • EDUCATION
  • Motivation
  • Programming
  • Uncategorized

Get more stuff

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

we respect your privacy and take protecting it seriously

RSS Swacblooms

  • Running Entity Framework Migrations in an Aspire-Bootstrapped Orleans Project
  • Using XDebug in Laravel Sail (VSCODE)
  • Custom Redis Streams Provider for Orleans
  • Creating a Custom File Storage Provider for Microsoft Orleans
  • Incremental Generators In C#
  • Hot Chocolate Data Loader: A Quick Guide
  • Exploring Policy-Based Authorization in Minimal API with .NET 8
  • Using Cloud Firestore in Blazor WebAssembly
  • Serving A VueJs App from DotNet
  • Dynamic Subscriptions in Hot Chocolate 🔥🍫

Swacblooms🦋

Making the Moves
Copyright © 2025 Swacblooms🦋
Swacblooms - Making the Moves