Imagine you just racked a new device and put it on the network. It is reachable.
The first thing you lock down is who can reach its command line, and what they can do once they are in.This is where device access control becomes interesting.
The Three Line Types
A Cisco device groups its CLI entry points into three line types.

Figure 1 – Console, VTY, and aux lines all reach R1
You can see all three in the running configuration:
R1# show running-config | section line line con 0 line aux 0 line vty 0 4The console line (con 0) is the physical port you reach with a rollover cable.
It is your local, out-of-band entry, the one you use when the network is down.
The auxiliary line (aux 0) is a legacy modem port.
On modern networks it is rarely used, so you usually disable it.
The VTY lines (vty 0 4) are virtual terminals for remote access over the network.
You reach them through SSH or Telnet. Five lines (0 to 4) exist by default, and many platforms support up to 16 (0 to 15). Routers typically show lines 0 to 4 by default, while switches display lines 0 to 15.
Answer the question below
Which line is the physical, out-of-band port?
Why Lines Matter
Each line is an independent entry point with its own configuration.
A line left unsecured is an open door: anyone who reaches it can gain CLI access!
So you secure each line on its own, deciding who may connect and how they authenticate.Answer the question below
Which line type is used for SSH and Telnet remote access?
Choosing the line decides who can connect. The password decides whether you can trust that connection.
Passwords are not all stored the same way. How a password is stored decides how easily it can be recovered.Password Types
Cisco IOS XE stores passwords in five types, from weakest to strongest:

Figure 2 – Type 9 (scrypt) is the strongest storage
Type 0: cleartext, stored in plain view. Never use it.
Type 7: a reversible Vigenère cipher that online tools crack in under a second.
Type 5: a fast MD5 hash, so it can still be brute-forced.
Type 8: a slow PBKDF2 hash, very hard to crack.
Type 9: a slow, memory-hard scrypt hash, the hardest to crack and recommended by Cisco.
The service password-encryption command only upgrades Type 0 passwords to Type 7.
It hides them from a shoulder-surfer but gives no real protection.
Use enable secret instead of enable password, which stores Type 0. A standard enable secret creates a Type 5 hash, while enable algorithm-type scrypt secret creates a Type 9 hash.Answer the question below
Which password type does Cisco recommend?
Configuring Strong Passwords
Set the enable secret with the scrypt algorithm, then turn on encryption for any remaining legacy passwords:
R1# configure terminal Enter configuration commands, one per line. End with CNTL/Z. R1(config)# enable algorithm-type scrypt secret Adm!nScrypt9 R1(config)# service password-encryption R1(config)# endThe enable secret is now stored as a Type 9 hash.
You run service password-encryption right after as a safety net.
It does not touch the Type 9 secret. It only scrambles any older Type 0 passwords elsewhere in the config, and only into weak Type 7.Answer the question below
Which password type does the service password-encryption command apply?
A password on a line is shared by everyone who uses that line.
Instead, you give each administrator their own named account.
These accounts live in the device's local user database.login vs login local
There are two ways a line can check credentials.
The login command checks a single password configured on the line itself (Type 0, not recommended).
The login local command instead validates every connection against the local username database.
Username-based authentication is the recommended approach.
Configuring Local Users
First, create a hashed user with full privilege:
R1# configure terminal R1(config)# username admin privilege 15 algorithm-type scrypt secret Adm!nScrypt9That one line builds the account: admin is the username, privilege 15 gives it full access, and algorithm-type scrypt secret stores the password as a Type 9 hash.
The account exists, but no line uses it yet. Apply it to the console and VTY lines:
R1(config)# line console 0 R1(config-line)# login local R1(config-line)# exit R1(config)# line vty 0 4 R1(config-line)# transport input ssh R1(config-line)# login local R1(config-line)# endThe login local command connects the two: it tells each line to check the local username database.
On the VTY lines, transport input ssh also blocks cleartext Telnet and allows only SSH.
The keyword after transport input sets which protocols the line accepts:all: Telnet and SSH
none: neither, blocks remote access
telnet: Telnet only
ssh: SSH only, used above
Answer the question below
Which command tells a line to check the local user database?
Enabling SSH
The transport input ssh setting above accepts only SSH.
But SSH does not work until the device has an RSA key pair.
The hostname is already R1, so you add a domain name, generate the key, then force version 2:R1# configure terminal R1(config)# ip domain-name pingmynetwork.lab R1(config)# crypto key generate rsa modulus 2048 The name for the keys will be: R1.pingmynetwork.lab % The key modulus size is 2048 bits [OK] (elapsed time was 2 seconds) R1(config)# ip ssh version 2 R1(config)# endThe hostname and domain name together name the key (R1.pingmynetwork.lab).
Then crypto key generate rsa builds the key pair that encrypts the session.
Recent IOS XE releases reject keys shorter than 2048 bits, so 2048 is the safe minimum.
Version 1 has known flaws, so ip ssh version 2 forces the stronger SSHv2.Verify by opening a session from a second device.
R2# ssh -l admin 10.1.12.1 Password: R1#Answer the question below
Which SSH version should you enforce?
Answer the question below
If R1 had been renamed EDGE1 before crypto key generate rsa, what name would the keys get?
Authentication proves who you are.
Privilege levels decide how much you can do once you are in.How Privilege Levels Work
This is what lets you give a junior technician limited access while senior staff keep full control.
Cisco calls it role-based access control (RBAC).
Figure 3 – Privilege levels run from 0 to 15
IOS XE defines three levels by default:
Level 0: minimal access, only a few commands like enable and logout.
Level 1: user EXEC, the read-only prompt R1> where configure terminal is not available.
Level 15: privileged EXEC, the prompt R1# with full control.
Answer the question below
Which privilege level gives full administrative access?
Custom Privilege Levels
By now you have one account, admin at privilege 15, with full control.
The second account, netops, will get a limited role.The levels 2 through 14 are yours to customize.
You move specific commands down to a chosen level and assign a user to it.
Here you place netops in level 5: they may enter config mode and shut down interfaces, nothing else:R1# configure terminal R1(config)# username netops privilege 5 algorithm-type scrypt secret NetOps!Scrypt9 R1(config)# privilege exec level 5 configure terminal R1(config)# privilege configure level 5 interface R1(config)# privilege interface level 5 shutdown R1(config)# endEach privilege line grants level 5 exactly one command:
privilege exec level 5 configure terminal lets netops enter config mode.
privilege configure level 5 interface lets them pick an interface.
privilege interface level 5 shutdown lets them shut that interface down.
All three are needed. To reach shutdown, netops steps through exec, then config, then interface mode, and each level of the CLI tree must be granted.
Answer the question below
How many privilege commands are needed to let netops run shutdown?
When netops logs in, they land directly in level 5.
Now log in as each account and test a command to see the difference.
Figure 4 – Allowed at privilege 15
admin has privilege 15.
Config mode opens with no problem (passwordAdm!nScrypt9):R2# ssh -l admin 10.1.12.1 Password: R1# configure terminal Enter configuration commands, one per line. End with CNTL/Z. R1(config)#netops has privilege 5:

