If you as I are studying for the CCIE R&S you should be using Putty? Why? Because for the
R&S track Putty is used in the lab. Yes, I an many others use SecureCRT and love the tabs
but you don’t want to go to the lab and do anything for the first time, except get your number!
Therefore we should use Putty to practice.

I use rack rentals and Dynamips for my studies, in either case I need to connect to a least 10
devices, the 6 routers and the 4 switches. This can be a bit tedious to do everytime you
want to study. Here is my solution for it. Start by installing Putty, I usually just use the
executable but you want to install it to be able to use it from the command line.
Download it here.

Install it to a directory of your preference.

Open a command prompt and type putty, what happens? Nothing, because Windows
doesn’t know where Putty is located. Either you can type C:Program filesPuttyPutty.exe
or where you installed it everytime you want to use it but there is a better way.

Start by clicking the Start button and then right clicking on “Computer” and then
choose “Properties”.

Then we will have a new screen where we whant to choose “Advanced system settings”.

After that choose “Environment Variables…”.

Scroll down the “System variables” until you see “Path”. Select this and then choose edit.

After every entry there needs to be a semicolon. Scroll to the right and after your
final entry put “;C:Program filesPuTTY” or the directory where you installed it.
You do not need the “”.

Windows will now know where Putty is located. If you type Putty from the
command prompt Putty will load. The advantage now is that we can use Putty from the
command line, you can used putty -telnet or putty -ssh to open sessions from the
command line but we are interested in putty -load. This is how I have things setup.

We need to create sessions in the GUI that we can load from the command prompt.
If you are using rack rentals like graded labs you telnet to a terminal server and
can create sessions by using different usernames. You can see that I connect
to racks.ine.com on port 23.

Some things that you might like to change, in the “Windows” section change
the scrollback. I use 5000 lines of scrollback. You want to be able to run debugs
and then scroll back and go through the output.

I use a different font than standard, you can change this in “Appearance”.
The one I use is called Lucida Console.

I also like to change the selection behaviour. The default is to paste on right click.
I change it to bring up a menu on right click. If I want to paste something directly
I can use shift+insert.

This is enough to get us started but first lets make some more changes.
Under “Behaviour” we can set “Window title:”.
Set this to the device name like R1, R2, SW1 etc.
This will help us to know which device we are logged in to.

When you have edited your settings you need to save them to a session.
Choose “Session” and then “Saved Sessions” and enter a name for the session
and then click “Save”. To save more sessions leave the settings as they are, enter
a new name under “Saved sessions”, change the window title under behaviour, when
this is done click save and the session will be saved with the new name.
Do this for all the devices.

To load the sessions from the commandline we use putty -load.
I made a quick .bat file to start all my sessions. The code looks like this:

start “R1” “C:Program FilesPuTTYputty.exe” -load rr-r1
timeout /T 2 > nul
start “R2” “C:Program FilesPuTTYputty.exe” -load rr-r2
timeout /T 2 > nul
start “R3” “C:Program FilesPuTTYputty.exe” -load rr-r3
timeout /T 2 > nul
start “R4” “C:Program FilesPuTTYputty.exe” -load rr-r4
timeout /T 2 > nul
start “R5” “C:Program FilesPuTTYputty.exe” -load rr-r5
timeout /T 2 > nul
start “R6” “C:Program FilesPuTTYputty.exe” -load rr-r6
timeout /T 2 > nul
start “SW1” “C:Program FilesPuTTYputty.exe” -load rr-sw1
timeout /T 2 > nul
start “SW2” “C:Program FilesPuTTYputty.exe” -load rr-sw2
timeout /T 2 > nul
start “SW3” “C:Program FilesPuTTYputty.exe” -load rr-sw3
timeout /T 2 > nul
start “SW4” “C:Program FilesPuTTYputty.exe” -load rr-sw4

I have implemented a 2 second wait between each session because the sessions
time out quite fast and we need time to type username and password.
The timeout may not be availabe in systems older than Vista but you may
solve this by using a ping command or so. This bat-file can also be used to open
remote sessions to a Dynamips-server. The only thing that changes in the Putty
sessions is that we connect via ssh and then ports 2000 and upward.
If you connect to Dynamips you don’t need to implement the timeout command.

Hopefully this post has showed you new ways of using Putty and has speeded up your labstudies.

Quickly opening multiple sessions with Putty
Tagged on:         

12 thoughts on “Quickly opening multiple sessions with Putty

  • January 28, 2011 at 1:21 pm
    Permalink

    they could at least use the Putty Connection Manager.. 🙁

    Reply
  • January 28, 2011 at 1:48 pm
    Permalink

    From what I’ve heard at the lab there will be sessions prepared and you can click on the topology to connect to the devices. You still might want to change some settings though. They did a demo of the lab interface but it would be nice with some more information about this.

    Reply
  • January 28, 2011 at 6:19 pm
    Permalink

    Good post. I remember seeing a blog post on Greg Ferro’s site setting Putty up in the same way, using the Run box to start Putty. You just took it a step further with the screenshots and other quick tips for Putty. I am a command line guy so I love using shortcuts.

    Unfortunately, we have so many switches at work, that I cannot remember all of the session names that I have saved. Maybe I’ll try to create a better naming convention to make it more intuitive.

    Reply
  • January 28, 2011 at 9:07 pm
    Permalink

    Thanks for your feedback Keith. At work I use SecureCRT with saved sessions. I usually keep them sorted in folders by customer name and then site name and all the equipment is under the site folder. Would be nice if Putty implemented a command to list all sessions from the command line 🙂

    Reply
  • January 29, 2011 at 11:42 am
    Permalink

    I use ZOC at work and it’s awesome. Why do they need to use putty? I hate it!

    They really need to start using a tabbed application of some sort.

    Reply
  • January 29, 2011 at 11:50 am
    Permalink

    Yeah, I agree. I can’t see why they insist on Putty, a SecureCRT license can’t cost much and they could probably get them for free if they say its for the CCIE lab. Do you prefer ZOC over SecureCRT, does it have any extra features?

    Reply
  • January 29, 2011 at 11:58 am
    Permalink

    I trialled secure-crt a while back but just didn’t get it.

    Installed ZOC and never looked back. There is so much customisation and automation you can do. I think secure-crt can do the same though, but I never went that deep into it

    Reply
  • January 29, 2011 at 5:49 pm
    Permalink

    I use Putty and Gnome Do[1] on my Ubuntu Linux workstation. My saved Putty sessions are named INE_LAB_R1, INE_LAB_R2, …, INE_LAB_SW1 and so on. You will only have to activate the Putty plugin in Gnome Do after installing it, since it’s not enabled by default.

    Alt+Enter and typing iner1 plus hitting the Enter key will open Putty and load the saved INE_LAB_R1 session. It is not necessary to type exact session name since Gnome Do is using fuzzy matching on the input.

    1) http://do.davebsd.com/

    Reply
  • January 30, 2011 at 7:53 pm
    Permalink

    That’s a great idea Daniel, about Putty having the option to list hostnames from the command line. I blame myself for not having intuitive session names, but I created them when I was brand spanking new to the job. I just needed something that had all of our devices listed so I could log in quickly. The more I learn and the more comfortable I become, I’m finding more ways to make my job and life easier.

    I’ve never tried SecureCRT or ZOC but I’ve always heard good things about both. Not sure if you’ve heard of TeraTerm, but I used that before I found out about Putty. TeraTerm just doesn’t have the advanced GUI that saves the admin/engineer time like say Putty or the others do.

    Another con of Putty I ran into this weekend with Putty is that it does not include xmodem functionality. I just bought 2 2610 routers from a coworker the other day and the flash was corrupted on one. I use Windows 7 on my laptop so the only way to upload the IOS image from the 2nd router was to use TeraTerm because it was free and supported xmodem. Windows 7 does not include HyperTerminal.

    Reply
  • June 19, 2012 at 12:42 pm
    Permalink

    You do not need to install putty for this to work just make sure the directory where it is stored is the PATH.

    Simplified version of above is the following

    start putty -load r1
    start putty -load r2
    start putty -load r3
    start putty -load r4
    start putty -load r5
    start putty -load r6
    start putty -load s1
    start putty -load s2
    start putty -load s3
    start putty -load s4
    start putty -load bb1
    start putty -load bb2
    start putty -load bb3

    Make sure that all these are pre-defined within putty.

    Reply
  • December 29, 2012 at 11:56 am
    Permalink

    One problem i’m facing with this approach is that whenever i take a duplicate session, it takes my current username by default.
    I want to avoid this….any ways of achieving it?
    i use “putty -load session -l loginname -pw password”
    since i hafta take around 40-50 sessions…i store all passwords in the bat file and use ping instead of timeout.

    Reply
  • March 23, 2013 at 12:23 am
    Permalink

    I am trying to use this

    start “A” “Z:putty.exe” -ssh -load ABC user -pw password -m “Z:commands.txt”
    timeout /T 2 > nul

    and have passed commands to execute in the commands.txt file but it doesn’t work. Please help me how do I log in to multiple sessions and with lines of codes executing with it.

    Your earliest response would be highly appreciated.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *