Page 1 of 1

ssh connection problem caused by MAC-adress

Posted: 3. Dec 2021, 11:26
by shenrik
Hi,
I have quite strange problem with Ubuntu 20.4 on VirtualBox.
At first I had network issues, meaning my VM couldn't connect wirelessly with the internet. Even with Network Bridge, the right adapter chosen (en0: WLAN), "allow all VMs" and Cable Connection approved, no internet connection could be made.
After I edited the MAC-adress of my VM, so it resembled the MAC-adress of the host, I was able to get an internet connection on my VM.
Everything worked flawlessly until I tried to connect the host with the VM via ssh.
Now, I always get the error message: "ssh connect to host (IP-adress) port22: no route to host".
When I ping the host device I get the error message: "Destination host unreachable".
On the internet I found a comment which says that using the same MAC-adresses on different devices can lead up to such a "no route to host" error.
Is there any other solution to get an internet connection or a functioning connection via ssh while using the same MAC-adresses?

Thank you for your help.

Re: ssh connection problem caused by MAC-adress

Posted: 3. Dec 2021, 21:22
by scottgus1
shenrik wrote:my VM couldn't connect wirelessly with the internet. Even with Network Bridge, the right adapter chosen (en0: WLAN)
Bridged does not always work with Wi-Fi, see Virtualbox Networks: In Pictures: Bridged Adapter for alternatives.
shenrik wrote:I edited the MAC-adress of my VM, so it resembled the MAC-adress of the host
This breaks a fundamental in networking: no duplicated MAC addresses. It confuses the router, and may cause things like
shenrik wrote:"ssh connect to host (IP-adress) port22: no route to host".
The solution is to get the VM to act as a separate device, not duplicate an existing device. It is possible to use Wi-Fi and get internet in the VM and access the VM with services like SSH using plain NAT, see Virtualbox Networks: In Pictures: NAT.