SHIFT

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


Sidebar

Sponsor:

Would you like to sponsor this site?
Or buy me a beer?:


Recently Changed Pages:

View All Pages
View All Q Pages


View All Tags


Sign up for Q to post comments.





WIKI Disclaimer: As with most other things on the Internet, the content on this wiki is not supported. It was contributed by me and is published “as is”. It has worked for me, and might work for you.
Also note that any view or statement expressed anywhere on this site are strictly mine and not the opinions or views of my employer.


Terms And Conditions for Q users


Pages with comments

PageDateDiscussionTags
2019/05/01 14:08 2 Comments
2019/03/15 16:02 1 Comment
2019/03/15 16:02 1 Comment
2019/03/15 16:02 3 Comments
2017/04/20 15:28 1 Comment
2017/04/20 15:23 1 Comment
2017/04/19 14:44 1 Comment
2017/04/17 20:10 1 Comment
2017/04/17 20:07 1 Comment
2017/04/17 19:58 1 Comment
2017/04/17 19:52 1 Comment

View All Comments

addhwtodr

SRM: Add Hardware To Your DR Network

In case you do a test you might need some workstations in your testnetwork. This is how you do that, and note that all files should be located on the vCenter on your recoverysite. In this howto the scripts are located on the G-Drive.

The goal is simple, depending on if you're doing a test or a recovery, only one PC of a complete testroom should be added to the correct network. In this example we use these VLANs:

  • Production network: 1
  • Test network: 112
  • Recovery network: 911

Getting Started

Because there is a distinction in what changes need to be made when doing a test or recovery, the first script is the one that is being called from SRM and determines if a test or a recovery is done and which script should be run for that purpose:

rem Create new logfile
Echo Networkchange started at %date% at %time% > G:\scripts\networkscripts\networklog.txt
Echo %VMware_RecoveryMode% >> G:\scripts\networkscripts\networklog.txt
 
IF %VMware_RecoveryMode% EQU test (Goto TestRun) Else (Goto OtherRun)
 
:TestRun
G:\scripts\networkscripts\plink 10.10.10.10 -telnet < "G:\scripts\networkscripts\CommandFile - B006116 - VLAN 112.txt"
Echo PC B006116 was added to VLAN 112 >> G:\scripts\networkscripts\networklog.txt
EXIT
 
:OtherRun
IF %VMware_RecoveryMode% EQU recovery (Goto RecoveryRun) Else (Echo An unexpected recoverymode encountered --- exiting now >> G:\scripts\networkscripts\networklog.txt
EXIT
 
:RecoveryRun
G:\scripts\networkscripts\plink 10.10.10.10 -telnet < "G:\scripts\networkscripts\CommandFile - B006116 - VLAN 911.txt"
Echo PC B006116 was added to VLAN 911 >> G:\scripts\networkscripts\networklog.txt
EXIT

So depending on if it is a test or recovery the VLAN is set for one or a number of PCs. Note that SNAC (Symantec access control) is also being disabled. This is the exact setup for the “CommandFile - B006116 - VLAN 112.txt” file. Note that the passwords should be listed plain text in the file:

admin
<password>
en
<password>
conf t
# Start configuration switchports
# Change vlan for patch: K6-16-10  Switchport: b4-38  PC: B006116
int fa4/38
no dot1x pae authenticator
switchport access vlan 112
exit
# End configuration switchports
exit
# Write configuration to switch
# Note the extra line feed for confirmation
copy running-config startup-config

exit
As you can see in the starting script you also need to create the “CommandFile - B006116 - VLAN 911.txt” in which you should replace VLAN 112 for 911.

Cleanup

Note that when you're done testing you need to clean up, and as we can't add custom steps to the cleanup phase you'll have to run the scripts manually. And again we use a script and a commandfile:

G:\scripts\networkscripts\plink 10.10.10.10 -telnet < "G:\scripts\networkscripts\CommandFile - B006116 - VLAN 1.txt"

And this is the commandfile:

admin
<password>
en
<password>
conf t
# Start configuration switchports
# Change vlan for patch: K6-16-10  Switchport: b4-38  PC: B006116
int fa4/38
switchport access vlan 1
dot1x pae authenticator
dot1x port-control auto
dot1x reauthentication
dot1x guest-vlan 254
exit
# End configuration switchports
exit
# Write configuration to switch
# Note the extra line feed for confirmation
copy running-config startup-config

exit
Note that SNAC is being enabled again.

CommandFiles Unix Mode

Note that you need to create the commandfiles in unix mode with only <LF> at the end:
addhwtodr01.jpg

You can see this in notepad++ by going to View → Show Symbol → Show All Characters.

In case you also see <cr> symbols, you can convert the file to unix mode by going to Edit → EOL Conversion → UNIX/OSX Format.

Search And Replace

Note that you can (in notepad++) also do a search and replace on these things. To do so:

  • Open the Replace dialog (CTRL+H)
  • Select Extended search mode (ALT+X)
  • Search for “\r\n”
  • And replace with “\n”
  • Click Replace All (ALT+A

Done!

You could leave a comment if you were logged in.
addhwtodr.txt · Last modified: 2013/09/17 16:48 by sjoerd