SSH to Same Mac Address, Same IP Address but different OS

1 minute read

Published:

Scenario

My Dell Latitude laptop has three OS, Windows 11, Ubuntu 18.04 and Debian 12. Before I was able to ssh to Ubuntu with 10.0.0.35. However, when I boot to Debian12, the ip address is still 10.0.0.35, which cause ssh to complain about key mismatch.

Solution

Step 1: Ensure each OS has a unique hostname

On Ubuntu

sudo hostnamectl set-hostname ubuntu

On Debian

sudo hostnamectl set-hostname debian

Reboot each OS once after setting its hostname.

Verify:

hostname

It should print ubuntu or debian.


Step 2: Install and enable mDNS (Avahi)

(Usually already installed, but we confirm)

Run this on both Ubuntu and Debian:

sudo apt update
sudo apt install avahi-daemon
sudo systemctl enable --now avahi-daemon

Check status:

systemctl status avahi-daemon

You want to see:

Active: active (running)

Step 3: Allow mDNS through the firewall (if enabled)

If you use UFW (Ubuntu often does):

sudo ufw allow mdns
sudo ufw reload

Debian usually doesn’t block it by default.


Step 4: Test name resolution (important)

From your desktop (the machine you SSH from):

ping ubuntu.local
ping debian.local

You should see replies like:

PING ubuntu.local (10.0.0.35)
PING debian.local (10.0.0.35)

Same IP is fine — names are what matter.

If this works → SSH will work.


Step 5: SSH using hostnames (this fixes your warnings)

Now connect:

ssh lizeren@ubuntu.local
ssh lizeren@debian.local

The first time for each OS:

  • Type yes to trust the host key

  • After that → no more warnings

SSH now stores keys under:

  • ubuntu.local

  • debian.local

Not under the shared IP.