0

I am try to using one NAT adapter and one Host Network adapter on VirtualBox, but I can not ping from Guest (VM) to Host.

I followed How to create a VirtualBox VM with a static IP and internet access .

However, I didn't want to use the IP "192.168.99.1/255.255.255.0" because my host has IP 10.53.21.235 and I want the my virtualbox to have IP like 10.53.21.xxx, so I can ping from another has the same network: 10.53.21.xxx. But it is not successful

Here is my current config:

  • IP of guest (virtualbox, redhat): 10.53.21.15
  • IP of host (windows): 10.53.21.235
  • IP of host network adapter: 10.53.21.1/255.255.255.0
  • Ping successfully from 10.53.21.235 to 10.53.21.15
  • Ping not successfully from 10.53.21.15 to 10.53.21.235
  • Ping not successfully from 10.53.21.216 (another machine) to 10.53.21.15

Please see attached file

Show ip of guest Show ip config file of guest Show ip config of host network adapter Show ip of host (windows)

Can you help me ?

2
  • 1
    Terminology niggle - "localhost" is a name on every system, whether virtual or physical, usually corresponding to the loopback interface address 127.0.0.1. In your question, everywhere you mention "localhost" I suspect you actually mean "host".
    – roaima
    Mar 7, 2020 at 11:47
  • @roaima: Yes, my mean "host"
    – taibc
    Mar 7, 2020 at 14:58

1 Answer 1

2

With a host-only virtual network, you should not use the same subnet that the physical network your host computer is using. The virtual machines can only talk (directly) to the each other and to the host machine using the "Virtual Host-only Network #2" adapter. If you want to connect your Host-only virtual network to your local LAN, the host VirtualBox host computer should be set up to route packets between these networks.

It sounds like you would want to use Bridged Networking instead. This makes the virtual machines appear as if they were directly connected to the LAN. In this case the virtual machines should have addresses belonging to the same subnet, and typically be set up the same way (e.g. DHCP).

3
  • Thank you. Yes, when I use Bridged networking, it is successful. But, I am setting a Kubernetes cluster (container enviroment), and when I use bridge networking, I get a problem when init cluster, so I wanted to try another way. Thanks again !
    – taibc
    Mar 7, 2020 at 15:03
  • 1
    @taibc if you want to use a NAT interface you must have a different network address between the Host and Guest.
    – roaima
    Mar 7, 2020 at 15:06
  • @roaima. Yes, thank you !
    – taibc
    Mar 8, 2020 at 3:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.