Thursday, March 6, 2014

Check your SRM ports with ease!

I have been dragging my feet on writing this post because, sadly, it will probably be my last on this blog. I have moved on to a different team and no longer support SRM. I will be looking for another TSE to take over this blog to keep you all up-to-date and SRM informed.

All of that being said, here is my swan song! As most of you know, there are a LOT of different ports to check when dealing with SRM. Not only do you have to check all of the ports, you have to check a lot of ports on a lot of different servers. This can get confusing and cumbersome and if you miss just one, you can end up chasing your tail forever. Luckily for you, I have created a batch script  you can use to check every port with ease!


##############Copy below this line###############

REM ###SETUP SECTION###
@echo off
cls
echo Welcome to Casey's SRM communication test script
pause

REM #Auto input#
set PRODVC= ###############REPLACE ME#########
set PRODSRM= ##############REPLACE ME#########
set DRVC= ##################REPLACE ME#########
set DRSRM= ################REPLACE ME#########

echo Here are the servers:
echo.
echo ProdVC is %PRODVC%
echo ProdSRM is %PRODSRM%
echo DRVC is %DRVC%
echo DRSRM is %DRSRM%

REM ###NS LOOKUP SECTION###
echo.
echo.
echo *****NS LOOKUPS***** 
echo.
echo ***ProdVC
nslookup %PRODVC%
echo.
echo.
echo ***ProdSRM
nslookup %PRODSRM%
echo.
echo.
echo ***DR VC
nslookup %DRVC%
echo.
echo.
echo ***DRSRM
nslookup %DRSRM%

pause



REM ###Telnet Tests Section###
echo.
echo.
echo *****Telnet Tests*****

echo Is this the......
echo 1) Prod VC
echo 2) Prod SRM
echo 3) DR VC
echo 4) DR SRM

set /p USERIN='make your selection'

echo You Seleceted is %USERIN%

REM ### prod vc ###
IF %USERIN%==1 echo telnet %PRODSRM% 8095
IF %USERIN%==1 start cmd /k telnet %PRODSRM% 8095
IF %USERIN%==1 pause

IF %USERIN%==1 echo telnet %PRODSRM% 9085
IF %USERIN%==1 start cmd /k telnet %PRODSRM% 9085
IF %USERIN%==1 pause

IF %USERIN%==1 echo telnet %PRODSRM% 9086
IF %USERIN%==1 start cmd /k telnet %PRODSRM% 9086
IF %USERIN%==1 pause



REM ### prod SRM ###
IF %USERIN%==2 echo telnet %PRODVC% 80
IF %USERIN%==2 start cmd /k telnet %PRODVC% 80
IF %USERIN%==2 pause

IF %USERIN%==2 echo telnet %DRVC% 80
IF %USERIN%==2 start cmd /k telnet %DRVC% 80
IF %USERIN%==2 pause




REM ### DR vc ###
IF %USERIN%==3 echo telnet %DRSRM% 8095
IF %USERIN%==3 start cmd /k telnet %DRSRM% 8095
IF %USERIN%==3 pause

IF %USERIN%==3 echo telnet %DRSRM% 9085
IF %USERIN%==3 start cmd /k telnet %DRSRM% 9085
IF %USERIN%==3 pause

IF %USERIN%==3 echo telnet %DRSRM% 9086
IF %USERIN%==3 start cmd /k telnet %DRSRM% 9086
IF %USERIN%==3 pause



REM ### DR SRM ###
IF %USERIN%==4 echo telnet %PRODVC% 80
IF %USERIN%==4 start cmd /k telnet %PRODVC% 80
IF %USERIN%==4 pause

IF %USERIN%==4 echo telnet %DRVC% 80
IF %USERIN%==4 start cmd /k telnet %DRVC% 80
IF %USERIN%==4 pause

echo You're Done!
pause

##############Copy Above this line###############

So how does it work?

1) Copy everything between the lines and paste it into a notepad.
2) under the "REM #Auto input#" section, replace the "###############REPLACE ME#########" lines with the fully qualified domain names of each server. For example:

set PRODVC=ProductionvCenter.SRMGurulab.com
set PRODSRM=ProductionSRMServer.SRMGurulab.com
set DRVC=DRvCenter.SRMGurulab.com
set DRSRM=DRSRMserver.SRMGurulab.com

You will want to make sure that there are no spaces between the "=" and the FQDN.

3) Save the file as SRMTest.bat
4) Ensure on all 4 servers (Production vCenter server, Production SRM server, DR vCenter Server, DR SRM server) that the telnet client is enabled (we use this to check the ports)
5) Copy the SRMTest.bat file to all 4 servers
6) Right-click and run the scripts as administrator
7) You should see the script start. Press any key to continue.
8) The script lists out what you entered for the FQDNs in the script and then runs nslookup for each server. SRM is very reliant on these entries so check to make sure that all 4 of the nslookups worked and that the IP addresses are correct. Once you have finished this, press any key to continue.
9) You are then prompted with the following:

*****Telnet Tests*****
Is this the......
1) Prod VC
2) Prod SRM
3) DR VC
4) DR SRM
'make your selection'

If you are running the script on the Production vCenter Server, you will enter "1", Production SRM server "2", etc etc (note, there is no error checking in the script so don't enter anything except the number. The entry should look like this: 'make your selection'1) If you enter any but a number, it will skip right to the end of the script without checking anything and you will see the "You're Done!" prompt.

10) As soon as you make your selection and press enter, a new cmd prompt will show up. This is a telnet test to the first port. If it shows up blank, the telnet test succeeded. If you see:

"Connecting To <serverName>...Could not open connection to the host, on port <port#>: Connect failed"

The telnet failed and that server is unable to communicate over that port to the destination server.

11) Click the main cmd prompt and press any key, the script will open another telnet cmd prompt window to test the next port. You will get 3 telnet windows when testing from a vCenter server and 2 from the SRM servers.
12) After the last port is checked, you will see the "You're Done!" Prompt.
13) Run this same script on all 4 servers. If you run the script on all 4 servers, you are guaranteed to check all the ports necessary for SRM to communicate properly. Be aware that this is ONLY for SRM, not for vSphere Replication. To test vSphere Replication, see my other post Checking vSphere Replication Connectivity (http://vmwaresrmguru.blogspot.com/2013/10/checking-vsphere-replication.html).

For a list of ports that this script is checking, see the VMware KB on the ports required for SRM to function (and check out the diagram at the very bottom of the KB under Attachments, it is very useful)

Port numbers that must be open for Site Recovery Manager, vSphere Replication, and vCenter Server (1009562): http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009562


I hope this script helps everyone to make sure their SRM is connecting well!



**********************************************Disclaimer**********************************************
This blog is in no way sponsored, supported or endorsed by VMware. Any configuration or environmental changes are to be made at your own risk. Casey, VMware, and any other company and/or persons mentioned in this blog take no responsibility for anything.