I have two virtual machines, a Windows XP SP3 and a Kali Linux 2020. I can set up both machines on NAT and connect to the internet fine, but I am unable to ping one using the other, or from my host machine. I tried setting them up on a bridged network (en0: wifi (airport)) but was unable to connect to the internet through the guest machines. I think they both have the same IP address and tried setting a static IP on both but still couldn't get them to communicate. Anyone have this problem/would know how to fix it?
2 Answers
This is possible with VirtualBox .
You need to create a natnetwork
, you can do it by command line .
VBoxManage natnetwork add --netname natnet1 --network "192.168.15.0/24" --enable
And for each VM , change the Adapter 1 to be attach to a NAT Network
After rebooting , each VM must be able to ping other VM and ping outside .
ping 8.8.8.8
must work
PS: tested on VirtualBox 6.1.8 on macos Catalina
PS1: the network "192.168.15.0/24" from the example must not conflict with your local network or others network to access internet , you may need to change .
-
1I was able to get them to ping each other, but is there a way that both vm's can also connect to the internet through this method? They can't at the moment. Thanks.– jslamzJun 15, 2020 at 8:48
-
-
-
I put that line "VBoxManage ... -enable" into my MacOS command line. I wasn't able to ping google's ip in either of the vm's.– jslamzJun 15, 2020 at 18:45
-
"PS1: the network "192.168.15.0/24" must not conflict with your local network or others network to access internet , you may need to change ." you mean change the ip address of the nat network?– jslamzJun 15, 2020 at 22:07
Keep the Bridge Network for both Network Adapters and verify the the cable connected box is checked. Use the GUI > Go to the Network Settings > Wired > Go to the Settings icon > Then to the identity tab > go to the drop down box to add the MAC address of your network adatper.
Alternately if you are a Pro: Find the Mac Address for your Network adapter using "ip a" on a VM. Add that hexadecimal number to the Network script by: vi /etc/sysconfig/network-scripts/. Add the HWADDR=xxx. Then systemctl restart NetworkManager. Your VMs should now ping. I noticed that only one needed the MAC address.