none
如何不使用SCVMM启用vswitch的trunk功能? RRS feed

  • 问题

  • 用3台服务器安装WIN2012 R2,做hyper-v集群,如何在不使用SCVMM的情况下,通过powershell启用vswitch的trunk功能?
    2014年9月19日 13:37

答案

  • You don't need to do anything. 

    Here's how that works in Server 2012 R2:

    • You have a physical NIC or NIC team on a host (physical server),
    • You have that wired to one or more swtiches
    • On the switches you configure the switch ports as Trunk port (no VLAN 802.1q tagging) and allow the VLANs you wish to use. For example, VLANs 100-199
    • On the Server 2012 R2 host, you setup an external vSwitch, attach it to the NIC or NIC team.
    • You setup VLAN tagging per vNIC.
    • For example, to attach a vNIC to the parent partition (host) and put that on VLAN 113, in Hyper-V Manager, right-click on the host, select vSwitch Manager, check the "Allow Management Operating..", and check the box next to VLAN ID, and enter the numerical value of the VLAN ID below it:
    • Similarly to VLAN tag a VNIC that is attached to a child partition (VM), in Hyper-V Manager, you right-click on the VM, click Settings, click on the network adapter, check the VLAN ID box, and type in the VLAN ID 

    Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable) _________________________________________________________________________________ Powershell: Learn it before it's an emergency http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx

    • 已标记为答案 wingsong 2014年9月22日 1:47
    2014年9月19日 14:53
  • Hi Sam,thanks for your repley! As you say, two vlans (113&114) will use the vswitch vGuest,what should I do?
    Like I said, you don't do anything on the vSwitch, you setup VLAN assignment on each vNIC

    Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable) _________________________________________________________________________________ Powershell: Learn it before it's an emergency http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx

    • 已标记为答案 wingsong 2014年9月22日 1:45
    2014年9月19日 19:12
  • How can I enable trunk mode in the vswitch without using SCVMM?I am using the WIN2012 R2 without SCVMM.As show below,hou can I set "External" mode to trunk?
    
    2014年9月19日 13:41

全部回复

  • How can I enable trunk mode in the vswitch without using SCVMM?I am using the WIN2012 R2 without SCVMM.As show below,hou can I set "External" mode to trunk?
    
    2014年9月19日 13:41
  • You don't need to do anything. 

    Here's how that works in Server 2012 R2:

    • You have a physical NIC or NIC team on a host (physical server),
    • You have that wired to one or more swtiches
    • On the switches you configure the switch ports as Trunk port (no VLAN 802.1q tagging) and allow the VLANs you wish to use. For example, VLANs 100-199
    • On the Server 2012 R2 host, you setup an external vSwitch, attach it to the NIC or NIC team.
    • You setup VLAN tagging per vNIC.
    • For example, to attach a vNIC to the parent partition (host) and put that on VLAN 113, in Hyper-V Manager, right-click on the host, select vSwitch Manager, check the "Allow Management Operating..", and check the box next to VLAN ID, and enter the numerical value of the VLAN ID below it:
    • Similarly to VLAN tag a VNIC that is attached to a child partition (VM), in Hyper-V Manager, you right-click on the VM, click Settings, click on the network adapter, check the VLAN ID box, and type in the VLAN ID 

    Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable) _________________________________________________________________________________ Powershell: Learn it before it's an emergency http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx

    • 已标记为答案 wingsong 2014年9月22日 1:47
    2014年9月19日 14:53
  • You get trunking enabled by default - the VLAN id is set at the vNIC.

    Unless you are referring to what they call 'VLAN trunk mode':  http://technet.microsoft.com/en-us/library/jj679878.aspx#bkmk_pvlan

    In addition to PVLAN, Hyper-V Virtual Switch also provides support for VLAN trunk mode. Trunk mode provides network services or network appliances on a VM with the ability to see traffic from multiple VLANs.

    In trunk mode, a switch port receives traffic from all VLANs that you configure in an allowed VLAN list. You can also configure a switch port that is connected to a VM - but is not bound to the underlying NIC - for trunk mode.

    In the following example cmdlet, MyVM can send or receive traffic on any VLAN in the allowed list. If there is no VLAN specified in the packet, the packet is treated as if it is from VLAN 10.

    Set-VMNetworkAdapterVlan –VMName MyVM –Trunk –AllowedVlanIdList 1-100 –NativeVlanId 10

     


    Brian Ehlert
    http://ITProctology.blogspot.com
    Learn. Apply. Repeat.

    2014年9月19日 14:53
  • Hi Sam,thanks for your repley! As you say, two vlans (113&114) will use the vswitch vGuest,what should I do?
    2014年9月19日 15:25
  • Hi Sam,thanks for your repley! As you say, two vlans (113&114) will use the vswitch vGuest,what should I do?
    Like I said, you don't do anything on the vSwitch, you setup VLAN assignment on each vNIC

    Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable) _________________________________________________________________________________ Powershell: Learn it before it's an emergency http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx

    • 已标记为答案 wingsong 2014年9月22日 1:45
    2014年9月19日 19:12