Virtualbox is installed in windows and several virtual systems (Debian/Ubuntu/ARCH/WINXP...) are installed ...). Today, I suddenly wanted to access the Apache server of virtual Debian. Since I have tried the bridge method before, it seems very troublesome to remember to bridge the vbox virtual network card with the local network card, and then set it in the virtual system.
I'm going to try another method today, so I found an article on Google.Article. The specific operation is as follows: add two NICs in the NIC settings of the virtual machine, one is host-only, the other is Nat, and then set two NICs in the virtual system respectively. Try again. In Debian, set eth0 to the static IP address of the local machine in the same network segment, set eth1 to DHCP, and then access the virtual machine from the local machine, which is indeed accessible. However, a problem occurs when accessing the Internet from a virtual machine. It cannot be accessed, or even access the local machine through 10.0.2.2. After some tossing, I finally found that the two NICs cannot work at the same time. Ifconfig eth0 down, ifconfig eth1 up, so that you can access the virtual machine through the host; ifconfig eth0 up, ifconfig eth1 down, so that the virtual machine can access the local machine and access the internet. It was depressing and never solved the problem of working at the same time, but it was finally possible to access the Virtual Machine. Although it was troublesome to use, it basically solved the need to access the virtual machine.
Later, I chatted with a friend and learned that I could simply add a NIC in the NIC settings of the VM and change it to a bridge adapter! It was really nice to try it! It seems that people's thinking patterns often change. The time will change the complicated things they have experienced!