Friday, October 16, 2009

Quick format -AKA:Wipe the MBR

A quick and easy way to format a disk/flash disk using unix "dd":

This one will wipe both partition table + The Master Boot Record:
dd if=/dev/zero of=/dev/sdb1 bs=512 count=1

If you want to wipe out only the MBR and keep the partition table:
dd if=/dev/zero of=/dev/sdb1 bs=446 count=1

Configure SSH on a Cisco router.

SSH is a secure alternative to telnet as it's encrypted and almost impossible to be listened to, it's also great for remote management and monitoring via scripts.
By default SSH is disabled on Cisco routers, let's see how to configure it step by step.
First we need to set up an admin account on the router:

Router1(config)#aaa new-model
Router1(config)#username admin privilege 15 passwword P@ssw0rd

Next we will configure SSH service on the router:
Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#hostname Router1
Router1(config)#ip domain-name
Router1(config)#crypto key generate rsa
The name for the keys will be:
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 RSA keys ...

Jun 27 15:04:15: %SSH-5-ENABLED: SSH 1.5 has been enabled
Router1(config)#ip ssh time-out 120
Router1(config)#ip ssh authentication-retries 4

SSH became available in Cisco's IOS, starting with release 12.1(1)T. However, only versions of IOS that support IPSec (DES or 3DES) encryption include SSH support.

If you're working with version 2 of SSH which is far more secure, you can switch the service to work only on version 2:

Router1(config)#ip ssh version 2