有一个虚拟机运行在 VMWare workstation 中,如何让这个虚拟机桥接到宿主机的网络上的某个 VLAN?
只有一个网口的单臂软路由,同时宿主机为 Windows,虚拟机软件为 VMware Workstation,在虚拟机中运行 OpenWrt
需要在一个网口上,利用 VLAN 实现虚拟 WAN 口上的 PPPoE 拨号和 虚拟 LAN 口上的上网服务。
vmxnet3 以获得最佳性能(vmxnet3为万兆半虚拟化网卡,默认的e1000性能很烂)
具体请参阅本文
思路是:利用 Hyper-V 命令行工具(不需要启用 Hyper-V 平台),来创建虚拟 VLAN 网卡,实现和上面步骤3一样的效果
# "Ethernet" is the available NIC that you want the VSwitch to be based on
New-VMSwitch -Name "External_network" -NetAdapterName "Ethernet"
# Create virtual adapters for each vlan you want to assign.
Add-VMNetworkAdapter -ManagementOS -Name VLAN10 -SwitchName External_network
# Then configure the interface you just created to listen for the vlan tag needed
Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName VLAN10 -Access -VlanID 10
# Now you have a virtual interface that is configured for a specific vlan. To have access to that vlan inside a virtual machine, simply change the settings from VMware Workstation Virtual Network Editor and have a vmnet that is bridged with the Hyper-V virtual NIC.
本方法的实质是桥接虚拟机网卡到 VLAN 虚拟网卡上,这样做是因为 VMware 根本没法桥接带有 VLAN Tag 的 Ethernet 帧而不得已为之。
这样做的缺点是无法让虚拟机感知到 VLAN 的存在,也就是说你不能像 eth0.2 这样直接在虚拟机里面指定 VLAN 编号,要使用某个 VLAN 必须先在宿主机设置桥接。
有一个虚拟机运行在 VMWare workstation 中,如何让这个虚拟机桥接到宿主机的网络上的某个 VLAN?
只有一个网口的单臂软路由,同时宿主机为 Windows,虚拟机软件为 VMware Workstation,在虚拟机中运行 OpenWrt
需要在一个网口上,利用 VLAN 实现虚拟 WAN 口上的 PPPoE 拨号和 虚拟 LAN 口上的上网服务。
vmxnet3 以获得最佳性能(vmxnet3为万兆半虚拟化网卡,默认的e1000性能很烂)
具体请参阅本文
思路是:利用 Hyper-V 命令行工具(不需要启用 Hyper-V 平台),来创建虚拟 VLAN 网卡,实现和上面步骤3一样的效果
# "Ethernet" is the available NIC that you want the VSwitch to be based on
New-VMSwitch -Name "External_network" -NetAdapterName "Ethernet"
# Create virtual adapters for each vlan you want to assign.
Add-VMNetworkAdapter -ManagementOS -Name VLAN10 -SwitchName External_network
# Then configure the interface you just created to listen for the vlan tag needed
Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName VLAN10 -Access -VlanID 10
# Now you have a virtual interface that is configured for a specific vlan. To have access to that vlan inside a virtual machine, simply change the settings from VMware Workstation Virtual Network Editor and have a vmnet that is bridged with the Hyper-V virtual NIC.
本方法的实质是桥接虚拟机网卡到 VLAN 虚拟网卡上,这样做是因为 VMware 根本没法桥接带有 VLAN Tag 的 Ethernet 帧而不得已为之。
这样做的缺点是无法让虚拟机感知到 VLAN 的存在,也就是说你不能像 eth0.2 这样直接在虚拟机里面指定 VLAN 编号,要使用某个 VLAN 必须先在宿主机设置桥接。