Mohamud's Labs

Configuring and Hardening a Cisco Router (Basic Setup + Secure Remote Access)

A beginner lab that walks through the first configuration of a Cisco IOS router: naming, interfaces, secure SSH management, basic hardening and verification.

BeginnerUpdated

Authorized environments only. Every lab runs in an isolated environment I own. Never test systems you don't have written permission to test.

Scenario

A small office has just received a new Cisco router. Out of the box it has no hostname, no passwords and no remote management. Before it connects to anything important, it must be given a basic configuration and secured so that only an administrator can manage it, and only over an encrypted channel.

This lab builds that configuration step by step in a simulated, isolated network.

Objectives

  • Configure the hostname, interfaces and IP addressing on a Cisco router.
  • Protect privileged access with a strong secret and local user accounts.
  • Replace Telnet with SSH version 2 for remote management.
  • Apply basic hardening: login throttling, idle timeouts, banners, disabling unused services.
  • Verify the configuration and save it.

Environment

Everything runs in a simulator, with no real equipment or production network involved.

Device Type / OS Interface IP address
R1 Cisco router (IOS) G0/0 192.168.10.1/24
R1 Cisco router (IOS) G0/1 10.0.0.1/30 (simulated uplink, left shut down until needed)
SW1 Cisco switch (default config) - Layer 2 only
Admin-PC Windows/Linux host NIC 192.168.10.10/24, gateway 192.168.10.1

Isolated LAN subnet: 192.168.10.0/24. Admin-PC connects to SW1, and SW1 connects to R1 G0/0. Use the console connection for the first steps.

Steps

1. Basic identity and interfaces

code
Router> enable
Router# configure terminal
Router(config)# hostname R1
R1(config)# no ip domain-lookup
R1(config)# interface GigabitEthernet0/0
R1(config-if)# description LAN to SW1
R1(config-if)# ip address 192.168.10.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# exit
R1(config)# interface GigabitEthernet0/1
R1(config-if)# description Uplink (unused)
R1(config-if)# ip address 10.0.0.1 255.255.255.252
R1(config-if)# shutdown
R1(config-if)# exit

Test from Admin-PC: ping 192.168.10.1 should succeed.

2. Protect privileged access

code
R1(config)# enable secret <StrongPassphrase>
R1(config)# service password-encryption
R1(config)# security passwords min-length 12
R1(config)# username admin privilege 15 secret <AnotherStrongPassphrase>

Use enable secret, never enable password. The secret is stored as a hash instead of a reversible string. Choose your own passphrases and do not reuse them elsewhere.

3. Secure the console and enable SSH

SSH needs a hostname, a domain name and an RSA key.

code
R1(config)# ip domain-name lab.local
R1(config)# crypto key generate rsa modulus 2048
R1(config)# ip ssh version 2
R1(config)# ip ssh time-out 60
R1(config)# ip ssh authentication-retries 3

R1(config)# line console 0
R1(config-line)# logging synchronous
R1(config-line)# login local
R1(config-line)# exec-timeout 5 0
R1(config-line)# exit

R1(config)# line vty 0 4
R1(config-line)# login local
R1(config-line)# transport input ssh
R1(config-line)# exec-timeout 5 0
R1(config-line)# exit

transport input ssh blocks Telnet entirely. login local makes the router use the local user account instead of a shared line password.

4. Slow down guessing attacks and add a banner

code
R1(config)# login block-for 120 attempts 3 within 60
R1(config)# login on-failure log
R1(config)# login on-success log
R1(config)# banner motd #Authorized access only. Activity may be monitored.#

After 3 failed logins within 60 seconds, logins are blocked for 120 seconds. This makes brute-force attempts (T1110) much slower.

5. Disable what you don't need

code
R1(config)# no ip http server
R1(config)# no ip http secure-server
R1(config)# no service pad
R1(config)# no ip source-route
R1(config)# interface GigabitEthernet0/1
R1(config-if)# no cdp enable
R1(config-if)# exit

Fewer running services means a smaller attack surface. Keep CDP only on trusted internal links, or turn it off if you don't need it.

6. Verify and save

code
R1# show ip interface brief
R1# show running-config | section line vty
R1# show ip ssh
R1# show login
R1# copy running-config startup-config

From Admin-PC:

  • ssh -l admin 192.168.10.1 should connect.
  • telnet 192.168.10.1 should be refused.
  • Deliberately enter a wrong password 3 times to confirm show login reports the block period.

Findings

(Fill in from your own run before publishing.)

  • Did ping to 192.168.10.1 succeed after step 1?
  • Did SSH v2 connect and Telnet get refused?
  • Did the login block trigger after 3 bad attempts? Add a screenshot of show login.
  • Did show running-config show hashed secrets and no plaintext passwords?

Lessons learned

  • A router is useless to secure if management is open: lock down access first, features second.
  • Telnet sends credentials in clear text; SSH v2 with a 2048-bit key is the minimum for remote management.
  • service password-encryption only obscures line passwords weakly (type 7). Real protection comes from secret (hashed) and local accounts.
  • Login throttling and idle timeouts cost nothing and reduce exposure to brute-force and abandoned sessions.
  • Always run copy running-config startup-config, or the work vanishes on reload.

Next steps: add an ACL to limit SSH to the admin host, configure NTP and remote syslog, and set up AAA with a central server.

References

  • Cisco IOS Configuration Guides: Security Configuration Guide (cisco.com documentation)
  • Cisco Guide to Harden Cisco IOS Devices
  • MITRE ATT&CK: T1110 (Brute Force), T1078 (Valid Accounts), T1021.004 (Remote Services: SSH)