VBox 对网络模式 增强

2024-04-04 02:18
文章标签 模式 网络 增强 vbox

本文主要是介绍VBox 对网络模式 增强,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

 

在之前的Blog里提到了VBox 的4中网络类型:

NAT

Bridged Adapter

Internal

Host-onlyAdapter

 

具体参考:

Oracle Virtual Box 安装使用 说明

http://www.cndba.cn/Dave/article/635

 

今天升级了一个VBox 到4.1.8,在这个版本中对网络这块有加强,增加了UDP的支持,升级之后看了下Vbox,多了一种Generic Driver,因为之前没有留意是否有这种模式,所以这里也不能确定GenericDriver 是新版本里才有的。 不过查看了参考文档,确实有了增加的内容,这里对这部分内容做一个记录。

 

 

Virtual Box 的在线参考手册对网络模式有说明:

http://www.virtualbox.org/manual/ch06.html

 

在安装目录下面也有参考文档,有chm 和pdf 两种。

 

1.   VirtualBox 网络类型

Each of theeight networking adapters can be separately configured to operate in one of thefollowing modes:

 

1.1 Not attached

In this mode,VirtualBox reports to the guest that a network card is present, but that thereis no connection -- as if no Ethernet cable was plugged into the card. This wayit is possible to "pull" the virtual Ethernet cable and disrupt theconnection, which can be useful to inform a guest operating system that nonetwork connection is available and enforce a reconfiguration.

 

1.2 Network AddressTranslation (NAT)

If all you wantis to browse the Web, download files and view e-mail inside the guest, thenthis default mode should be sufficient for you, and you can safely skip therest of this section. Please note that there are certain limitations when usingWindows file sharing (see the section called “NAT limitations” fordetails).

 

1.3 Bridged networking

This is for moreadvanced networking needs such as network simulations and running servers in aguest. When enabled, VirtualBox connects to one of your installed network cardsand exchanges network packets directly, circumventing your host operatingsystem's network stack.

 

1.4 Internal networking

This can be usedto create a different kind of software-based network which is visible toselected virtual machines, but not to applications running on the host or tothe outside world.

 

1.5 Host-only networking

This can be used to create a networkcontaining the host and a set of virtual machines, without the need for thehost's physical network interface. Instead, a virtual network interface(similar to a loopback interface) is created on the host, providingconnectivity among virtual machines and the host.

 

1.6 Generic networking

Rarely usedmodes share the same generic network interface, by allowing the user to selecta driver which can be included with VirtualBox or be distributed in anextension pack.


At the moment there are potentially twoavailable sub-modes:

1.6.1 UDP Tunnel

This can be usedto interconnect virtual machines running on different hosts directly, easilyand transparently, over existing network infrastructure.

 

1.6.2 VDE (VirtualDistributed Ethernet) networking

This option canbe used to connect to a Virtual Distributed Ethernet switch on a Linux or aFreeBSD host. At the moment this needs compiling VirtualBox from sources, asthe Oracle packages do not include it.

 

2.     UDP 和 VDEnetworking

2.1 UDP Tunnel networking

This networkingmode allows to interconnect virtual machines running on different hosts.

Technically thisis done by encapsulating Ethernet frames sent or received by the guest networkcard into UDP/IP datagrams, and sending them over any network available to thehost.

 

UDP Tunnel mode has three parameters:

--udp tunnel mode 有三个参数:

(1)Source UDP port

The port onwhich the host listens. Datagrams arriving on this port from any source addresswill be forwarded to the receiving part of the guest network card.

(2)Destination address

IP address ofthe target host of the transmitted data.

(3)Destination UDP port

Port number towhich the transmitted data is sent.

 

Wheninterconnecting two virtual machines on two different hosts, their IP addressesmust be swapped. On single host, source and destination UDP ports must beswapped.

 

