Showing posts with label vCLI. Show all posts
Showing posts with label vCLI. Show all posts

2011-12-29

Internet Access is needed to Install vCLI 5.0

I came a cross a case this week that I thought would be worthwhile sharing.

A client needed to install the vCLI on a Linux machine, and this machine was behind a firewall that was blocking access to the internet.

image

The process was supposed to be very simple. Download the Tarball, copy it to the machine, untar and then install. But during the install this message popped up:

Do you accept? (yes/no) yes

Thank you.

ping: unknown host www.vmware.com
Network is unavailable, please configure the network first otherwise please
install the following modules manually for use by vSphere CLI:

Archive::Zip 1.20 or newer
Compress::Zlib 2.005 or newer
Compress::Raw::Zlib 2.017 or newer
version 0.78 or newer
IO::Compress::Base 2.005 or newer
IO::Compress::Zlib::Constants 2.005 or newer
Class::MethodMaker 2.10 or newer
HTML::Parser 3.60 or newer
UUID 0.03 or newer
Data::Dump 1.15 or newer
SOAP::Lite 0.710.08 or newer
URI 1.37 or newer
LWP 5.805 or newer
LWP::Protocol::https 5.805 or newer
VMware::VIRuntime 0.9 or newer
WSMan::StubOps 0.1 or newer

Ok I get it – the installation wanted access to the web that would download those modules. Due to my predicament with no internet on this machine – I downloaded the all the Perl modules on another machine and copied them over.

And by the way the easiest way to download the modules is by using CPAN, but in this case - they had to be downloaded and installed manually – which by the way this is the process:

  • Download the Module
  • Unpack the tarball
  • cd <package_name>
  • perl Makefile.PL
  • make
  • make test
  • make install

But even after installing the dependencies – vCLI still would not install – either it would ask for a proxy – or throw a message simlar to the one below.

SOAP::Lite 0.710.08 or newer
LWP 5.805 or newer
LWP::Protocol::https 5.805 or newer
VMware::VIRuntime 0.9 or newer
WSMan::StubOps 0.1 or newer

Thanks to William Lam – he pointed me to a workaround that allows for the installation to continue without internet access. 

The solution is to comment out a few lines in the install script – which will allow the installation to continue. I understand that there is already a feature request to change this behavior in the next version.

2011-09-13

netstat for ESXi

The title of the post is actually misleading - on purpose - because there is no netstat for ESXi. The reason that I bring this up today is because of a Twitter conversation from today regarding SSH access and VMkernel interfaces. I was looking to see which ports were open and what interfaces were listening.
But that is a different post.

What is netstat? according to Wikipedia:

netstat (network statistics) is a command-line tool that displays network connections (both incoming and outgoing), routing tables, and a number of network interface statistics. It is available on Unix, Unix-like, and Windows NT-based operating systems.

Why would you use it? For one thing for example, to check if a host has an open connection on a certain port, if it is listening on a certain port - for troubleshooting purposes would be the proper answer.

So how do you get that information on ESXi?

Trying netstat on an ESXi host does not work - because that command is not there - see the screenshot below.

No netstat

Well that is not good - if the command is not in the busybox console then how would you go about getting that information? Well of course the clever people at VMware have already thought about this and have exposed all this information through esxcli. William Lam wrote a great set of posts on esxcli
esxcli Part1 - What is esxcli?, esxcli Part2 - Automating esxcli using vMA and esxcli Part3 - Automating esxcli using PowerShell

This is how you would go about getting the information from esxcli. (Be aware the command differ according to the different versions - 4.x is not the same as 5.x)

esxcli network ip connection list

esxcli1

That is fine and dandy - but to get that info you need to either:

  1. have access to the DCUI (and have it enabled of course)
    or
  2. access remotely with SSH (and also have it enabled of course)

But what if you do not want to enable neither of the above - that means you have to do it remotelyand for that you have two options, vCLI or PowerCLI.

The vCLI way

esxcli --server esx1.maishsk.local network ip connection list

vcli1

But me being more of PowerCLI guy I would do it like this.

The PowerCLI way

$esxcli = get-esxcli -vmhost esx1.maishsk.local

$esxcli.network.ip.connection.list() | ft

PowerCLI1

Output is almost identical - just that in the case of PowerCLI the values are returned as a set of objects - a  VMware.VimAutomation.ViCore.Impl.V1.EsxCli.EsxCliObjectImpl object to be precise. Once these presented as objects I can start to mold and dice my results to my liking.

For example - I would like to check if there is any connections open on port 80 (http) - with vCli - this is not so simple - because you are working essentially in a DOS window - so filtering is not the easiest with findstr. Using the console or SSH is easier - a simple grep will work as you can see below.

esxcli network ip connection list | grep :80

esxcli2

With PowerCLI

$esxcli.network.ip.connection.list() | where { $_.LocalAddress -like "*:80" } | ft

PowerCLI2

I hope you can see that the options this way are pretty much endless - like filtering all connections to show only those from a specific IP, or a complete subnet.

So that is how you netstat on ESXi….