[VirtualBox Series] VirtualBox settings for virtual machine network are absolutely detailed

Preface knowledge

Before learning to configure the network, we need to first understand the three network modes of virtualBox

Understand the virtual machine VirtualBox network configuration

demand analysis

Now how to achieve an effect? ​​I want the host to be able to access the virtual machine and the virtual machine to be able to access the external network. Also, if I change the router, the previously configured virtual machine IP will remain unchanged, and the previously configured virtual machine network can also be accessed normally.

Notes on several network modes under a brief overview

bridge mode

The virtual machine IP address needs to be in the same network segment as the host. If networking is required, the gateway and DNS need to be consistent with the host network card.

host mode

Its network structure is based on the NAT network, and removing the virtual NAT device prevents it from accessing the Internet. The IP address of the virtual machine and the host-only network card address must be in the same network segment.

NAT mode

In NAT mode, all data for virtual machines to access the network is provided by the host

  • The virtual machine can access the host through the network
  • The host cannot access the virtual machine over the network

Based on the above analysis, we can use NAT + Host-Only two modes to achieve virtual machine Internet access and physical machine communication capabilities.

So our idea is to use

Set up 2 network cards: the first one is NAT (Network Address Translation), which realizes the access from virtual machine to host and virtual machine to external network; the second one is host-only, which realizes the access from host to virtual machine and virtual machine to virtual machine. access.

Hands

In the virtualBox menu, use management->global settings to create a nat network and modify the default generated ip network segment for our custom one.

Select our virtual machine instance, click Settings to network, we add two network cards

Guess you like

Origin blog.csdn.net/run_boy_2022/article/details/131862443