In the followingexample host 1 uses the IP address 10.0.0.1 and host 2 uses IP address10.0.0.2. Configuration via command-line:

        VBoxManage modifyvm "VM 01 on host1" --nic<x> generic

       VBoxManage modifyvm "VM 01 on host 1" --nicgenericdrv<x>UDPTunnel

       VBoxManage modifyvm "VM 01 on host 1" --nicproperty<x>dest=10.0.0.2

       VBoxManage modifyvm "VM 01 on host 1" --nicproperty<x>sport=10001

       VBoxManage modifyvm "VM 01 on host 1" --nicproperty<x>dport=10002

 

and

       VBoxManage modifyvm "VM 02 on host 2" --nic<y> generic

       VBoxManage modifyvm "VM 02 on host 2" --nicgenericdrv<y>UDPTunnel

       VBoxManage modifyvm "VM 02 on host 2" --nicproperty<y>dest=10.0.0.1

       VBoxManage modifyvm "VM 02 on host 2" --nicproperty<y>sport=10002

       VBoxManage modifyvm "VM 02 on host 2" --nicproperty<y>dport=10001

 

Of course, youcan always interconnect two virtual machines on the same host, by setting thedestination address parameter to 127.0.0.1 on both. It will act similarly to"Internal network" in this case, however the host can see the networktraffic which it could not in the normal Internal network case.

 

Note

On Unix-basedhosts (e.g. Linux, Solaris, Mac OS X) it is not possible to bind to ports below1024 from applications that are not run by root. As a result, if you tryto configure such a source UDP port, the VM will refuse to start.

 

2.2 VDE networking

VirtualDistributed Ethernet (VDE[30]) is a flexible, virtual networkinfrastructure system, spanning across multiple hosts in a secure way. Itallows for L2/L3 switching, including spanning-tree protocol, VLANs, and WANemulation. It is an optional part of VirtualBox which is only included in thesource code.

 

The basicbuilding blocks of the infrastructure are VDE switches, VDE plugs and VDE wireswhich inter-connect the switches.

 

The VirtualBox VDE driver has oneparameter:

--VDE driver 只有一个参数:

VDE network

The name of theVDE network switch socket to which the VM will be connected.

 

The following basic example shows how to connect a virtual machine to a VDE switch:

1.Create a VDE switch:

vde_switch -s/tmp/switch1

 

2.Configuration via command-line:

VBoxManage modifyvm "VM name"--nic<x> generic

VBoxManage modifyvm "VM name"--nicgenericdrv<x> VDE

 

To connect to automatically allocatedswitch port, use:

VBoxManagemodifyvm "VM name" --nicproperty<x> network=/tmp/switch1

 

To connect to specific switch port<n>, use:

VBoxManagemodifyvm "VM name" --nicproperty<x>network=/tmp/switch1[<n>]

 

The latter option can be useful for VLANs.

 

Optionally map between VDE switch port andVLAN: (from switch CLI)

vde$ vlan/create <VLAN>

vde$ port/setvlan <port> <VLAN>

 

VDE is availableon Linux and FreeBSD hosts only. It is only available if the VDE software andthe VDE plugin library from the Virtual Square project are installed on thehost system. For more information on setting up VDE networks, please see thedocumentation accompanying the software.

 

 

 

 

-------------------------------------------------------------------------------------------------------

版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!

QQ:492913789

Email:ahdba@qq.com

Blog:  http://www.cndba.cn/dave

Weibo:    http://weibo.com/tianlesoftware

Twitter:  http://twitter.com/tianlesoftware

Facebook: http://www.facebook.com/tianlesoftware

Linkedin: http://cn.linkedin.com/in/tianlesoftware


 

-------加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请----

DBA1 群:62697716(满);   DBA2 群:62697977(满)  DBA3 群:62697850(满)  

DBA 超级群:63306533(满);  DBA4 群:83829929   DBA5群: 142216823

DBA6 群:158654907    DBA7 群:172855474  

