Basic Device Access & Management
I decided to sit down and study for the CCNA once again. I found the best way for me to retain information is by writing it down, and by teaching it to someone. I feel a blog checks both boxes.
Topology

IP Addresses
| Device | Interface | IP Address | Purpose |
|---|---|---|---|
| R1 | GigabitEthernet0/1 | 10.0.1.1/24 | Link to SW1 |
| SW1 | VLAN 1 (SVI) | 10.0.1.2/24 | Management SVI |
| SW1 | Default Gateway | 10.0.1.1 | Points to R1 |
| R2 | GigabitEthernet2 | 10.0.1.3/24 | Link to SW1 |
Containerlab YAML File
---
name: module01-device-access
topology:
nodes:
r1:
kind: cisco_iosv
image: vrnetlab/cisco_iosv:high_iron_20200929
startup-config: ""
sw1:
kind: cisco_cat9kv
image: vrnetlab/cisco_cat9kv:17.15.01
startup-config: ""
r2:
kind: cisco_csr1000v
image: vrnetlab/cisco_csr1000v:17.03.08a
startup-config: ""
links:
# R1 Gi0/1 <-> SW1 Gi1/0/1
- endpoints:
- "r1:eth1"
- "sw1:eth1"
# SW1 Gi1/0/2 <-> R2 Gi2
- endpoints:
- "sw1:eth2"
- "r2:eth1"Hostnames & Domain Name
First thing to do is set the hostnames, so it’ll make it easier to know which console you’re logged into. Having a domain name is required for SSH key generation.
Router# configure terminal
Router(config)# hostname R1
R1(config)# ip domain-name ccna.lab
R1(config)# no ip domain-lookup
R1(config)# endSwitch# configure terminal
Switch(config)# hostname SW1
SW1(config)# ip domain-name ccna.lab
SW1(config)# no ip domain-lookup
SW1(config)# endRouter# configure terminal
Router(config)# hostname R2
R2(config)# ip domain-name ccna.lab
R2(config)# no ip domain-lookup
R2(config)# endPasswords & Line Security
Next, I set the enable secret, console password, and VTY line passwords.
| |
- Line 1:
- Enables secret password
- Line 3:
- Encrypts all plaintext passwords in the config
- Line 6:
- Sets password to access console
- Line 8:
- Prevents syslog messages from interrupting my typing.
- Line 9:
- Sets a 15 minute idle timeout.
Login Banners
Then I configured MOTD and login banners.
| |
- Line 1:
- Message of the Day banner which is shown to all connections
- Line 9:
- Login banner which is shown after MOTD, but before the password prompt.
Management IP Addresses
Next I assigned IPs to the interfaces connecting the devices through SW1. This gives me the L3 reachability needed for SSH.
R1# configure terminal
R1(config)# interface GigabitEthernet0/1
R1(config-if)# ip address 10.0.1.1 255.255.255.0
R1(config-if)# description Link to SW1 Gi1/0/1
R1(config-if)# no shutdown
R1(config-if)# exit
R1(config)# end | |
- Lines 3-5:
- Ensures the interfaces connecting to R1 and R2 are up
- Lines 13-16:
- Management SVI on VLAN 1
- Line 19:
- Default gateway so SW1 can reach the other subnets
ip default-gateway only works when ip routing is disabled.
R2# configure terminal
R2(config)# interface GigabitEthernet2
R2(config-if)# ip address 10.0.1.3 255.255.255.0
R2(config-if)# description Link to SW1 Gi1/0/2
R2(config-if)# no shutdown
R2(config-if)# exit
R2(config)# endVerify L3 Connectivity
From R1 I ping SW1 and R2
R1# ping 10.0.1.2
R1# ping 10.0.1.3Fromt SW1 I ping R1 and R2
SW1# ping 10.0.1.1
SW1# ping 10.0.1.3From R2 I ping R1 and SW1
R2# ping 10.0.1.1
R2# ping 10.0.1.2Then verified interface status on all devices:
R1# show ip interface brief
SW1# show ip interface brief
R2# show ip interface briefSSH v2 Configuration
The 4 prerequisites for SSH:
- A hostname other than the default
- An IP domain-name
- RSA keys generated
- VTY lines configured for
login localwithtransport input ssh
| |
- Line 3:
- Creates a local user account
- Line 5:
- Generates RSA keys
- Line 7:
- Set SSH version 2
- Lines 9-10:
- Optional - Set SSH timeout and max retries
- Lines 12-14:
- Configures VTY lines for SSH with local auth
- Lines 17-19:
- Optional - Secures VTY 5-15 if available
- privilege 15:
- Gives the user immediate access to privileged EXEC mode without needing to type
enable.
login- uses the line password (set withpassword)login local- uses the local username database (set withusername)
SSH requires login local.
Verify SSH Access
I then tested SSH between devices to make sure everything works.
| |
- Line 1:
- SSH from R1 into SW1
- Lines 5-7:
- Confirm I’m on SW1, then exit back to R1
- Line 9:
- SSH from R1 into R2
Then verified with show commands.
| |
- Line 1:
- Verify SSH status
- Line 5:
- See active SSH sessions
- Line 7:
- See who’s connected
- Line 9:
- Verify VTY line config
- Line 11:
- Verify Telnet is blocked
Telnet should not work since I setup tansport input ssh.
Configuration Management
| |
- Line 1:
- View the running config (what’s active in RAM)
- Line 3:
- View the startup config (what’s saved in NVRAM)
- Line 5:
- Save running-config to startup-config
copy running-config startup-configsaves my work.copy startup-config running-configmerges saved config into the running config, it does not replace it.
SW1# copy running-config startup-config
R2# copy running-config startup-config
SW1# show version
R2# show versionShow Commands
A list of commands to find device information.
show version
show inventory
show processes cpu sorted
show memory statistics
show file systems
dir
showing running-config | section line