ADVERTISE HERE

PowerCLI: Enable Beacon Probing or Link Status Only on a vSwitch

Title: PowerCLI: Enable Beacon Probing or Link Status Only on a vSwitch
Author(s): (ICT-Freak.nl) Arne Fokkema
Target Audience: Technical - Intermediate
Current Revision:
First Published: 19 October 2010
Products: VMware, vSphere
UID: XD10336

How to enable beacon probing on all your vSphere hosts on every vSwitch or on one vSphere host on a specific vSwitch

Punchy Text: 

How to enable beacon probing on all your vSphere hosts on every vSwitch or on one vSphere host on a specific vSwitch

By Arne Fokkema - ICT-Freak.nl


 VMware    Image

In some cases you need to troubleshoot your network infrastructure from your vSphere hosts all the way back into your core network. In this case you can enable beacon probing and watch your log files for issues. But before I continue to show how to enable beacon probing I want to share some information about what beacon probing is and when is it recommended to be used :

Beacon Probing is a network failover detection mechanism that sends out and listens for beacon probes on all NICs in the team and uses this information, in addition to link status, to determine link failure.

This detects failures, such as cable pulls and physical switch power failures, but not configuration errors, such as a physical switch port being blocked by spanning tree or misconfigured to the wrong VLAN or cable pulls on the other side of a physical switch that are not detected by link status alone.
Beacon probing is most useful to detect failures in the closest switch to the ESX hosts, where the failure does not cause a link-down event for the host.

You can use beaconing with 2 NICs, but this only detects failures on the immediate uplink. If you really want to detect upstream failures, use beaconing with 3 or more NICs.
When there are only two NICs in service and one of them loses connectivity it is unclear which NIC needs to be taken out of service as both no longer receive beacons. Using at least 3 NICs in such a team allows for N – 2 failures where N is the number of NICs in the team before getting into an ambiguous situation.

Source:KB1005577

 

More information about beacon probing can be found here:

http://blogs.vmware.com/networking/ and in part 4 of the great vSwitch debate:

http://kensvirtualreality.wordpress.com/2009/04/10/the-great-vswitch-debate-part-4/

You can enable beacon probing on all your vSphere hosts on every vSwitch and every portgroup via the following for each loop:

foreach($esx in (Get-VMHost)){
    Get-VirtualSwitch -VMHost (Get-VMHost $esx) | %{Get-NicTeamingPolicy -VirtualSwitch $_ | `
    Set-NicteamingPolicy -NetworkFailoverDetectionPolicy BeaconProbing}
}

if you want to enable beacon probing on one vSphere host and on a specific vSwitch you can use the following function:

Function Enable-BeaconProbing{
param(
    [parameter(Mandatory = $true)]
    [string[]]$vmHost,
    [parameter(Mandatory = $true)]
    [string[]]$vSwitch
)

Get-NicTeamingPolicy -VirtualSwitch (Get-VirtualSwitch -VMHost (Get-VMHost $vmHost) -Name "$vSwitch") | `
Set-NicteamingPolicy -NetworkFailoverDetectionPolicy BeaconProbing
}

Enable-BeaconProbing esx1.ict-freak.local vSwitch0

the following output will be generated:

Beacon Probing

To disable beacon probing on all your vSphere hosts you can run the following for each loop:

foreach($esx in (Get-VMHost)){
    Get-VirtualSwitch -VMHost (Get-VMHost $esx) | %{Get-NicTeamingPolicy -VirtualSwitch $_ | `
    Set-NicteamingPolicy -NetworkFailoverDetectionPolicy LinkStatus}
}

or the following function:

Function enable-LinkStatus{
param(
    [parameter(Mandatory = $true)]
    [string[]]$vmHost,
    [parameter(Mandatory = $true)]
    [string[]]$vSwitch
)

Get-NicTeamingPolicy -VirtualSwitch (Get-VirtualSwitch -VMHost (Get-VMHost $vmHost) -Name "$vSwitch") | `
Set-NicteamingPolicy -NetworkFailoverDetectionPolicy LinkStatus
}

Enable-LinkStatus esx1.ict-freak.local vSwitch0

output:

Link Status

If you only want to find vSphere hosts with beacon probing disabled, you can run the following script written by Luc Dekens (@LucD22):

############################################################################# 
# 
# Check if Beacon Probing is enabled 
# Source: http://poshcode.org/?show=1314 (@LucD22) 
# 
############################################################################# 

$esxhosts = get-view -ViewType hostsystem 

foreach($esx in $esxhosts){
$net = Get-View $esx.configmanager.networksystem
$vSwitches = @(%{$net.NetworkConfig.vSwitch | select Name})
$esxhosts = $esx.name 

    foreach($vSwitch in $vSwitches){
        $vSwitch = $vSwitch.Name
        # Check if vSwitch has Beacon Probing selected 
        $esx.Config.Network.Vswitch | where {$_.Name -eq $vSwitch} | %{
            if(-not $_.Spec.Policy.NicTeaming.FailureCriteria.CheckBeacon){
                "$esxhosts : Beacon Probing should be enabled on the vSwitch $vSwitch first" | Out-Host
            }
        }
    }
}

Source: Link:
VMware KB http://kb.vmware.com/
VMware http://blogs.vmware.com/networking/
Poshcode http://poshcode.org/?show=1314

Spotlight:

VMware Documentation Downloader v11.08.30

Updated for vSphere 5 - A free tool for those on the move who need information FAST

vSphere 5 License Entitlement Changes

See what has changed in the license entitlement in vSphere 5?

Thin Client vs Zero Client

The differences between Thin and Zero desktop clients for VDI

Technology Exchange: