31 January, 2014

Change ssh Port

#Configure SSH on Cisco
router(config)#
hostname R1
R1(config)# ip domain name ITTSM.BLOGSPOT.COM
R1(config)# crypto key generate rsa
The name for the keys will be: R1.ITTSM.BLOGSPOT.COM
Choose the size of the key modulus in the range of 360 to 2048 for your
  General Purpose Keys. Choosing a key modulus greater than 512 may take
  a few minutes.
How many bits in the modulus [512]: 1024
% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]
#Create User
R1(config)# username root privilage 15 secret Georgia
R1(config)# line vty 0 4
R1(config-line)# login local

Now, we will configure the router to expect ssh connections on port 4009. This is done with the command ip ssh port and applying a rotary group. Then, that rotary group is configured on the VTY lines:

#Change Port and configure rotary group
R1(config)# ip ssh port 4009 rotary 22
R1(config)# line vty 0 4
R1(config-line)# rotary 22

#Verify 
Switch#ssh -l root -p 4009 192.168.1.10
Password:******
R1#show tcp brief
TCB       Local Address           Foreign Address        (state)
651B9D18  192.168.1.10.4009       192.168.1.130.51741    ESTAB

root@bt:~# ssh 192.168.1.10 -p 4009
Password:******
R1#show tcp brief
TCB       Local Address           Foreign Address        (state)
64FBEA1C  192.168.1.10.4009       192.168.1.5.56392      ESTAB