Figure 5 – Denied at privilege 5
The CLI does not even expose a level-15 command (password
NetOps!Scrypt9):R2# ssh -l netops 10.1.12.1 Password: R1# show privilege Current privilege level is 5 R1# show running-config % Invalid input detected at '^' marker.Even at level 5, the prompt still shows R1#.
Only show privilege reveals the real level, and it confirms netops is restricted to the commands you granted.Answer the question below
Which privilege levels can you customize?
With users, lines, and privilege levels in place, confirm who is connected, then close the gaps an attacker would look for.
Checking Active Sessions
The show users command lists every open line, who is on it, and from where:
R1# show users Line User Host(s) Idle Location * 0 con 0 admin idle 00:00:00 2 vty 0 admin idle 00:02:14 10.1.12.2The asterisk marks your own session (the console).
The other row shows an admin connected over VTY from 10.1.12.2.Answer the question below
Which command lists the active console and VTY sessions?
Hardening the Lines
Three settings close the most common gaps: drop idle sessions, restrict VTY to a trusted subnet, and shut the unused auxiliary line.
R1# configure terminal R1(config)# access-list 1 permit 10.1.12.0 0.0.0.255 R1(config)# line vty 0 4 R1(config-line)# exec-timeout 5 0 R1(config-line)# access-class 1 in R1(config-line)# exit R1(config)# line aux 0 R1(config-line)# no exec R1(config-line)# transport input none R1(config-line)# endEach command maps to one of those three goals:
exec-timeout 5 0 disconnects an idle session after five minutes.
access-class 1 in applies access-list 1, which allows only the 10.1.12.0/24 subnet (wildcard 0.0.0.255).
On the aux line, no exec and transport input none close an entry point that serves no purpose on a modern network.
On a single device, local authentication and privilege levels are enough.
Across a whole network, they stop scaling.
You retype every account on every device, and a departing engineer's login lingers on every box you forget to clean up.
The next lesson centralizes all of this with AAA.Answer the question below
Which command shows your current privilege level?
Answer the question below
With admin on vty 0, three more admins SSH in: how many vty 0 4 lines stay free?