I have two Linux VMs A
and B
in VirtualBox 6.1 (Host: Windows 10).
I am using NAT
Network Mode for both machines.
I am currently able to connect with ssh root@127.0.1.1
to the machine A
(from the host).
When I start the second machine B
, I would likeconnect to B
by e.g. ssh root@127.0.1.2
.
But the second machine also uses the external ip 127.0.1.1
.
How can I changes this such that both machines are accessible from the host with two different ips?
The solution is to have A.vbox
with the following entries:
<Network>
<Adapter slot="0" enabled="true" MACAddress="08002731CD46" type="82540EM">
<NAT>
<Forwarding name="ssh" proto="1" hostip="127.0.1.1" hostport="22" guestip="10.0.2.15" guestport="22"/>
</NAT>
</Adapter>
</Network>
And the other B.vbox
file with
<Network>
<Adapter slot="0" enabled="true" MACAddress="08002761CE67" type="82540EM">
<NAT>
<Forwarding name="ssh" proto="1" hostip="127.0.1.2" hostport="22" guestip="10.0.2.15" guestport="22"/>
</NAT>
</Adapter>
</Network>