VirtualBox网络模式文档一小段翻译

NAT模式是VirtualBox中虚拟机访问外部网络的简便方式,提供透明的网络路由但虚拟机对外不可见。VirtualBox作为网络引擎,处理虚拟机与主机间的通信,实现安全隔离。NAT模式下,虚拟机通过DHCP获取IP地址,无法直接作为服务器,但可通过端口转发设置。
摘要由CSDN通过智能技术生成
VirtualBox中主要网络模式:
1.Not attached
    In this mode, VirtualBox reports to the guest that a network card is present, but that there is no connection -- as if no Ethernet(以太网) cable(电缆) was plugged into the card. This way it is possible to "pull" the virtual Ethernet cable and disrupt(扰乱) the connection, which can be useful to inform a guest operating system that no network connection is available and enforce a reconfiguration.
不能连接
    这种模式,VirtualBox向虚拟机报告有一个网卡,但是没有连网。就像网卡没有接网线一样。这种方式可能是VirtualBox插入一个虚拟网线来打乱网络连接,然后通知虚拟机没有可用的网络连接,必须重新配置。
    
2.Network Address Translation (NAT)
    If all you want is to browse the Web, download files and view e-mail inside the guest, then this default mode should be sufficient for you, and you can safely skip the rest of this section. Please note that there are certain limitations when using Windows file sharing (see Section 6.3.3, “NAT limitations” for details).
网络地址转换(NAT)
    如果你想在虚拟机内浏览网页,下载文件和看电子邮件,那这种默认的模式应该能满足你,你可以跳过这部分的介绍。要注意当用Windows文件共享时这种模式有限制。
3.NAT Network
    The NAT network is a new NAT flavour introduced in VirtualBox 4.3. See 6.4 for details.
NAT 网络

    NAT网络是NAT的新方式,在VirtualBox4.3中引入。详细请参考6.4节

4.Bridged networking
    This is for more advanced networking needs such as network simulations(模拟、仿真) and running servers in a guest. When enabled, VirtualBox connects to one of your installed network cards and exchanges network packets directly, circumventing(设法回避、规避) your host operating system's network stack.
桥接网络
    这种模式是为了更高级的网络需求,比如仿真网络和在虚拟机上运行服务器。当可能时,VirtualBox连到已安好的某块网卡上直接交换包数据,设法回避宿主操作系统网络栈。(VMware直接连到外部网卡上,跳过宿主机?)
    
5.Internal networking
    This can be used to create a different kind of software-based network which is visible to selected virtual machines, but not to applications running on the host or to the outside world.
内部网络
    这种模式创建一个基于不同软件的网络,这个网络对选中的虚拟机是可见的,但对宿主机上的应用程序或者外部世界的程序不能用此网络。
    
6.Host-only networking
    This can be used to create a network containing the host and a set of virtual machines, without the need for the host's physical network interface. Instead, a virtual network interface (similar to a loopback interface) is created on the host, providing connectivity among virtual machines and the host.
仅连宿主的网络
    这种网络应用于包含宿主和一系列虚拟机,不需要宿主机的物理网络接口。取而代之的是宿主会建立一个虚拟网络接口为虚拟机和宿主机之前提供连接。
    
7.Generic networking
    Rarely used modes share the same generic network interface, by allowing the user to select a driver which can be included with VirtualBox or be distributed in an extension pack.
    At the moment there are potentially two available sub-modes:
    UDP Tunnel(隧道、地下通道)
        This can be used to interconnect virtual machines running on different hosts directly, easily and transparently(透明的、清澈的、显而易见的), over existing network infrastructure(基础设施).
    VDE (Virtual Distributed Ethernet) networking
        This option can be used to connect to a Virtual Distributed Ethernet switch on a Linux or a FreeBSD host. At the moment this needs compiling VirtualBox from sources, as the Oracle packages do not include it.
一般网络
    很少用到的模式,共享同一个普通网络接口,通过让用户选一个VirtualBox内部的驱动器,或者是在扩展包中的驱动器。
    这时有两种可能的子模式:
    UDP隧道
    这种模式可以让在不同宿主机上的虚拟机直接连接,显而易见地,这是基于已经存在的网络设备来实现。
    VDE(虚拟分布式以太网)网络
    这种模式可用来连到一个虚拟分布式网络,通过一个Linux或者FreeBSD宿主机交换数据。这时需要编译VirtualBox的源码,因为Oracle包里不包含它。
    
The following table provides a quick overview of the most important networking modes:

下表给出比较重要的网络模式的概览。


以下关于NAT模式的翻译:

