1)启用物理网卡的promiscuous模式

Modify the promiscuous setting for the physical interface (pif)
  1. Grab the PIF UUID by executing the following command on the XenServer host: 
    xe pif-list network-name-label=<name_of_network> 
    Where <name_of_network> is the common name for the network as it appears in XenCenter (Network 0, for example). 
    Note the UUID for the PIF because you need it for the next command.
  2. To enable promiscuous mode for the PIF, use the following command on the XenServer host: 
    xe pif-param-set uuid=<uuid_of_pif> other-config:promiscuous="true" 
    Where <uuid_of_pif> is the UUID for the PIF copied from step 1.
  3. You can verify that the option has been set by using the following command: 
    xe pif-param-list uuid=<uuid_of_pif> 
    In the output of this command you can see the following line: 
    other-config (MRW): promiscuous: true 
    This indicates that promiscuous mode is active on the PIF.
2)启用虚拟网卡的promiscuous模式
Modify the promiscuous setting for the VIF
  1. Grab the VIF UUID by using the following command on the XenServer host: 
    xe vif-list vm-name-label=<name_of_vm> 
    Where <name_of_vm> is the common name of the virtual machine as it appears in XenCenter. 
    Note the UUID for the VIF because you need it for the next command.
  2. To enable promiscuous mode for the VIF, use the following command on the XenServer host: 
    xe vif-param-set uuid=<uuid_of_vif> other-config:promiscuous="true" 
    Where <uuid_of_vif> is the UUID for the VIF copied from step 1.
  3. You can verify that the option has been set by using the following command: 
    xe vif-param-list uuid=<uuid_of_vif> 
    In the output of this command you can see the following line: 
    other-config (MRW): promiscuous: true 
    This indicates that promiscuous mode is active on the VIF.
3)重置虚拟机网卡。此步要求虚拟机里一定要安装xentools,否则会出现“需要PV driver……”这样的错误提示。
Reset the VM virtual interface to apply the change
  1. the commands below to activate the changes made above:
  2. xe vif-unplug uuid=<uuid_of_vif> 
    xe vif-plug uuid=<uuid_of_vif>
  3. disconnects and reconnects the VIF to the VM, it comes back up with promiscuous mode active. Note: Issuing the unplug command takes the VM VIF offline, bringing down the interface to the VM until you run the vif-plug command.