If you need to troubleshoot TCP connection issues from your ESX host. You will notice that Telnet isn’t available on your ESX host. But VMware posted a workaround in KB1010747. The reason why VMware did not include the Telnet package is simple:
The TELNET package does not ship with the ESX service console. While the TELNET daemon is clearly a security risk, the TELNET client may be a useful tool in diagnosing TCP session connectivity between the ESX Service Console and TCP ports on a foreign host.
The workaround is a Python script. You can copy the following script to your ESX host and place it in /tmp directory.
#!/usr/bin/python # TCP connection "tester" - # provide the hostname/IP address followed by port number (if no port # is specified, 23 is assumed ;) # program will connect to the port and read till either it receives a # newline or 5 seconds expire # be sure to chmod 755 import sys import telnetlib import socket PORT = "" argc = len(sys.argv) if argc == 3 : PORT = sys.argv[2] elif argc < 2 or argc > 3: print "usage %s host <port> \n" % sys.argv[0] sys.exit() HOST = sys.argv[1] try: tn = telnetlib.Telnet(HOST,PORT) except socket.error, (errno, strerror): print " SockerError( %s ) %s\n" % (errno, strerror) sys.exit() print tn.read_until("\n ",5) print "connection succeeded\n" tn.close() sys.exit()
If you want to test if a particular TCP port is reachable from your ESX host. You can use the script like this:
[root@esx01 ~]# ./testtcp vc01.ict-freak.loc 443
connection succeeded
[root@esx01 ~]#
In case the TCP port is not reachable from your ESX host. The script will just hang on your command and will eventually time out:
[root@esx01 ~]# ./testtcp vc01.ict-freak.loc 443
SockerError( 110 ) Connection timed out
You can also cancel the script by pressing CTRL + C
I didn’t test the script from ESXi. If you did, please leave a comment.
Source: | KB1010747 |
wow nice, I will try this on my brand new ESXi real soon. And maybe tomorrow on my old ESX.