Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Network setting in virtualbox

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

The editor will share with you the example analysis of network settings in virtualbox. I hope you will gain something after reading this article. Let's discuss it together.

Environment host osmacOS majavevmoracle virtualboxvm osubuntu 16.04 Network principle NAT (Network address Translation Mode)

Using NAT mode is to let the virtual system access the public network through the network where the host machine is located with the help of NAT (Network address Translation) function. In other words, NAT mode can be used to access the Internet in a virtual system. The TCP/IP configuration information of the virtual system in this NAT mode is provided by the DHCP server of the VMnet8 (NAT) virtual network, and the VM NAT Service service of the system acts as the router. The packet that is responsible for sending the virtual machine to VMNet8 for address translation is sent to the actual network, and then the packet on the network is returned to VM after address translation.

Actual scenario:

Vm and vm: independent and unable to access each other

Vm and host: virtual machines can access the host, but not vice versa

Vm can access internet directly, but not vice versa

Bridge Adapter (Bridge Mode)

The virtual machine sets up a network bridge through the physical network card of the host, and the vm enters the local area network through the bridge, and has its own independent IP in the local area network, and all its network functions are the same as the physical machines in the real network segment. It can access any machine in the network, and if it uses automatic DHCP mode, it will automatically assign the IP address to the same network segment as the host. The relationship between a virtual machine and a host using bridging mode is like two computers connected to the same hub.

Actual scenario:

Vm and vm: can access each other. Vm has a separate IP and is in the same network segment.

Vm and host: can access each other. Vm has a separate IP and is in the same network segment.

Vm cannot access internet

Host-only Adapter, host mode only

In this way, the network card of the virtual machine is connected to the host VMnet1, but the system does not provide any routing services for the virtual machine, so the virtual machine can only communicate with the host, but can not connect to the actual network. In some special network debugging environments, you can use host-only mode when it is required to separate the real environment from the virtual environment. In host-only mode, all virtual systems can communicate with each other, but virtual systems and real networks are isolated.

Tip: in host-only mode, the virtual system and the host machine system can communicate with each other, which is equivalent to the interconnection of the two machines through twisted pair. In the host-only mode, the TCP/IP configuration information of the virtual system (such as IP address, gateway address, DNS server, etc.) is dynamically assigned by the DHCP server of the VMnet1 (host-only) virtual network. If you want to use VirtualBox to create a virtual system that is isolated from other machines in the network and do some special network debugging work, you can choose host-only mode.

Actual scenario:

Vm and vm: can access each other and are in the same network segment

Vm and host: they cannot access each other by default, because the network card simulated by the virtual machine and the host are in different network segments, but the mutual access can be achieved by setting static IP.

Vm cannot access internet

NAT+Bridge

Log in to the virtual machine and use the ifconfig command to see the information of the two network cards in order to realize the interconnection in the local area network and the access of Internet.

You can specify a static IP for enp0s8.

Ubuntu is specified as follows:

Sudo vi / etc/network/interfaces

Sudo service networking restart

After reading this article, I believe you have some understanding of "sample Analysis of Network Settings in virtualbox". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report