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

相关文章

Linux 网络编程 --- 应用层

一、自定义协议和序列化反序列化 代码: 序列化反序列化实现网络版本计算器 二、HTTP协议 1、谈两个简单的预备知识 https://www.baidu.com/ --- 域名 --- 域名解析 --- IP地址 http的端口号为80端口,https的端口号为443 url为统一资源定位符。CSDNhttps://mp.csdn.net/mp_blog/creation/editor

在JS中的设计模式的单例模式、策略模式、代理模式、原型模式浅讲

1. 单例模式(Singleton Pattern) 确保一个类只有一个实例,并提供一个全局访问点。 示例代码: class Singleton {constructor() {if (Singleton.instance) {return Singleton.instance;}Singleton.instance = this;this.data = [];}addData(value)

ASIO网络调试助手之一:简介

多年前,写过几篇《Boost.Asio C++网络编程》的学习文章,一直没机会实践。最近项目中用到了Asio,于是抽空写了个网络调试助手。 开发环境: Win10 Qt5.12.6 + Asio(standalone) + spdlog 支持协议: UDP + TCP Client + TCP Server 独立的Asio(http://www.think-async.com)只包含了头文件,不依

poj 3181 网络流,建图。

题意: 农夫约翰为他的牛准备了F种食物和D种饮料。 每头牛都有各自喜欢的食物和饮料,而每种食物和饮料都只能分配给一头牛。 问最多能有多少头牛可以同时得到喜欢的食物和饮料。 解析: 由于要同时得到喜欢的食物和饮料,所以网络流建图的时候要把牛拆点了。 如下建图: s -> 食物 -> 牛1 -> 牛2 -> 饮料 -> t 所以分配一下点: s  =  0, 牛1= 1~

poj 3068 有流量限制的最小费用网络流

题意: m条有向边连接了n个仓库,每条边都有一定费用。 将两种危险品从0运到n-1,除了起点和终点外,危险品不能放在一起,也不能走相同的路径。 求最小的费用是多少。 解析: 抽象出一个源点s一个汇点t,源点与0相连,费用为0,容量为2。 汇点与n - 1相连,费用为0,容量为2。 每条边之间也相连,费用为每条边的费用,容量为1。 建图完毕之后,求一条流量为2的最小费用流就行了

poj 2112 网络流+二分

题意: k台挤奶机,c头牛,每台挤奶机可以挤m头牛。 现在给出每只牛到挤奶机的距离矩阵,求最小化牛的最大路程。 解析: 最大值最小化,最小值最大化,用二分来做。 先求出两点之间的最短距离。 然后二分匹配牛到挤奶机的最大路程,匹配中的判断是在这个最大路程下,是否牛的数量达到c只。 如何求牛的数量呢,用网络流来做。 从源点到牛引一条容量为1的边,然后挤奶机到汇点引一条容量为m的边

模版方法模式template method

学习笔记,原文链接 https://refactoringguru.cn/design-patterns/template-method 超类中定义了一个算法的框架, 允许子类在不修改结构的情况下重写算法的特定步骤。 上层接口有默认实现的方法和子类需要自己实现的方法

【iOS】MVC模式

MVC模式 MVC模式MVC模式demo MVC模式 MVC模式全称为model(模型)view(视图)controller(控制器),他分为三个不同的层分别负责不同的职责。 View:该层用于存放视图,该层中我们可以对页面及控件进行布局。Model:模型一般都拥有很好的可复用性,在该层中,我们可以统一管理一些数据。Controlller:该层充当一个CPU的功能,即该应用程序

迭代器模式iterator

学习笔记,原文链接 https://refactoringguru.cn/design-patterns/iterator 不暴露集合底层表现形式 (列表、 栈和树等) 的情况下遍历集合中所有的元素

《x86汇编语言:从实模式到保护模式》视频来了

《x86汇编语言:从实模式到保护模式》视频来了 很多朋友留言,说我的专栏《x86汇编语言:从实模式到保护模式》写得很详细,还有的朋友希望我能写得更细,最好是覆盖全书的所有章节。 毕竟我不是作者,只有作者的解读才是最权威的。 当初我学习这本书的时候,只能靠自己摸索,网上搜不到什么好资源。 如果你正在学这本书或者汇编语言,那你有福气了。 本书作者李忠老师,以此书为蓝本,录制了全套视频。 试