VMware

New Nested Properties for Navigating to Parent Objects in PowerCLI 4.1 | Main | Get-HeadsUp | Register-TechnologyExchange@VMword2010

July 30, 2010

Enhanced VMkernel Networking Configuration in vSphere PowerCLI 4.1

You can now use PowerCLI to manipulate VMKernel networking and routing. There is a new functionality that supports setting a default gateway for VMKernel networks as well as creating, removing and updating of host routes.

Here is an example illustrating how to set a default gateway for VMKernel. All you need is to have a configured VMKernel adapter in the same subnet as the gateway you want to set to default. Let’s say you want to set a default gateway 10.21.84.1. First you should check which VMKernel adapter to use:

Get-VMHostNetworkAdapter  -VMKernel | select 'Ip', 'SubnetMask', 'DeviceName'

IP     SubnetMask    DeviceName

-------------------    ---------- ----------

10.21.84.39   255.255.255.0     vmk1

10.21.113.249    255.255.252.0     vmk0

 

You should select the vmk1 network adapter which is in the same subnet as the default gateway:

# Example 1: Setting the default VMKernel gateway

$net = Get-VMHostNetwork

$net | Set-VMHostNetwork -VMKernelGateway '10.21.84.1' -VMKernelGatewayDevice 'vmk1'

 

The next example illustrates creating a VMKernel route that splits the VMKernel traffic. Looking at the previous example you can see that the vmk0 device is in a subnet with a host IP range (10.21.112.1 - 10.21.115.254). Below there is a sample code that splits the VMKernel traffic for the (10.21.113.0 – 10.21.113.255) and (10.21.114.0 – 10.21.114.255) subnets to different gateways:

# Example 2: Creating host routes

New-VMHostRoute -Destination '10.21.113.0' -PrefixLength 24 -Gateway '10.21.113.1'

New-VMHostRoute -Destination '10.21.114.0' -PrefixLength 24 -Gateway '10.21.114.1'

 

You can remove these routes using the Get-VMHostRoute and Remove-VMHostRoute cmdlets:

#Example 3: Removing host routes

Get-VMHostRoute  | where { $_.Destination -eq "10.21.113.0"} | Remove-VMHostRoute

Get-VMHostRoute  | where { $_.Destination -eq "10.21.114.0"} | Remove-VMHostRoute

 

For more details about host routing with PowerCLI 4.1, see the cmdlets help and the online documentation.

Regards,

Gospodin Gochkov

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8341c328153ef0133f2b8dc51970b

Listed below are links to weblogs that reference Enhanced VMkernel Networking Configuration in vSphere PowerCLI 4.1:

Comments

Post a comment

If you have a TypeKey or TypePad account, please Sign In.

About this Blog

This blog provides insight and highlights for VMware PowerCLI, the best tool for automating management and configuration of VMware vSphere.

Subscribe via RSS  

Recommended Reading

Pimp your PowerCLI

Twitter


Facebook

    VMware Blogs