设为首页 收藏本站
查看: 1816|回复: 0

[经验分享] VBox 对网络模式 增强

[复制链接]

尚未签到

发表于 2015-4-17 08:11:39 | 显示全部楼层 |阅读模式
  
  在之前的Blog里提到了VBox 的4中网络类型:
  NAT
  Bridged Adapter
  Internal
  Host-onlyAdapter
  
  具体参考:
  Oracle Virtual Box 安装使用 说明
  http://blog.iyunv.com/tianlesoftware/article/details/6826389
  
  今天升级了一个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 generic
  VBoxManage modifyvm "VM 01 on host 1" --nicgenericdrvUDPTunnel
  VBoxManage modifyvm "VM 01 on host 1" --nicpropertydest=10.0.0.2
  VBoxManage modifyvm "VM 01 on host 1" --nicpropertysport=10001
  VBoxManage modifyvm "VM 01 on host 1" --nicpropertydport=10002
  
  and
  VBoxManage modifyvm "VM 02 on host 2" --nic generic
  VBoxManage modifyvm "VM 02 on host 2" --nicgenericdrvUDPTunnel
  VBoxManage modifyvm "VM 02 on host 2" --nicpropertydest=10.0.0.1
  VBoxManage modifyvm "VM 02 on host 2" --nicpropertysport=10002
  VBoxManage modifyvm "VM 02 on host 2" --nicpropertydport=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 generic
  VBoxManage modifyvm "VM name"--nicgenericdrv VDE
  
  To connect to automatically allocatedswitch port, use:
  VBoxManagemodifyvm "VM name" --nicproperty network=/tmp/switch1
  
  To connect to specific switch port, use:
  VBoxManagemodifyvm "VM name" --nicpropertynetwork=/tmp/switch1[]
  
  The latter option can be useful for VLANs.
  
  Optionally map between VDE switch port andVLAN: (from switch CLI)
  vde$ vlan/create
  vde$ port/setvlan  
  
  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.
  
  
  
  
  -------------------------------------------------------------------------------------------------------
  版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!
  Email:   tianlesoftware@gmail.com
  Skype:  tianlesoftware
  Blog:     http://www.tianlesoftware.com
  Weibo:  http://weibo.com/tianlesoftware
  Twitter: http://twitter.com/tianlesoftware
  Facebook:http://www.facebook.com/tianlesoftware
  
  -------加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请----
  DBA1 群:62697716(满);   DBA2 群:62697977(满)  DBA3 群:62697850(满)  
  DBA 超级群:63306533(满);  DBA4 群:83829929   DBA5群: 142216823
  DBA6 群:158654907    DBA7 群:172855474

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-57881-1-1.html 上篇帖子: ubuntu安装完vbox没有无缝模式 下篇帖子: centos 装VBOX
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表