I have a virtual machine attached to NAT. It has the default IP 10.0.2.15. Now I create another machine but the new machine still has the same IP address 10.0.2.15. Is there a way that I can keep the network setting for the first machine, change the second machine's IP to something like 10.0.3.15 and make those two machine able to ping to each other (as in a LAN network) ?
Use NAT Network instead of NAT.
This worked for me with VirtualBox version 5.2.22 and Redhat/Ubuntu. The VM's had different IP's and both had access to internet.
For, both VM's :
Nat Network in attached to
select Allow VMs in Promiscuous mode (advanced chevron)ifconfig (or ip addr) command to find out each VM IP. In my case : 10.0.2.4 and 10.0.2.5The following table provides an overview of the most important networking modes:
| | VM <-> Host | VM1 <-> VM2 | VM -> Internet | VM <- Internet |
|----------|-------------|-------------|----------------|----------------|
| HostOnly | Yes | Yes | No | No |
| Internal | No | Yes | No | No |
| Bridged | Yes | Yes | Yes | Yes |
| NAT | No | No | Yes | Port forward |
| NATNet | No | Yes | Yes | Port forward |
NB: If you want to connect to the VMs with tty, you need to do ip forwarding.
In the Virtualbox config:
File -> Preference -> Network -> double-clic Natnetwork -> port fordwarding -> add a rule : host ip 127.0.0.1, port 23 (or whatever to put in tty), Guest IP (the VM ip, example: 10.0.2.5), guest port 22More explanation here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With