Connecting using TCP/IP from a virtualbox to anoth

2019-09-14 18:43发布

问题:

I have 2 different machines running ubuntu on virtual box and i'm trying to run a server on one machine and connect with the client from another machine . However I am not able to connect due to the fact that the IP adress given from the virtual box machine is very strange that is 10.x.x.x . I am managing to run both programs one as ./server and the other ./client localhost 2017 on the same virtual box machine however not on different machines .. I am trying to run the client using ./client 10.x.x.x 2017 and the resulting error is error connecting . I should also add that both machines on virtual box are said to have the same IP address when I checked.. any help please ?

回答1:

By default VirtualBox configures NAT networking. You need to setup your addaptors in bridge mode and make sure your router can provide both VMs with IP addresses.

You can read more about it HERE.