网络地址转换是虚拟机访问外部网络的最简单的方式。一般情况下,它不需要在宿主网络和虚拟机上做任何其他配置。因此,NAT是VirtualBox默认的网络模式。
虚拟机使用NAT模式看起来就像一个真实电脑通过路由器连到互联网上。在主这种情况下,“路由器”是指VirtualBox网络引擎,显然是它在绘制虚拟机的网络交通图。在VirtualBox中这个“路由器”放在各虚拟机和宿主机之间(也就是虚拟机和宿主机都要连到这个路由器上)。这种分离使安全增到极大,因为默认情况下虚拟机之间不能对话。
NAT模式的缺点是,就像接在一个路由器上的私有网络一样,从外部的互联网上看不到也不能访问虚拟机;这种模式虚拟机不能做服务器,除非设置一个port forwarding。
虚拟操作系统发出的网络帧被VirtualBox的NAT引擎接收,NAT引擎提取出TCP/IP数据,再用宿主操作系统把数据发送出去,对宿主机上的应用程序或者跟宿主机在同一个网络上的计算机,看起来这个数据就像是宿主机上VirtualBox应用程序用宿主机IP地址发出来的一样(这时候VirtualBox类似QQ发消息)。VirtualBox收到发出去的包的响应后,重新打包重新发送给在它自己网络中的虚拟机上。

在私有网络中,虚拟机的网络地址和网络配置是从整合在VirtualBox中的DHCP服务器上接收来的。分配给虚拟机的IP地址常常是跟宿主机网络地址完全不同的地址。因为可能用NAT建立多个虚拟机网卡,第一块网卡连到私有网络上地址:10.0.2.0,第二块网卡连到:10.0.3.0,以此类推。如果因为某些原因你想要改变分配给虚拟机的IP段,请参考9.11部分“Fine-tuning the VirtualBox NAT engine”。

原文如下:

Network Address Translation (NAT) is the simplest way of accessing an external network from a virtual machine. Usually, it does not require any configuration on the host network and guest system. For this reason, it is the default networking mode in VirtualBox.

A virtual machine with NAT enabled acts much like a real computer that connects to the Internet through a router. The "router", in this case, is the VirtualBox networking engine, which maps(绘制) traffic(交通) from and to the virtual machine transparently. In VirtualBox this router is placed between each virtual machine and the host. This separation maximizes(使增加到最大限度、充分利用) security since by default virtual machines cannot talk to each other.

The disadvantage of NAT mode is that, much like a private network behind a router, the virtual machine is invisible and unreachable from the outside internet; you cannot run a server this way unless you set up port forwarding (described below).

The network frames sent out by the guest operating system are received by VirtualBox's NAT engine, which extracts(提取、提炼) the TCP/IP data and resends it using the host operating system. To an application on the host, or to another computer on the same network as the host, it looks like the data was sent by the VirtualBox application on the host, using an IP address belonging to the host. VirtualBox listens for replies to the packages sent, and repacks and resends them to the guest machine on its private network.

The virtual machine receives its network address and configuration on the private network from a DHCP server integrated into VirtualBox. The IP address thus assigned to the virtual machine is usually on a completely different network than the host. As more than one card of a virtual machine can be set up to use NAT, the first card is connected to the private network 10.0.2.0, the second card to the network 10.0.3.0 and so on. If you need to change the guest-assigned IP range for some reason, please refer to Section 9.11, “Fine-tuning the VirtualBox NAT engine”.


个人总结:NAT模式中,VirtualBox扮演一个网关的角色,对宿主机而言,VirtualBox就是一个类似于QQ、浏览器的应用程序。在VirtualBox上建了多个虚拟机,这些虚拟机的网络都设置为NAT模式。然后VirtualBox整合的DHCP服务器就会给这些虚拟机动态分配IP地址。VirtualBox的网络设置(不是虚拟机网络设置)中的NAT网络设置类似一块设置为NAT模式的网卡,一个设为NAT网络的虚拟机对应一个NatNetWork配置,第一个配置是10.0.2.0,第二个是10.0.3.0,以此类推。一般情况下这个网络地址不能改,如果改的话,参考官方文档。
网络请求是这样:VirtualBox上的虚拟机把数据发到VirtualBox的NAT引擎上(也就是网络设置中那块NAT网卡),然后这块网卡提取出数据中的TCP/IP数据,然后VirtualBox就像QQ发消息一样把这些数据发出去。在宿主机和外界计算机看来,这个消息就是VirtualBox发出来的。VirtualBox收到响应后再把这些数据重新打包,重新发送给它的虚拟机。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值