Script for VMkernel Port of vMA error

I used this script in the past for various automated creations (thanks to Lamw).  But I seem to have a problem at the level of the #32 (in bold and in blue) line in the script.  When I try to create the VMkernel port saying it in the vMA-error "cannot add the vmkernel nic: a specified parameter was not correct. ««» Vim.Host.VirtualNic.Specification.Ip ".  Can someone please look at what the problem with the script of m?  Thanks to advanced.

Here is my Config file

esxiserver.mydoamin.com:vSwitch1:ISCSI01:125:167.237.125.38:255.255.255.128

Here's the Script:

#! / bin/sh

If [$#-1]; then
echo "Please indicate the configuration input file.
Output 1
FI

CONFIG = $1

FIRST_HOST = $(head-1 ${CONFIG} | awk-F ":" '{print $1}')
source/opt/vmware/vma/bin/vifptarget if ${FIRST_HOST} > / dev/null 2 > & 1

If [$?-eq 0]; then
IFS = $' \n '.
for the LINE $(cat ${CONFIG});
do
VIHOST = $(echo ${LIGNE} | awk-F ":" '{print $1}')
VSWITCH = $(echo ${LIGNE} | awk-F ":" '{print $2}")
PORTGROUP = $(echo ${LIGNE} | awk-F ":" '{print $3}")
VLAN = $(echo ${LIGNE} | awk-F ":" '{print $4}')
IP = $(echo ${LIGNE} | awk-F ":" '{print $5}')
NETMASK = $(echo ${LIGNE} | awk-F ":" '{print $6}")
echo ' create a new vSwitch with frames ${VSWITCH} on target ${VIHOST} ".
/ usr/bin/esxcfg-vswitch - server $ of {VIHOST} - ${VSWITCH}
/ usr/bin/esxcfg-vswitch - m - 9000 Server ${VIHOST} {VSWITCH}
/ usr/bin/esxcfg-vswitch - Server ${VIHOST}-L vmnic2 ${VSWITCH}
/ usr/bin/esxcfg-vswitch - Server ${VIHOST}-L vmnic3 ${VSWITCH}
echo "adding new portgroup ${PORTGROUP} with VLAN ${VLAN}.
/ usr/bin/esxcfg-vswitch - Server ${VIHOST}-{PORTGROUP} ${VSWITCH}
/ usr/bin/esxcfg-vswitch - Server ${VIHOST} {PORTGROUP} Pei - v ${VLAN} ${VSWITCH}
echo "Creating VMkernel Port ${PORTGROUP} with IP ${IP} PORTGROUP $ {PORTGROUP}.

/usr/bin/esxcfg-vmknic - Server ${VIHOST} - a-i ${IP} - n {MASK} m $9000 {PORTGROUP} -what IS the ERROR in THE SCRIPT

ECHO
fact
unset IFS
on the other
echo "failed to initialize the vi-fastpass on target ${FIRST_HOST}".
Output 1

If you script is called blah.sh, rather than run comme./blah.sh run it with sh - x blah.sh. This produces a result more to see what variables/etc. get the script runs through its logic. It's an easy way to debug

The error you see is nothing with the script, I think whether you're creating a portgroup, then the interface back to back and it might happen too fast and so you get an error with the entry. Easy way to check this is to add sleep command before you create the VMkernel interface and see if that helps

Tags: VMware

Similar Questions

  • Get-VirtualPortGroup with filter for VMKernel ports only

    I know that this query does not work, but I don't know how to reformat it to make it work.

    Get-VirtualSwitch -Name vSwitch0 -VMHost myhost | Get-VirtualPortGroup | where {$_.Port.Type -eq "host"}
    
    I tried to use Select-Object - ExpandProperty Port, but I could only operate when you query a single port
    I can break it down to a specific network port to see values

    Get-VirtualSwitch -Name vSwitch0 -VMHost myhost | Get-VirtualPortGroup | where {$_.Name -eq "Management Network"} | Format-List *
    

    gives output like below

    Name              : Management Network
    VirtualSwitchId   : key-vim.host.VirtualSwitch-vSwitch0
    VirtualSwitchUid  : /VIServer=admin@vcenter:443/VMHost=HostSystem-ho
                        st-7786/VirtualSwitch=key-vim.host.VirtualSwitch-vSwitch0/
    VirtualSwitch     : vSwitch0
    Key               : key-vim.host.PortGroup-Management Network
    Port              : {host}
    VLanId            : 1039
    VirtualSwitchName : vSwitch0
    VMHostId          : HostSystem-host-7786
    VMHostUid         : /VIServer=admin@vcenter:443/VMHost=HostSystem-ho
                        st-7786/
    Uid               : /VIServer=admin@vcenter:443/VMHost=HostSystem-ho
                        st-7786/VirtualSwitch=key-vim.host.VirtualSwitch-vSwitch0/V
                        irtualPortGroup=key-vim.host.PortGroup-Management Network/
    ExtensionData     : VMware.Vim.HostPortGroup
    
    

    But given that the Port is a table enclosed in {} I don't know how to structure the query.

    I can get the values of the Port table for a unique group of ports, but I'm looking to filter all groups in port with the Type of "home".

    (Get-VirtualSwitch -Name vSwitch0 -VMHost myhost | Get-VirtualPortGroup | where {$_.Name -eq "Management Network"}).Port
    

    Key                            Mac                  Type
    ---                            ---                  ----
    key-vim.host.PortGroup.Port... {00:23:ae:fe:be:2c}  host
    

    Thank you.

    Maybe try

    Get-VirtualSwitch -Name vSwitch0 -VMHost myhost | Get-VirtualPortGroup | where {@("host") -contains $_.Port} | Format-List
    
    

  • Script to get the VLan ID, vSwitch, networking and group of vCenter vmkernel ports.

    Hello

    Need help to get the script of ' Script for the VLan ID, vSwitch, networking and group ports vmkernel of vCenter. "to CSV

    Any help will be much appreciated.

    Get-VMHost | {foreach}

    $vmhost = $_

    $PortGroups = $vmhost | Get-VirtualPortGroup

    $vSwitchs = $vmhost | Get-VirtualSwitch

    $pNic = $vmhost | Get-VMHostNetworkAdapter

    $Managementinfo = $pNic | Where-Object {$_.} ManagementTrafficEnabled - eq $true}

    $vMotioninfo = $pNic | Where-Object {$_.} VMotionEnabled - eq $true}

    $FTinfo = $pNic | Where-Object {$_.} FaultToleranceLoggingEnabled - eq $true}

    $vlanID = $PortGroup | Where-Object {$_.name - eq $Managementinfo.ExtensionData.spec.Portgroup} | Select-object - ExpandProperty VLanId

    {foreach ($PG in $PortGroups)

    #Management Info network

    If ($Managementinfo.PortGroupName - eq $PG.) {Name)

    $MGMTStatus = "enabled".

    $ManagementIP = $Managementinfo | Where-Object {$_.} PortGroupName - eq $PG. Name} | Select-Object - ExpandProperty IP

    }

    else {}

    $MGMTStatus = "Disabled".

    $ManagementIP = $null

    }

    #vMotion Info network

    If ($vMotioninfo.PortGroupName - eq $PG.) {Name)

    $vmotionStatus = "enabled".

    $vMotionIP = $vMotioninfo | Where-Object {$_.} PortGroupName - eq $PG. Name} | Select-Object - ExpandProperty IP

    }

    else {}

    $vmotionStatus = "Disabled".

    $vMotionIP = $null

    }

    #FT Info network

    If ($FaultToleranceLoggingEnabled.PortGroupName - eq $PG.) {Name)

    $FTStatus = "enabled".

    $ftIP = $FTinfo | Where-Object {$_.} PortGroupName - eq $PG. Name} | Select-Object - ExpandProperty IP

    }

    else {}

    $FTStatus = "Disabled".

    $ftIP = $null

    }

    #vmKernel name

    $VMKernel = $pNic | Where-Object {$_.} PortGroupName - eq $PG. Name} | Select-Object - ExpandProperty DeviceName

    $result = "" | Select-Object HostName, vSwitchName, PortGroupName, VLanID, ManagementTraffic, ManagementIP, vMotionTraffic, vMotionIP, FTTraffic, FTIP, VMKernel

    $result. Host name = $vmhost.name

    $result.vSwitchName = $PG. VirtualSwitchName

    $result. PortGroupName = $PG. Name

    $result. VLanID = $PG. VLanID

    $result. VLanID = $PG. VLanID

    $result. ManagementTraffic = $MGMTStatus

    $result. ManagementIP = $ManagementIP

    $result.vMotionTraffic = $vmotionStatus

    $result.vMotionIP = $vMotionIP

    $result. FTTraffic = $FTStatus

    $result. FTIP = $ftIP

    $result. VMKernel = $VMKernel

    $result

    }

    } | Export-Csv c:\temp\data.csv

  • Add the default gateway for the VMKernel port group

    Hello

    I use this script to create a VMkernel port group, but the last part of the gateway address of updates to script for all groups of VMKernel ports. How can I change the script so it adds the passage for the 55-CHI-VMKernel port group only. Thank you.

    $hostname6 = "host1".
    $pg = New-VirtualPortGroup-55-CHI-VMKernel - VirtualSwitch "vSwitch1' name - VLanId 55

    New-VMHostNetworkAdapter - VMHost $hostname6 - $pg PortGroup - VirtualSwitch "vSwitch1' - '10.33.1.77' IP - subnet"255.255.255.0"- ManagementTrafficEnabled $true mask

    IP address of the gateway #Add
    $netMgr = get-View (Get-VMHost $hostname6 |) Get - View).ConfigManager.NetworkSystem
    $iproute = new-Object VMware.Vim.HostIpRouteConfig
    $iproute.defaultGateway = "10.33.1.3".
    $netMgr.UpdateIpRouteConfig ($iproute)

    Have you tried it like that?

    $hostname6 = 'host1' $pg = New-VirtualPortGroup -Name 55 - CHI-VMKernel -VirtualSwitch "vSwitch1" -VLanId 55
    New-VMHostNetworkAdapter -VMHost $hostname6 -PortGroup $pg -VirtualSwitch "vSwitch1" -IP "10.33.1.77" -SubnetMask "255.255.255.0" -ManagementTrafficEnabled $true
    #Add gateway IP address
    $netMgr = Get-View (Get-VMHost $hostname6 | Get-View).ConfigManager.NetworkSystem $iproute = New-Object VMware.Vim.HostIpRouteConfig $iproute.defaultGateway = "10.33.1.3"$iproute.GatewayDevice = "vmk0"$netMgr.UpdateIpRouteConfig($iproute)
    
  • Why vmkernel port for iscsi and vmotion services?

    Hello

    Just a quick question.

    I was trying to understand - why we need to have a vmkernel port when we want to use features such as vmotion or iscsi.

    Why not use them with a console port service or a port of vm management traffic.

    No particular reason.

    Thank you

    Yes. You're not really all that traffic produced by DRS and vMotion actions in your production (maybe time critical).

    Concerning

  • Access NAS storage of ESXi Server using VMKernel Port?

    Hello

    I would like to know the best procedure to connect to the NAS storage of ESXi host 5. I am able to connect to the NAS storage according to the screenshots listed in the link below.

    http://www.tintri.com/blog/2011/11/connecting-vSphere-to-NFS-the-easy-way/

    But, I saw different configurations in the past where port dedicated VMkernel is assigned to NAS and all storage goes into network 10 G. I try to do the same and created a VMkernel for NAS port. But I don't think that traffic is going over there as it is not used at all.

    I gave the IP address of the ESXi server on the NAS box to get access. I couldn't give address IP VMkernel sideways NAS. How can I make use of this IP VMKernel dedicated NFS storage?

    I want to implement the best way to pass NAS 10 G network traffic. In addition, How can I test if storage traffic crosses VMkernel port?

    Suggestions needed.

    Virtualinfra is right that you must use a different subnet for NFS traffic. You masked the IP range, so I don't see what you use, but make sure that the vmkernel and storage using a single subnet, not the management subnet. If you get an error, your use of a subnet that goes out the default gateway of the management port, or that you are using the same subnet.

    I wrote a few articles on the use of NFS with vSphere: http://wahlnetwork.com/2012/04/19/nfs-on-vsphere-a-few-misconceptions/

    Also, make sure that the vmnic can route traffic on that subnet, as in the case of the use of VLANs.

  • Creating multiple vmkernel ports

    Hi all

    I have a script that will create a vmkernel on each host in turn like that

    1. Create new VMKernel Port in vSwitch0 on each host to student

    New-VMHostNetworkAdapter - $stuSvr01 - PortGroup $vpgName VirtualSwitch - $vs1 - IP 172.19.1.41 - VMHost 255.255.255.0 subnet mask

    New-VMHostNetworkAdapter - $stuSvr02 - PortGroup $vpgName VirtualSwitch - $vs2 - IP 172.19.1.42 - VMHost 255.255.255.0 subnet mask

    This makes the scripts I write long enough that I do a lot of configuration vNetwork.  Is there a way I can create two tables, one with host names and the other with IP information and order custom foreach method is used?  I tried to make it work, but cannot find a way to get the values of the second table.  I tried to put the parameters in a hash table, but I was unable to find code examples for how the reference values.

    Any help would be welcome.

    Why don't you use a CSV file with all the information in there.

    Easier is to use a header line, something like this

    Server,IPaddr
    srv1,192.168.10.1
    srv2,192.168.10.2
    ...
    

    You can then browse all the rows in the CSV file like this.

    ...
    Import-Csv "C:\data.csv" | %{
       New-VMHostNetworkAdapter -VMHost $_.Server -PortGroup $vpgName -VirtualSwitch $vs1 -IP $_.IpAddr -SubnetMask 255.255.255.0
    }
    ...
    

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Community port-a-thon - error with applications accepted/releases

    Hello

    I've had a few requests of BB10 prepared during AllAboard port-a-thon, apps have been accepted, and I got information about the awards.

    Later, I have prepared something new (I improved the UI) and I downloaded the new versions. My problem is that I downloaded last weekend, in the community of port-a-thon. So, yesterday, I received by e-mail with the information that I get rewards of money for my 3 options for use. But it was just a new version, not a new application! I was even not recorded for the ptt community - I have had no new apps so I is not registered myself.

    I think it's unfair, I would ask RIM to stop my payment process for the port-o-thon community (for 3 apps).

     

    BTW: I know not if it is the error of someone or a bug in their system - if it's bug, someone can use it to get money just for new versions.

    I don't know the RIM email where I should send it this information, so for now I send him here, meybe a RIM person find.

    Thanks for reporting this.  I have to inform the owners of program which will focus on this.

  • Help with dynamic scripting for drift property

    Hello

    I try to get the list nodes children, then loopthorugh the nodes to do some calculations in a property derived by using dynamic scripts. I tried with the below script.

    var childEnumerator is node. GetChildEnumerator();

    While (childEnumerator.MoveNext ())

    {

    var varValeurProp = childEnumerator.GetCurrent (). PropValue ("Custom.Salary");

    Print (propvalue);

    }

    While evaluating this script, I get an error below. No idea what I'm missing here?

    DRM-16008: there was a calculation Script Custom.TotalSalaryExp for EMP_Zone/Emp/PPD1 property error: TypeError: 'GetChildEnumerator' is not a function

    Please help me. Thank you fr your cooperation

    Kind regards

    Nathalie

    Try this instead...

    var childEnumerator is node. GetChildEnumerator();

    childEnumerator.MoveNext ();

    While (childEnumerator.GetCurrent ()! = null)

    {

    var varValeurProp = childEnumerator.GetCurrent (). PropValue ("Custom.Salary");

    Print (propvalue);

    childEnumerator.MoveNext ();

    }

  • Script for the Configuration DVSwitch

    Hello

    Someone at - it a script for the information of VDS on the level of the host which nic is connected to what uplink?

    Also to remove all Exchange created in the VDS switch for the host and then recreate the exchanges as they were after the connection to the host to a vCenter diff?

    Also any script to copy the resource through VCenter pools?

    Thank you

    Suraj Rawat

    The following script will export information of VDS for uplink, the port they are in and what Teddy is used by node ESXi.

    $report = {foreach ($dvSw in Get-VDSwitch)

    foreach ($esx in (Get-View-id $dvSw.ExtensionData.Summary.HostMember)) {}

    $proxy = $esx.Config.Network.ProxySwitch | where {$_.} {DvsUuid - eq $dvSw.ExtensionData.Uuid}

    $pnicTab = @ {}

    $proxy. Spec.Backing.PnicSpec | %{

    $pnicTab.Add ($_.) UplinkPortKey, $_. PnicDevice)

    }

    $proxy. UplinkPort |

    Select @{N = "vdSwitch"; {E = {$dvSw.Name}}.

    @{N = "$vmhost"; E = {$esx. Name}},

    @{N = "vNIC"; E = {$pnicTab [$_]} Key]}},

    @{N = "Uplink"; E={$_. Value}},

    @{N = 'Port'; E={$_. Key}}

    }

    }

    $report | Export Csv C:\dvSw-Uplink.csv - NoTypeInformation - UseCulture

  • Get the number of VMkernel Ports on a vDS

    I've searched and just can not find the code snippet to read the number of Ports VMkernel on distributed switch.

    Anyone got an excerpt?

    The following PowerCLI command will give you a list of the number of VMKernel ports for all of your distributed switches:

    Get-VDSwitch | Select-Object - property name,

    @{Name = "Number of VMKernel ports"; Expression = {($_ |)} Get-VMHostNetworkAdapter | Where-Object {$_.} {DeviceName as "vmk *"} | Measure - Object). County}}

  • Put virtual machines inside the VMkernel port group

    Hello

    Network for administrators of VMware SIAS layout:

    "You can not put VMs within that group of port because it is made especially for a VMkernel port."

    However, I use ESXi 5.5 and is able to put normal interface of VM inside the vmk port group. (I only created 1 vmk port group so all virtual machines in the same group with the vmkernel interface)

    May I know if this is a new feature, or something is wrong?

    Thank you!

    This may be possible with distributed switches not with standard switches.

  • How is it that I can ping between ESXi vmkernel interfaces with the sizes of package exceeding the value set in my passage upstream and one located in my vmkernel port group itself?


    I have a 10 GB dell powerconnect 8024f the switch and the firmware is OLD, but the port config shows maximum frame size = 9000 to all cable ports

    2 guests ESXi 5.5 wired, build 1331820, put each host computer network is managed by a single port dual qlogic 8150 ANC

    When I connect to my windows VM to check my new 10 GB connectivity (it is configured for jumbo mtu = 9000 frames) and ping-l 8190 against ESXi vmkernel interface that was MTU of 1500, I get an answer without any packet loss... How can it be if the port is configured for only 1500 MTU?  I thought that the two vmkernel port group and vswitch properties must have 9000 mtu defined, it appears that the vswitch properties override the port group properties.

    But I know I must be missing something, a few important concepts, somewhere, because when I connect to ESXi via ssh I can ping devices with values greater than 8190 and not just windows virtual machines that reside on the same host where the ping uses the internal bus, but I am referring to the connections of the host of other ESXi on the switch management.

    In summary - how the VMkernel does ping and response to pings of bigger sizes greater than the value of the switch upstream?   and why do ping with large packets get answers when the vmkernel port group is always set at 1500, is this a bug or is this feature obsolete?   I remember specifically in ESXi5 that I had to configure the vmkernel port group and the vswitch for this property to work.

    Unless you specify "Don ' t fragment" (-f for Windows) you will be able to use any size package successfully.

    For ESXi, take a look at Troubleshooting ESXi Jumbo Frames.

    André

  • VMKernel port group

    Here is the configuration of the network of one of our hosts ESX 4.1:

    (1) the virtual computer network

    (2) Service with 1 IP console

    (3) VMKernel with 1 IP for vMotion and iSCSI, called as VMKernel_iSCI

    I can see there are 4 NICs attached to this host.

    Now, I just know, that same using iSCSI and vMotion VMKernel is not a good practice.

    question 1

    So I would like to know how is the mapping of the ESX host's network. Is this;

    1 NETWORK card = 1 VM Network

    1 NETWORK card = 1 Service Console

    1 card NETWORK = 1 which is currently used for iscsi and vmotion VMKernel port group

    In a standard switch, there are 2 network cards configured.

    2nd question

    I want to delete 1 port VMKernal vmotion (VMKernel_iSCI) and create a dedicated for vmotion.

    I know that I have will require another IP address, but what of NIC, it will be;

    1 NETWORK card = VMKernel_iSCSI

    1 NETWORK card = VMKernel_vMotion

    Please explain.

    Thank you

    Mihir

    From a pure technical point of view, it will work, as long as your network is configured properly (i.e. taking advantage of VLAN and the separate subnets on management, vMotion and iSCSI). However, I am worried about the bandwidth and quarrels with such a configuration.

    BTW. except if you've already seen it, I would recommend that you take a look at http://www.vmware.com/files/pdf/virtual_networking_concepts.pdf

    André

  • Definition of VLAN ID on vmkernel ports on dVS - Nexus 1000

    I noticed when adding vmkernel ports to a host on the dVS I'm not presented with an option to enter a VLAN ID. Is it because the VLANS is defined at the level of the port on the Nexus Group? Is there a need for me to create these ports on a vSwitch first to set the VLAN and then migrate them to the dVS?

    Thank you

    JD

    The VLAN ID is controlled by the port-profile on the VSMs 1000v. You don't have to specify it.

Maybe you are looking for