================================================================================ 03: CISCO IOS HARDENING: SOLUTION WALKTHROUGH Cisco IOS 15.x routers and switches (Packet Tracer compatible) Training reference for lab devices you own or are authorized to change. Three levels: L1 Doorman, L2 Watchman, L3 Hunter. Every item = COMMAND, WHY, NOTE, and the hardening AREA it belongs to; ALSO adds a second caution when an item needs one. No scripts by design: type it, read it, explain it. Item IDs match the Lockdown Drills trainer for this OS. Unofficial practice; not affiliated with or endorsed by Cisco. HARDENING AREAS Account management Access control Secure configuration (software inventory included) Patching Malware defenses Audit logging Also tagged: Data protection; Investigation (forensics basics). The six areas and their CIS Controls: Defense Ladder, Sophomore s1. https://freeapp4that.store/defense-ladder/#sophomore/s1 Evidence first: answer any investigation question before you change a device. Learn it: Defense Ladder, Freshman f1, How hands-on defense practice works. https://freeapp4that.store/defense-ladder/#freshman/f1 ================================================================================ ------------------------------ DOORMAN ----------------------------------------- Lock the doors. Hostname, enable secret, console and VTY logins, idle timeouts, password encryption, legal banners, and save. The basics every device needs. Learn it first: Defense Ladder, Sophomore s5, Cisco: configure a switch and a router. https://freeapp4that.store/defense-ladder/#sophomore/s5 -------------------------------------------------------------------------------- [B-01] Name the device and lock privileged mode AREA: Access control Router> enable Router# configure terminal Router(config)# hostname RtrA RtrA(config)# no ip domain-lookup RtrA(config)# enable secret Str0ng-Enable-2026! RtrA(config)# no enable password RtrA(config)# do show running-config | include enable RtrA(config)# end RtrA# disable RtrA> enable WHY: enable secret stores a hash. enable password stores plaintext or Type 7, which reverses in seconds, so enable secret is the one to use. NOTE: Plain enable secret yields an MD5 (Type 5) hash on older IOS releases. Where supported, enable algorithm-type scrypt secret stores a Type 9 hash, which the Cisco hardening guide recommends. ALSO: no ip domain-lookup keeps a mistyped command from hanging while IOS tries to resolve it as a hostname. no enable password clears a leftover enable password: the secret wins while both exist, yet the old password still sits in the config and in every backup of it. do runs a privileged EXEC command, such as show running-config, without leaving configuration mode. disable drops back to user EXEC (RtrA>), and the next enable asks for the new secret. [B-02] Console and VTY lines: require login, time out idle sessions AREA: Access control RtrA(config)# line console 0 RtrA(config-line)# password C0nsole-2026! RtrA(config-line)# login RtrA(config-line)# exec-timeout 5 0 RtrA(config-line)# logging synchronous RtrA(config-line)# exit RtrA(config)# line vty 0 4 RtrA(config-line)# password Vty-2026! RtrA(config-line)# login RtrA(config-line)# exec-timeout 5 0 RtrA(config-line)# exit RtrA(config)# line aux 0 RtrA(config-line)# no exec RtrA(config-line)# exit WHY: login enforces each line's password; without it, anyone walks in. exec-timeout 5 0 ends any session idle for five minutes. logging synchronous keeps log output separate from your typing. NOTE: These passwords are placeholders: give every line and secret a unique passphrase. Switches with 16 VTY lines use line vty 0 15. exec-timeout 5 equals 5 0: minutes, then seconds. A 2911 router also has an AUX port. When it sits unused, no exec under line aux 0 stops it from starting a session; when it is in use, secure it like the console. ALSO: At the Watchman level, local usernames and SSH replace these line passwords. [B-03] Hide passwords in the config AREA: Secure configuration RtrA(config)# service password-encryption WHY: Encodes line and username passwords (Type 7). Weak, but it beats plaintext in show run over someone's shoulder. Use secret wherever a command offers it. [B-04] Legal banners: MOTD and login AREA: Secure configuration RtrA(config)# banner motd #Unauthorized access is prohibited and monitored.# RtrA(config)# banner login #Authorized users only. Activity is logged.# WHY: The banner tells anyone connecting that access is restricted and monitored, with wording legal counsel has reviewed. Leave out device name, model, software, and owner; Welcome reads as an invitation. NOTE: Pick a delimiter the text lacks; its next use ends the banner. Console order: MOTD, login banner, login prompt. SSH version 2's pre-authentication login banner carries the notice too. [B-05] Save the config AREA: Secure configuration RtrA# copy running-config startup-config RtrA# write memory RtrA# show startup-config RtrA# show running-config | include enable|password|hostname|banner|exec-timeout RtrA# copy running-config flash:pre-audit.cfg WHY: A reload discards every unsaved fix. Save after every block. NOTE: show running-config is what runs now; show startup-config is what survives a reload. Before an audit, copy running-config flash:pre-audit.cfg keeps the starting config as a file in flash (press Enter at the Destination filename prompt), so every later change has a copy to compare against. ------------------------------ WATCHMAN ---------------------------------------- Check the windows. Local user accounts, SSH version 2 only, unneeded services off, port security, user VLANs and a hardened trunk, VLAN versus SVI, login attack protection, logging and time, and reading a switch's ports, neighbors, and MAC table. Learn it first: Defense Ladder, Junior j4, Cisco: VLANs, routing, and ACLs. https://freeapp4that.store/defense-ladder/#junior/j4 -------------------------------------------------------------------------------- [I-01] Local user accounts and login local AREA: Account management RtrA(config)# username netadmin privilege 15 secret Adm1n-Secret-2026! RtrA(config)# line console 0 RtrA(config-line)# login local RtrA(config-line)# exit RtrA(config)# line vty 0 4 RtrA(config-line)# login local RtrA(config-line)# exit RtrA(config)# no username olduser WHY: Named accounts give accountability and per-user removal; secret hashes the password. Remove every username the brief leaves off its list. NOTE: Where supported, username netadmin privilege 15 algorithm-type scrypt secret stores a Type 9 hash instead of Type 5. [I-02] SSH version 2 only, Telnet gone AREA: Access control RtrA(config)# ip domain-name school.lan RtrA(config)# crypto key generate rsa general-keys modulus 2048 RtrA(config)# ip ssh version 2 RtrA(config)# ip ssh time-out 60 RtrA(config)# ip ssh authentication-retries 3 RtrA(config)# line vty 0 4 RtrA(config-line)# transport input ssh RtrA(config-line)# transport output ssh RtrA(config-line)# exit RtrA# show ip ssh RtrA# show crypto key mypubkey rsa WHY: Telnet sends passwords in cleartext and SSHv1 is broken. Key generation requires a hostname and domain name first, the classic lab trap. NOTE: Order matters: hostname, then ip domain-name, then the RSA key (2048 bits here; SSH version 2 needs at least 768), then ip ssh version 2. transport output ssh limits the sessions a user opens from a VTY session to SSH; sessions arriving here follow transport input. [I-03] Disable unneeded services AREA: Secure configuration RtrA(config)# no ip http server RtrA(config)# no ip http secure-server RtrA(config)# no cdp run RtrA(config)# no lldp run RtrA(config)# no service tcp-small-servers RtrA(config)# no service udp-small-servers RtrA(config)# no ip source-route RtrA(config)# no ip finger RtrA(config)# no ip bootp server RtrA(config)# no service pad RtrA(config)# end RtrA# show cdp RtrA# show lldp neighbors When the brief keeps CDP and LLDP on links to your own devices, skip no cdp run and no lldp run, and quiet the ISP port instead: RtrA(config)# interface gigabitEthernet 0/1 RtrA(config-if)# no cdp enable RtrA(config-if)# no lldp transmit RtrA(config-if)# no lldp receive RtrA(config-if)# exit When the brief needs browser management, keep HTTPS only, with sign-ins checked against the local usernames: RtrA(config)# ip http secure-server RtrA(config)# ip http authentication local WHY: Each one is a listening service or an information leak. CDP tells an attacker the IOS version and IP of every neighbor. NOTE: Packet Tracer support for these varies by version; real IOS takes them all, so know them anyway. Keep ip http secure-server only if the brief needs web management. ALSO: With CDP and LLDP off, show cdp answers % CDP is not enabled and show lldp neighbors answers % LLDP is not enabled. no service pad turns off PAD, a leftover from X.25 networks. no cdp enable, no lldp transmit, and no lldp receive work on one port, for a brief that keeps discovery on links between your own devices. ip http authentication local makes web sign-ins check the local usernames. [I-04] Switch port security and shut unused ports AREA: Secure configuration SwA(config)# interface range fastEthernet 0/5 - 24 SwA(config-if-range)# shutdown SwA(config-if-range)# switchport mode access SwA(config-if-range)# switchport access vlan 999 SwA(config-if-range)# exit SwA(config)# interface fastEthernet 0/1 SwA(config-if)# switchport mode access SwA(config-if)# switchport port-security SwA(config-if)# switchport port-security maximum 2 SwA(config-if)# switchport port-security mac-address sticky SwA(config-if)# switchport port-security violation shutdown SwA(config-if)# exit SwA# show port-security interface fastEthernet 0/1 SwA# show interfaces status err-disabled After an approved PC swap, forget the old MAC address: SwA# clear port-security sticky interface fastEthernet 0/1 WHY: An open port means plug in and you are on the LAN. Port security pins MAC addresses; shutting unused ports is the cheapest control there is. NOTE: VLAN 999 is PARKING: unused ports wait there, shut down, in a VLAN separate from the native VLAN (99). show interfaces status err-disabled lists each port a violation shut down, with its reason. After an approved PC swap, clear port-security sticky interface fastEthernet 0/1 forgets the old PC's MAC address, and shutdown then no shutdown on the port brings it back. [I-05] User VLANs above 1 and a hardened trunk AREA: Secure configuration SwA(config)# vlan 10 SwA(config-vlan)# name STUDENTS SwA(config-vlan)# vlan 20 SwA(config-vlan)# name TEACHERS SwA(config-vlan)# vlan 30 SwA(config-vlan)# name PRINCIPALS SwA(config-vlan)# vlan 99 SwA(config-vlan)# name NATIVE SwA(config-vlan)# vlan 999 SwA(config-vlan)# name PARKING SwA(config-vlan)# exit SwA(config)# vtp mode transparent SwA(config)# vtp domain school.lan SwA(config)# interface gigabitEthernet 0/1 SwA(config-if)# description Trunk to RtrA G0/0 SwA(config-if)# switchport mode trunk SwA(config-if)# switchport trunk native vlan 99 SwA(config-if)# switchport trunk allowed vlan 10,20,30,99 SwA(config-if)# switchport nonegotiate SwA(config-if)# end SwA# show vlan brief SwA# show vtp status SwA# show interfaces trunk If the school adds IP phones, give them VLAN 40 on the trunk and on each phone port: SwA(config)# vlan 40 SwA(config-vlan)# name VOICE SwA(config-vlan)# exit SwA(config)# interface gigabitEthernet 0/1 SwA(config-if)# switchport trunk allowed vlan add 40 SwA(config-if)# interface fastEthernet 0/4 SwA(config-if)# switchport voice vlan 40 SwA(config-if)# end WHY: User VLANs above 1 keep hosts off the default VLAN unconfigured ports join. Double tagging works when an attacker's access VLAN equals the trunk's native VLAN; VLAN 1 is only the default case, so a host-free native VLAN closes it. DTP lets an attacker negotiate a trunk; switchport nonegotiate turns it off, and show interfaces trunk confirms. NOTE: The router end uses encapsulation dot1Q 99 native (Hunter A-08), so both ends agree on native 99. Between switches a mismatch logs %CDP-4-NATIVE_VLAN_MISMATCH; toward the router, a mismatch that lands on a host VLAN shows as that VLAN's hosts losing their gateway, so compare show interfaces trunk on SwA with the g0/0.99 subinterface in RtrA's running config. VLAN 99 runs without hosts or an IP; VLAN 999 PARKING holds shut ports. A multilayer switch such as a 3560 needs switchport trunk encapsulation dot1q before switchport mode trunk; a 2960 speaks 802.1Q only and goes without that line. ALSO: vtp mode transparent keeps this switch's own VLAN list: it ignores the VLAN changes in advertisements and passes them along, and show vtp status then reads Transparent with Configuration Revision 0. vtp mode off also stops passing them, on images with VTP version 3. description names the far end of a link, and show interfaces status lists it under Name. A bare allowed list replaces the whole list; switchport trunk allowed vlan add 40 appends one VLAN, and remove takes one away. On the phone port, the phone tags VLAN 40 and the PC behind it stays untagged in the port's access VLAN. On a switch whose show vtp status reads Client, set vtp mode transparent before the vlan lines: a client refuses local VLAN changes. The phones reach their gateway through a g0/0.40 subinterface on RtrA. [I-06] Login attack protection and minimum password length AREA: Account management RtrA(config)# security passwords min-length 10 RtrA(config)# login block-for 120 attempts 3 within 60 RtrA(config)# login on-failure log WHY: Lockout for brute force; min-length enforces the password policy at the moment a password is set. [I-07] Logging and time AREA: Audit logging RtrA(config)# service timestamps log datetime msec RtrA(config)# logging buffered 16384 RtrA(config)# logging host 10.1.20.50 RtrA(config)# ntp server 10.1.20.50 RtrA(config)# clock timezone UTC 0 RtrA# show clock RtrA# show ntp associations RtrA# show ntp status RtrA# show logging On a busy device, keep log messages off the console line: RtrA(config)# no logging console To feed a traffic sensor, copy the SwA uplink to Fa0/24 (a SPAN session): SwA(config)# no monitor session 1 SwA(config)# interface fastEthernet 0/24 SwA(config-if)# no shutdown SwA(config-if)# exit SwA(config)# monitor session 1 source interface gigabitEthernet 0/1 both SwA(config)# monitor session 1 destination interface fastEthernet 0/24 SwA(config)# end SwA# show monitor session 1 WHY: Correct, synchronized time is what lets logs from every device line up in an investigation. NOTE: 10.1.20.50 stands for a log and time server on the Teachers (management) VLAN. UTC keeps Site A and Site B on one clock. ALSO: show clock puts a * before the time until the clock syncs; show ntp associations marks the server in use with a *, and show ntp status reads Clock is synchronized once it locks on. Log messages reach the console by default; no logging console keeps them off a busy console line while logging buffered and logging host keep copies. For the SPAN session, Fa0/24 leaves the parked set: no shutdown brings it up, and as the destination it only sends copies to the sensor. One session takes ports or VLANs, so no monitor session 1 clears any old session first. [I-08] Give the switch an SVI in VLAN 20 (a VLAN and an SVI differ) AREA: Secure configuration SwA(config)# interface vlan 20 SwA(config-if)# ip address 10.1.20.2 255.255.255.0 SwA(config-if)# no shutdown SwA(config-if)# exit SwA(config)# vlan 20 SwA(config-vlan)# name TEACHERS SwA(config-vlan)# exit SwA(config)# ip default-gateway 10.1.20.1 SwA(config)# interface vlan 1 SwA(config-if)# shutdown SwA(config-if)# end SwA# show ip interface brief SwA# show vlan brief WHY: Ports join VLANs, layer-2 broadcast domains; the SVI (interface vlan 20) is the switch's layer-3 management interface. ip default-gateway lets the layer-2 switch reply across subnets, like Site B Teachers. NOTE: Vlan20 is down/down until VLAN 20 exists in the VLAN database. Autostate then holds it up/down until any VLAN 20 port (access, or a trunk allowing it) forwards in STP. ALSO: Larger networks give management its own VLAN; here management shares the Teachers subnet and its Teachers-only ACL. Shutting interface vlan 1 leaves the default VLAN devoid of an address. LEARN IT: Defense Ladder, Freshman f7, A VLAN and an SVI. https://freeapp4that.store/defense-ladder/#freshman/f7 [I-09] Read the switch: port status, neighbors, and learned MACs AREA: Secure configuration SwA# show interfaces status SwA# show interfaces status err-disabled SwA# show mac address-table SwA# show mac address-table interface fastEthernet 0/3 SwA# show cdp neighbors SwA# show cdp neighbors detail Fa0/3 reads a-half because its PC is set by hand to 100 Mb/s full duplex, so match it: SwA(config)# interface fastEthernet 0/3 SwA(config-if)# speed 100 SwA(config-if)# duplex full SwA(config-if)# end WHY: show interfaces status lists every port with its state, VLAN, duplex, and speed on one screen, so a port left up or a half-duplex link stands out. show mac address-table shows which MAC address each port has learned, and show cdp neighbors names the device at the far end of each link. NOTE: Give both ends of a link the same speed and duplex, or leave both on auto; speed auto and duplex auto are the defaults. Set speed first, then duplex. In show interfaces status, a-full and a-100 are negotiated values, and plain full and 100 were set by hand. show cdp neighbors lists only devices that still run CDP, so RtrA drops off the list after its no cdp run in I-03. LEARN IT: Defense Ladder, Sophomore s5, Cisco: configure a switch and a router. https://freeapp4that.store/defense-ladder/#sophomore/s5 ------------------------------ HUNTER ------------------------------------------ Hunt and harden. A Teachers-only VTY ACL, edge ACLs, interface hardening, layer-2 attack defenses, SNMP and AAA, protecting the config itself, auditing a config fast, router-on-a-stick, a host route shared through OSPF, and DHCP on the gateway. Learn it first: Defense Ladder, Senior se6, Cisco: audit and extend the two-site network. https://freeapp4that.store/defense-ladder/#senior/se6 -------------------------------------------------------------------------------- [A-01] Teachers-only VTY access AREA: Access control RtrA(config)# access-list 20 remark TEACHERS-ONLY RtrA(config)# access-list 20 permit 10.1.20.0 0.0.0.255 RtrA(config)# access-list 20 permit 10.2.20.0 0.0.0.255 RtrA(config)# access-list 20 deny any log RtrA(config)# line vty 0 4 RtrA(config-line)# access-class 20 in RtrA(config-line)# line vty 5 15 RtrA(config-line)# access-class 20 in RtrA(config-line)# exit SwA(config)# access-list 20 permit 10.1.20.0 0.0.0.255 SwA(config)# access-list 20 permit 10.2.20.0 0.0.0.255 SwA(config)# line vty 0 15 SwA(config-line)# access-class 20 in SwA(config-line)# exit RtrA# show access-lists 20 RtrA(config)# ip access-list standard 20 RtrA(config-std-nacl)# no 20 RtrA(config-std-nacl)# 20 permit 10.2.20.0 0.0.0.255 WHY: SSH encrypts; access-class admits only Teachers subnets (Site A and Site B); a standard (source-only) ACL suffices. Confirm: SSH from Students PCs ends with % Connection refused by remote host. NOTE: Apply access-class to every VTY range listed (show running-config | section line vty). A 2960's line vty 0 15 covers both 0 4 and 5 15. Wildcards invert subnet masks. ALSO: A 2911 (Packet Tracer and IOS 15) lists only line vty 0 4 until someone creates line vty 5 15. The example adds that range with the ACL already applied. Edit one entry and keep the rest: show access-lists 20 numbers the entries 10, 20, and 30, ip access-list standard 20 opens the list by those numbers, no 20 removes the Site B line, and 20 permit puts it back in the same place. A named list works the same way: ip access-list standard MGMT-ONLY, a permit line for the one admin address, then access-class MGMT-ONLY in. [A-02] Extended ACL on an interface: allow only what the scenario needs AREA: Secure configuration RtrA(config)# ip access-list extended OUTSIDE-IN RtrA(config-ext-nacl)# permit tcp any host 203.0.113.2 eq 443 RtrA(config-ext-nacl)# permit tcp any host 203.0.113.2 eq 80 RtrA(config-ext-nacl)# permit icmp any any echo-reply RtrA(config-ext-nacl)# permit tcp any any established RtrA(config-ext-nacl)# permit udp host 8.8.8.8 eq domain any RtrA(config-ext-nacl)# deny ip any any log RtrA(config-ext-nacl)# exit RtrA(config)# interface gigabitEthernet 0/1 RtrA(config-if)# ip access-group OUTSIDE-IN in RtrA(config-if)# exit RtrA# show access-lists WHY: The ACL drops traffic arriving from the ISP on G0/1 unless a line permits it. The deny log line records what the implicit deny hides; confirm with show access-lists counters. NOTE: Permit 203.0.113.2, RtrA's public ISP-facing address: IOS checks inbound ACLs before translating. Static NAT forwards web traffic: ip nat inside source static tcp 443 203.0.113.2 443, same for 80. ALSO: Stateless interface ACLs need reply permits: established matches TCP replies (ACK or RST set); the domain line admits 8.8.8.8 DNS replies. Stateful IOS zone-based policy firewalls track sessions more precisely. [A-03] Interface-level hardening AREA: Secure configuration RtrA(config)# interface gigabitEthernet 0/1 RtrA(config-if)# no ip redirects RtrA(config-if)# no ip proxy-arp RtrA(config-if)# no ip directed-broadcast RtrA(config-if)# no ip unreachables RtrA(config-if)# no ip mask-reply RtrA(config-if)# exit WHY: Proxy ARP and directed broadcasts enable spoofing and amplification (Smurf). Redirects and unreachables leak topology. G0/1 faces the ISP, so it gets the full set. NOTE: no ip unreachables is optional; it can interfere with path MTU discovery. Shut every router port the design leaves unused; on this 2911, G0/0, G0/1, and G0/2 all carry traffic. [A-04] Layer-2 attack defenses AREA: Secure configuration SwA(config)# ip dhcp snooping SwA(config)# ip dhcp snooping vlan 10 SwA(config)# interface gigabitEthernet 0/1 SwA(config-if)# ip dhcp snooping trust SwA(config-if)# ip arp inspection trust SwA(config-if)# exit SwA(config)# ip arp inspection vlan 10 SwA(config)# interface range fastEthernet 0/1 - 4 SwA(config-if-range)# spanning-tree portfast SwA(config-if-range)# spanning-tree bpduguard enable SwA(config-if-range)# storm-control broadcast level 20 SwA(config-if-range)# exit SwA(config)# spanning-tree portfast bpduguard default SwA(config)# spanning-tree mode rapid-pvst SwA(config)# spanning-tree vlan 10,20,30,99 root primary SwA(config)# interface gigabitEthernet 0/2 SwA(config-if)# no shutdown SwA(config-if)# spanning-tree guard root SwA(config-if)# end SwA# show ip dhcp snooping SwA# show ip dhcp snooping binding SwA# show spanning-tree inconsistentports WHY: Snooping stops rogue DHCP servers; dynamic ARP inspection checks ARP against the snooping table and stops poisoning; BPDU guard stops a rogue switch taking the STP root; storm control caps broadcast storms. G0/1 is trusted because DHCP replies and the router-on-a-stick gateway ARP arrive there. PortFast skips about 30 s of listening and learning, so it belongs on edge ports only; on a trunk or switch link a temporary loop forwards before STP blocks it. NOTE: Packet Tracer support for DAI and storm control varies by version. A host with a static address in VLAN 10 needs a static binding or an ARP ACL, because DAI drops ARP it cannot match. When the router serves or relays DHCP, add no ip dhcp snooping information option on the switch; the router drops requests that carry the switch's option 82 with an empty relay address. ALSO: Rapid PVST+ (spanning-tree mode rapid-pvst) recovers from a failed link in a few seconds, where PVST+, the 2960 default, takes 30 to 50. spanning-tree vlan 10,20,30,99 root primary makes SwA the root bridge on purpose. On a downlink to a second classroom switch (here G0/2, brought up for that switch), spanning-tree guard root keeps SwA the root: a superior BPDU there blocks the port, and show spanning-tree inconsistentports lists it. show ip dhcp snooping lists the snooped VLANs and the trusted ports, and show ip dhcp snooping binding lists the leases snooping has recorded. [A-05] SNMP and AAA AREA: Access control RtrA(config)# no snmp-server community public RtrA(config)# no snmp-server community private RtrA(config)# snmp-server group ADMINS v3 priv RtrA(config)# snmp-server user noc ADMINS v3 auth sha AuthPass-2026 priv aes 128 PrivPass-2026 RtrA(config)# aaa new-model RtrA(config)# aaa authentication login default local WHY: SNMP v1 and v2c with public or private community strings let anyone read, or write, the whole config. v3 adds authentication and encryption. AAA centralizes accounts. NOTE: After aaa new-model, lines use the default method list. Create a local user first so a way back in always exists. [A-06] Protect the config itself AREA: Secure configuration RtrA(config)# service tcp-keepalives-in RtrA(config)# service tcp-keepalives-out RtrA(config)# no boot network RtrA(config)# no service config RtrA(config)# secure boot-image RtrA(config)# secure boot-config RtrA(config)# archive RtrA(config-archive)# log config RtrA(config-archive-log-cfg)# logging enable RtrA(config-archive-log-cfg)# hidekeys RtrA(config-archive-log-cfg)# end RtrA# show version | include image|register RtrA(config)# config-register 0x2102 WHY: Keepalives drop dead sessions and free VTY lines. Resilient configuration stops an attacker from erasing the IOS image or startup config. The archive log records who changed what. NOTE: Several of these run on real devices only, outside Packet Tracer; know them anyway. ALSO: show version | include image|register shows the boot image and the configuration register. 0x2102 boots IOS from flash with the saved startup-config. A router left at 0x2142, the password-recovery setting, skips the startup-config at its next reload and comes up with an empty config. [A-07] Audit a given config fast RtrA# show running-config | include password|secret RtrA# show running-config | section line vty RtrA# show running-config | include http|cdp|snmp|small RtrA# show ip interface brief SwA# show port-security SwA# show vlan brief SwA# show interfaces trunk SwA# show interfaces switchport SwA# show interfaces fa0/1 switchport RtrA# show access-lists RtrA# show ip ssh RtrA# show ip route RtrA# ping 10.2.20.1 source 10.1.20.1 RtrA# show users WHY: Flag plaintext passwords, VTY lacking login local or SSH, open services, and missing routes. Ping 10.2.20.1 source 10.1.20.1 (Site B's Teachers gateway from Site A's); success proves two-way Teachers routing. NOTE: Flag VLAN 1 anywhere, including a trunk's native VLAN, and any trunk missing a VLAN. Flag unused ports left up as well. [A-08] Router-on-a-stick with a native subinterface AREA: Secure configuration RtrA(config)# interface gigabitEthernet 0/0.10 RtrA(config-subif)# encapsulation dot1Q 10 RtrA(config-subif)# ip address 10.1.10.1 255.255.255.0 RtrA(config-subif)# interface gigabitEthernet 0/0.20 RtrA(config-subif)# encapsulation dot1Q 20 RtrA(config-subif)# ip address 10.1.20.1 255.255.255.0 RtrA(config-subif)# interface gigabitEthernet 0/0.30 RtrA(config-subif)# encapsulation dot1Q 30 RtrA(config-subif)# ip address 10.1.30.1 255.255.255.0 RtrA(config-subif)# interface gigabitEthernet 0/0.99 RtrA(config-subif)# encapsulation dot1Q 99 native RtrA(config-subif)# interface gigabitEthernet 0/0 RtrA(config-if)# description Trunk to SwA G0/1 RtrA(config-if)# no shutdown RtrA(config-if)# end RtrA# show ip interface brief WHY: One trunk carries Students, Teachers, and Principals to RtrA. Each subinterface takes one tag and becomes that VLAN's .1 gateway, so the three VLANs route to each other through RtrA. NOTE: Subinterfaces follow the physical port: no shutdown goes on G0/0, which stays unaddressed. An ISR 4000 (IOS XE) names it GigabitEthernet0/0/0; subinterface commands match. ALSO: encapsulation dot1Q 99 native matches the switch's native VLAN 99, so untagged frames land on a subinterface without an IP or hosts. Watchman I-05 builds the switch-side trunk. A multilayer switch replaces router-on-a-stick: ip routing, then one SVI per VLAN as its gateway (interface vlan 10, ip address 10.1.10.1 255.255.255.0). [A-09] Host route to 8.8.8.8, shared through OSPF (concept) AREA: Secure configuration RtrA(config)# ip route 8.8.8.8 255.255.255.255 203.0.113.1 RtrA(config)# router ospf 1 RtrA(config-router)# router-id 1.1.1.1 RtrA(config-router)# network 10.0.0.0 0.0.0.3 area 0 RtrA(config-router)# network 10.1.0.0 0.0.255.255 area 0 RtrA(config-router)# passive-interface default RtrA(config-router)# no passive-interface gigabitEthernet 0/2 RtrA(config-router)# redistribute static subnets RtrA(config-router)# end RtrA# clear ip ospf process RtrA# show ip ospf neighbor RtrA# show ip protocols RtrA# show ip route 8.8.8.8 RtrA# show ip route ospf WHY: The /32 host route sends only 8.8.8.8 to this site's ISP; redistribute static subnets shares it with RtrB as an OSPF external route (O E2, metric 20). Each router prefers its own static route (administrative distance 1) over the neighbor's O E2 copy (110), so the neighbor's route takes over when the local uplink fails. On classic IOS the subnets keyword lets a /32 through; without it, IOS redistributes classful networks only. passive-interface keeps hellos off the user VLANs and still advertises their subnets; only G0/2 forms a neighbor. NOTE: OSPF stays at concept level here. show ip route 8.8.8.8 on RtrA reports Known via "static", distance 1, metric 0; with RtrA's uplink down it reports Known via "ospf 1", distance 110, metric 20, type extern 2, with the last update from 10.0.0.2. In the full show ip route table the same entries read S 8.8.8.8 [1/0] via 203.0.113.1 and O E2 8.8.8.8 [110/20] via 10.0.0.2, under the header 8.0.0.0/32 is subnetted, 1 subnets. RtrB runs the same commands with 198.51.100.1 and 10.2.0.0. IOS XE 16 and later adds subnets automatically. ALSO: router-id 1.1.1.1 names RtrA in OSPF (RtrB uses 2.2.2.2). When OSPF already runs, IOS applies a new ID only after clear ip ospf process: answer yes at Reset ALL OSPF processes?, and each neighbor drops for a moment. show ip ospf neighbor then lists 2.2.2.2 in state FULL on GigabitEthernet0/2, and show ip protocols shows the router ID, networks, passive interfaces, and redistribution in one view. default-information originate, under router ospf, shares a default route (0.0.0.0/0) once the router holds one; this RtrA holds the /32 host route in place of a default route. [A-10] DHCP on the gateway, or a relay to a central server AREA: Secure configuration RtrA(config)# ip dhcp excluded-address 10.1.10.1 10.1.10.9 RtrA(config)# ip dhcp pool STUDENTS RtrA(dhcp-config)# network 10.1.10.0 255.255.255.0 RtrA(dhcp-config)# default-router 10.1.10.1 RtrA(dhcp-config)# dns-server 10.1.20.50 RtrA(dhcp-config)# exit SwA(config)# no ip dhcp snooping information option RtrA# show ip dhcp binding With a central DHCP server instead, the Students gateway relays each request to it: RtrA(config)# interface gigabitEthernet 0/0.10 RtrA(config-subif)# ip helper-address 10.1.20.50 RtrA(config-subif)# exit WHY: Excluded addresses keep the gateway and fixed hosts out of the pool, so every lease DHCP hands out is a free address; a relay lets one central server answer every VLAN. NOTE: Each pool line becomes one setting on the client: network sets the subnet, default-router the gateway, and dns-server the name server. With DHCP snooping on SwA (A-04), the switch adds option 82 to each request, which can make RtrA ignore the requests; no ip dhcp snooping information option on SwA fixes that. show ip dhcp binding then lists each lease by IP address and MAC address. ALSO: ip helper-address goes on the client-facing gateway, here g0/0.10, and names the server's address. The central server then holds one pool for each subnet it serves. LEARN IT: Defense Ladder, Junior j4, Cisco: VLANs, routing, and ACLs. https://freeapp4that.store/defense-ladder/#junior/j4 ------------------------------ FIX OR BREAK? (practice cards) ------------------ Brief: Authorized network admin accounts: netadmin, techlead. Management over SSH only. Action: Run no username guest after seeing username guest privilege 15 in the config. Call: FIX. An unlisted privilege-15 account is an admin backdoor. Remove it. Brief: The web server, published at RtrA's public address 203.0.113.2, must stay reachable from the internet on ports 80 and 443. Action: Apply an inbound ACL on the outside interface with only deny ip any any. Call: BREAKS IT. That breaks the required service. Permit 80 and 443 to that address, plus the return traffic inside hosts need, then deny everything else. Brief: Management over SSH only. Action: Configure transport input telnet ssh on the vty lines so the helpdesk's old client still works. Call: BREAKS IT. The brief says SSH only. transport input ssh. Brief: The school uses CDP for its IP phones on the access switch. Action: Run no cdp run on the access switch. Call: BREAKS IT. CDP is required there. Disable it per port on non-phone edge ports (no cdp enable) or on the router instead. Brief: Ports Fa0/1 to Fa0/4 are in use; the rest are spare. Action: interface range Fa0/5 - 24, shutdown, switchport access vlan 999. Call: FIX. Unused ports shut and parked in VLAN 999 (PARKING). Cheapest control on the switch. Brief: An investigation question asks which VLAN was the native VLAN on the trunk before any changes were made. Action: Change the native VLAN to 99 first, then answer the question from the new config. Call: CHECK FIRST. Answer from the original config first. Evidence before changes. Brief: The monitoring server at 10.1.20.60 polls the router with SNMP. Action: Run no snmp-server to remove SNMP completely. Call: BREAKS IT. Monitoring is required. Remove public and private community strings and configure SNMPv3 instead. Brief: Management comes only from the Teachers subnets, 10.1.20.0/24 and 10.2.20.0/24. Action: access-list 20 permit 10.1.20.0 0.0.0.255 and access-list 20 permit 10.2.20.0 0.0.0.255, then access-class 20 in on every vty range RtrA lists. Call: FIX. Exactly what access-class is for: the Teachers subnets at both sites reach the prompt, and everyone else is refused. Brief: Nothing in the brief mentions AAA. Action: Run aaa new-model before any username exists in the config. Call: CHECK FIRST. With no local user, aaa new-model can lock you out of the device. Create the local user first, then enable AAA. Brief: Students keep internet access. Action: Set switchport trunk native vlan 10 on SwA G0/1. Call: BREAKS IT. Native VLAN 10 sends Students traffic untagged, so RtrA files them under its native subinterface g0/0.99 and Students lose their gateway. It also puts a host VLAN where double tagging works. Keep native 99 on both ends. Brief: Only Teachers at either site may manage SwA. Action: Copy RtrA's line vty 0 4 / access-class 20 in onto SwA, whose show running-config lists line vty 0 4 and line vty 5 15. Call: BREAKS IT. vty 0 4 alone leaves lines 5 to 15 reachable from every subnet, which breaks 'Only Teachers at either site may manage SwA'. Apply access-class 20 in to line vty 0 15. Brief: Management over SSH only. Action: Keep ip http server and add ip http port 8080 so scanners miss the page. Call: BREAKS IT. The web page still answers on port 8080, a port that scans of common ports check, so it stays reachable and breaks SSH only. no ip http server and no ip http secure-server turn the web server off. ip http secure-port moves HTTPS the same way, with the same result. ------------------------------ SPOT THE FINDING (output snippets) -------------- Lines from show running-config. Tap the finding. hostname RtrA >> enable password cisco123 service password-encryption banner motd ^CUnauthorized access prohibited^C WHY: enable password is reversible Type 7 at best. Replace it with enable secret. The vty section of show running-config. Tap the finding. line vty 0 4 password Vty-2026! >> no login exec-timeout 5 0 WHY: no login means the line skips the password check entirely. Set login (or login local). The vty section of show running-config. Tap the finding. line vty 0 4 login local >> transport input telnet ssh exec-timeout 5 0 WHY: Telnet is still allowed. transport input ssh removes the cleartext path. Global config lines. Tap the finding. ip ssh version 2 >> ip http server no cdp run login block-for 120 attempts 3 within 60 WHY: The HTTP management server is on. no ip http server (and no ip http secure-server unless required). Output of show ip interface brief on a switch where only Fa0/1 to Fa0/4 are in use. Tap the finding. Interface IP-Address OK? Method Status Protocol FastEthernet0/1 unassigned YES unset up up FastEthernet0/4 unassigned YES unset up up >> FastEthernet0/12 unassigned YES unset up up FastEthernet0/24 unassigned YES unset administratively down down WHY: An unused port that is up is an open door. Shut it and park it in VLAN 999 (PARKING). Global config lines. Tap the finding. >> snmp-server community public RW service tcp-keepalives-in no ip source-route ntp server 10.1.20.50 WHY: A public read-write community string lets anyone rewrite the config. Remove it; use SNMPv3 if monitoring is required. Trunk interface config. Tap the finding. interface GigabitEthernet0/1 switchport mode trunk >> switchport trunk native vlan 1 switchport nonegotiate WHY: Native VLAN 1 is the default, and every unconfigured access port sits in VLAN 1, so double tagging works out of the box. Move the native VLAN to a host-free VLAN such as 99 on both ends. SwA G0/1, the trunk to RtrA. This network keeps PortFast on Fa edge ports only. Tap the finding. interface GigabitEthernet0/1 switchport trunk native vlan 99 switchport trunk allowed vlan 10,20,30,99 switchport mode trunk switchport nonegotiate >> spanning-tree portfast trunk WHY: PortFast belongs on edge ports. On a trunk it skips listening and learning, so if the far end is ever a switch, a temporary loop forwards before STP blocks it. Remove it with no spanning-tree portfast trunk. RtrA ACL and vty lines. The brief: only Teachers at either site manage the devices. Tap the finding. access-list 20 permit 10.1.20.0 0.0.0.255 access-list 20 permit 10.2.20.0 0.0.0.255 >> access-list 20 permit 10.1.10.0 0.0.0.255 line vty 0 4 access-class 20 in transport input ssh WHY: 10.1.10.0/24 is the Students subnet, so Students reach the VTY prompt. Remove just that entry: ip access-list standard 20, then no 30 (its sequence number in show access-lists). no access-list 20 permit 10.1.10.0 0.0.0.255 deletes the whole list. ------------------------------ OFFICIAL SOURCES -------------------------------- Cisco Guide to Harden Cisco IOS Devices https://www.cisco.com/c/en/us/support/docs/ip/access-lists/13608-21.html Configuring Secure Shell (SSH) on routers and switches https://www.cisco.com/c/en/us/support/docs/security-vpn/secure-shell-ssh/4145-ssh.html Cisco IOS Security Command Reference: enable secret and algorithm types https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/security/d1/sec-d1-cr-book/sec-cr-e1.html Catalyst 2960 configuration guide: port security https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst2960/software/release/12-2_55_se/configuration/guide/scg_2960/swtrafc.html Catalyst 2960 configuration guide: VLANs and trunks https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst2960/software/release/12-2_55_se/configuration/guide/scg_2960/swvlan.html CIS Critical Security Controls v8.1 https://www.cisecurity.org/controls/v8 CIS Benchmarks https://www.cisecurity.org/cis-benchmarks ================================================================================