这篇关于VBox 对网络模式 增强的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/874565

相关文章

Android使用java实现网络连通性检查详解

《Android使用java实现网络连通性检查详解》这篇文章主要为大家详细介绍了Android使用java实现网络连通性检查的相关知识,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录NetCheck.Java(可直接拷贝)使用示例(Activity/Fragment 内)权限要求

Go语言实现桥接模式

《Go语言实现桥接模式》桥接模式是一种结构型设计模式,它将抽象部分与实现部分分离,使它们可以独立地变化,本文就来介绍一下了Go语言实现桥接模式,感兴趣的可以了解一下... 目录简介核心概念为什么使用桥接模式?应用场景案例分析步骤一:定义实现接口步骤二:创建具体实现类步骤三:定义抽象类步骤四:创建扩展抽象类步

C++中的解释器模式实例详解

《C++中的解释器模式实例详解》这篇文章总结了C++标准库中的算法分类,还介绍了sort和stable_sort的区别,以及remove和erase的结合使用,结合实例代码给大家介绍的非常详细,感兴趣... 目录1、非修改序列算法1.1 find 和 find_if1.2 count 和 count_if1

Redis中群集三种模式的实现

《Redis中群集三种模式的实现》Redis群集有三种模式,分别是主从同步/复制、哨兵模式、Cluster,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面... 目录1. Redis三种模式概述2、Redis 主从复制2.1 主从复制的作用2.2 主从复制流程2

深入理解MySQL流模式

《深入理解MySQL流模式》MySQL的Binlog流模式是一种实时读取二进制日志的技术,允许下游系统几乎无延迟地获取数据库变更事件,适用于需要极低延迟复制的场景,感兴趣的可以了解一下... 目录核心概念一句话总结1. 背景知识:什么是 Binlog?2. 传统方式 vs. 流模式传统文件方式 (非流式)流

Python实现简单封装网络请求的示例详解

《Python实现简单封装网络请求的示例详解》这篇文章主要为大家详细介绍了Python实现简单封装网络请求的相关知识,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录安装依赖核心功能说明1. 类与方法概览2.NetHelper类初始化参数3.ApiResponse类属性与方法使用实

Debian 13升级后网络转发等功能异常怎么办? 并非错误而是管理机制变更

《Debian13升级后网络转发等功能异常怎么办?并非错误而是管理机制变更》很多朋友反馈,更新到Debian13后网络转发等功能异常,这并非BUG而是Debian13Trixie调整... 日前 Debian 13 Trixie 发布后已经有众多网友升级到新版本,只不过升级后发现某些功能存在异常,例如网络转

C#和Unity中的中介者模式使用方式

《C#和Unity中的中介者模式使用方式》中介者模式通过中介者封装对象交互,降低耦合度,集中控制逻辑,适用于复杂系统组件交互场景,C#中可用事件、委托或MediatR实现,提升可维护性与灵活性... 目录C#中的中介者模式详解一、中介者模式的基本概念1. 定义2. 组成要素3. 模式结构二、中介者模式的特点

Python开发简易网络服务器的示例详解(新手入门)

《Python开发简易网络服务器的示例详解(新手入门)》网络服务器是互联网基础设施的核心组件,它本质上是一个持续运行的程序,负责监听特定端口,本文将使用Python开发一个简单的网络服务器,感兴趣的小... 目录网络服务器基础概念python内置服务器模块1. HTTP服务器模块2. Socket服务器模块

Go语言网络故障诊断与调试技巧

《Go语言网络故障诊断与调试技巧》在分布式系统和微服务架构的浪潮中,网络编程成为系统性能和可靠性的核心支柱,从高并发的API服务到实时通信应用,网络的稳定性直接影响用户体验,本文面向熟悉Go基本语法和... 目录1. 引言2. Go 语言网络编程的优势与特色2.1 简洁高效的标准库2.2 强大的并发模型2.