As he said it would be tremendously useful if you need to physically replace the server and don’t want to modify all your storage infrastructure, it’s easier to just modify the iqn of the new server and set it to the old name.
The task is as easier as the one described in last post. Using esxcli command with the iscsi namespace you can change the name and the alias of the adapter.
As a precaution first retrieve the current iqn to check that it’s the correct server.
To change the name you have to provide the adapter and the new name.
Hope you find this useful, any comments and suggestions are welcome as always.
Back in 2010 I wrote a post about how to get the iSCSI iqn of an ESXi 4.x server using vSphere CLI from the vMA or any other system with the vCLI installed on it.
The method described in that article is still valid for ESXi 5.0 since the old vicfg and esxcfg commands are still available, however with 5.0 version you can get a similar result using the new esxcli namespaces, following is how to do it.
First task is to get a list of the iSCSI HBAs in order to know the name of the software iSCSI initiator.
Next we get the info of the adapter.
Look at the Name field to get the iqn and we are done.
This a quick follow-up post to the How to check the driver version of a network interface in ESX(i) one. That post covered ESX(i) 4.x so I decided to write a small update for ESXi 5.0.
First I have to say that the two methods described in my first post still work in ESXi 5.0 Shell.
~ # vmware -l VMware ESXi 5.0.0 GA ~ # ~ # vmkload_mod -s e1000 | grep Version Version: Version 22.214.171.124-NAPI, Build: 456551, Interface: 9.2 Built on: Jul 29 2011 ~ # ~ # ethtool -i vmnic0 driver: e1000 version: 126.96.36.199-NAPI firmware-version: N/A bus-info: 0000:02:00.0 ~ #
Thanks to the new changes made by VMware in ESXi 5.0 we can now use esxcli to get the same result.
~ # esxcli system module get -m e1000 Module: e1000 Module File: /usr/lib/vmware/vmkmod/e1000 License: GPL Version: Version 188.8.131.52-NAPI, Build: 456551, Interface: 9.2 Built on: Jul 29 2011 Signed Status: VMware Signed Signature Issuer: VMware, Inc. Signature Digest: 1049 0611 a944 efc3 b683 341d 34b1 bebc 552d cb81 a874 ef4c 0562 8f25 2775 8c8d Signature FingerPrint: cb44 247a 1614 cea1 2079 362d ec86 9d0e Provided Namespaces: Required Namespaces: com.vmware.driverAPI@184.108.40.206, com.vmware.vmkapi@v2_0_0_0 ~ # ~ # esxcli system module get -m e1000 | grep Version Version: Version 220.127.116.11-NAPI, Build: 456551, Interface: 9.2 Built on: Jul 29 2011 ~ #
There is a big advantage on using esxcli over the other methods. In ESX(i) 4.x and ESXi 5.0 with the old procedure you had to be logged into the host but with esxcli it can be performed remotely using vSphere CLI.
vi-admin@vma:~[esxi5.vjlab.local]> esxcli system module get -m e1000 Module: e1000 Module File: /usr/lib/vmware/vmkmod/e1000 License: GPL Version: Version 18.104.22.168-NAPI, Build: 456551, Interface: 9.2 Built on: Jul 29 2011 Signed Status: VMware Signed Signature Issuer: VMware, Inc. Signature Digest: 1049 0611 a944 efc3 b683 341d 34b1 bebc 552d cb81 a874 ef4c 0562 8f25 2775 8c8d Signature FingerPrint: cb44 247a 1614 cea1 2079 362d ec86 9d0e Provided Namespaces: Required Namespaces: com.vmware.driverAPI@22.214.171.124, com.vmware.vmkapi@v2_0_0_0 vi-admin@vma:~[esxi5.vjlab.local]> vi-admin@vma:~[esxi5.vjlab.local]> esxcli system module get -m e1000 | grep Version Version: Version 126.96.36.199-NAPI, Build: 456551, Interface: 9.2 Built on: Jul 29 2011 vi-admin@vma:~[esxi5.vjlab.local]>
But there is more, thanks to Get-EsxCli cmdleet the same operation can be done using PowerCLI, here it is how.
First we need to setup the Esxcli instance.
And now we issue the command using the name of the module as the argument, please pay attention to the syntax.
As you should have imagined this procedure can be used to get info about any VMkernel module in the host, not just the network interface one,.
Like we found before for netstat there is no arp command available from within ESXi Tech Support Mode, so how can you list the ARP table entries if you need to? Or how can you do it remotely either with vCLI or PowerCLI?
In this quick post I’ll show you the different ways to list the ARP table entries of an ESXi server, as always both for ESXi4 and ESXi5.
Tech Support Mode
From ESXi Tech Support Mode we need to relay in esxcli.
Again we need esxcli in order to get the ARP table.
In this case we are going to use esxcli but trough the Get-EsxCli cmdlet. First we retrieve the esxcli instance and then we get the ARP table list.
We are going to suppose that you are trying to troubleshoot your ESXi network problems and as an experienced sysadmin one of the first things to do is getting the network connections of the host. But you are in ESXi and that means there is no netstat command, that handy Unix command that saved your life so many times in the past.
Please don’t panic yet, because as always in VMware there is a solution for that: esxcli to the rescue. Here it is the way to list the network connections of your ESXi host, both for ESXi 4.1 and ESXi 5 :-)
I tested it in ESXi 4.1 and ESXi 4.1 Update 1. The network namespace is not available in ESXi 4.0.
I used Remote Tech Support (SSH), simply known as SSH in ESXi5, in both examples but you can also launch the command from the vMA or using vSphere CLI from a Windows or a Linux machine.
[vi-admin@vma ~]$ esxcli --server=arrakis.jreypo.local --username=root network connection list
vi-admin@vma5:~> esxcli --server=esxi5.jreypo.local --username=root network ip connection list
One of features I like the most of esxtop/resxtop is the ability to create customized configurations. This feature gives you the ability to have several pre-defined configuration files to be used under certain circumstances, for example you can have one only to check if there are virtual machines swapping during a heavy workload period.
The post will cover esxtop 4.x, the version that comes with vSphere 4.x, however it can be applicable to previous versions as well. First it’s important to know that by default esxtop/resxtop stores its configuration in the file .esxtop4rc, in the vMA this file is stored in the vi-admin user home directory and in the root home directory in the ESX(i) servers.
Now lets create one as an example. I’m using resxtop from the vMA so first launch it against the vCenter Server and select one of the ESX(i) hosts.
Show the memory screen by pressing m and from there press f to edit the fields to display.
Press the corresponding keys to enable/disable the fields and a or o keys to toggle its order, then press the space bar to finish. Next esxtop returns the memory view and show the newly selected counters.
At this point you can customized the field to display in the other views (CPU, network, etc). When you are done press W to save the config and enter the file name to save the new config in. If you don’t enter a file name esxtop will save the changes in its default config file, /home/vi-admin/.esxtop4rc in the example.
Exit esxtop and run it again but loading the saved config file, instead of the default one, by using -c <config_file>.
Finally my advise is to read carefully the Interpreting esxtop 4.1 Statistics document and use the counters that better suits your needs.
When you are trying to configure iSCSI of and ESX(i) server from the command line is clear that at some point you are going to need the iqn. Of course you can use the vSphere Client to get the iqn but the Unix Geek inside me really wants to do it from the shell.
First list the SCSI devices available in the system to get the iSCSI hba.
[root@esx02 ~]# esxcfg-scsidevs -a vmhba0 mptspi link-n/a pscsi.vmhba0 (0:0:16.0) LSI Logic / Symbios Logic LSI Logic Parallel SCSI Controller vmhba1 ata_piix link-n/a ide.vmhba1 (0:0:7.1) Intel Corporation Virtual Machine Chipset vmhba32 ata_piix link-n/a ide.vmhba32 (0:0:7.1) Intel Corporation Virtual Machine Chipset vmhba33 iscsi_vmk online iscsi.vmhba33 iSCSI Software Adapter [root@esx02 ~]#
After that Jon uses the command vmkiscsi-tool to get the iqn.
[root@esx02 ~]# vmkiscsi-tool -I -l vmhba33 iSCSI Node Name: iqn.1998-01.com.vmware:esx02-42b0f47e [root@esx02 ~]#
Beauty, isn’t it? But I found one glitch. This method is done from the ESX root shell but how do I get the iqn from the vMA? Some of my hosts are ESXi and even for the ESX I use the vMA to perform my everyday administration tasks.
There is no vmkiscsi-tool command in the vMA, instead we are going to use the vicfg-iscsi or the vicfg-scsidevs command.
With vicfg-scsidevs we can obtain the iqn listed in the UID colum.
[vi-admin@vma ~][esx02.mlab.local]$ vicfg-scsidevs -a Adapter_ID Driver UID PCI Vendor & Model vmhba0 mptspi pscsi.vmhba0 (0:16.0) LSI Logic Parallel SCSI Controller vmhba1 ata_piix unknown.vmhba1 (0:7.1) Virtual Machine Chipset vmhba32 ata_piix ide.vmhba32 (0:7.1) Virtual Machine Chipset vmhba33 iscsi_vmk iqn.1998-01.com.vmware:esx02-42b0f47e () iSCSI Software Adapter [vi-admin@vma ~][esx02.mlab.local]$
And with vicfg-iscsi we can get the iqn providing the vmhba device.
[vi-admin@vma ~][esx02.mlab.local]$ vicfg-iscsi --iscsiname --list vmhba33 iSCSI Node Name : iqn.1998-01.com.vmware:esx02-42b0f47e iSCSI Node Alias : [vi-admin@vma ~][esx02.mlab.local]$
The next logical step is to use PowerCLI to retrive the iqn, but I’ll leave that for a future post.