Course contents

Chapter 1: Cisco IOSLesson 2 of 10

Initial switch and router setup

Hostname, passwords, banners, management IP and default gateway, interface descriptions and basic interface settings.

Beginner · 12 min read

Technical definition

Baseline configuration establishes a device identity, controlled access, management connectivity and interface settings. A Layer 2 switch uses a management SVI and default gateway; a router uses routed interfaces and its routing table.

Start at the training bench

Illustrative training bench with a laptop, rack-mounted switch and router, a blue serial console cable and yellow Ethernet leads.
Two cables, two different jobsA console cable gives access before an IP address is configured. Ethernet patch leads carry network traffic. Match the cable and adapter to the actual device's console port; USB console ports are also common.AI-generated hardware illustration. Generic equipment, not a Cisco product photograph or a wiring reference. Use the labelled topology and device guide for actual ports.

The branch lab

Configure R1 for the branch LAN and give SW1 a management address. Start from console access, protect local and remote login, then verify SSH from the admin PC. This lab uses VLAN 1 for simplicity; use your network's management VLAN in a real deployment.

Diagram
The branch lab after initial setup
The branch lab after initial setup
Gi0/0198.51.100.2/30Gi0/1Gi1/0/24Gi1/0/1Gi0/2ISPIP 198.51.100.1R1Gi0/1 192.168.10.1SW1Vlan1 192.168.10.2Admin PCIP 192.168.10.10Admin, other LANIP 192.168.20.10

Device key: ISP (network / service) · R1 (router) · SW1 (switch) · Admin PC (computer) · Admin, other LAN (laptop)

Lines show the example’s network connections. Thick links: uplinks/WAN, as labelled. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.

Reading the addresses

IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.

An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.

  • ISP: IP 198.51.100.1
  • R1: Gi0/1 192.168.10.1
  • SW1: Vlan1 192.168.10.2
  • Admin PC: IP 192.168.10.10
  • Admin, other LAN: IP 192.168.20.10
  1. 1. Same subnet: the admin PC reaches SW1's management address directly. No gateway needed.
  2. 2. From another subnet: a session from 192.168.20.0/24 reaches SW1 through R1.
  3. 3. The reply needs ip default-gateway: SW1 must know to send off-subnet replies to 192.168.10.1, or the session usually fails (proxy ARP on R1 can sometimes hide the missing setting).

Why each baseline setting is there

  • Hostname: the prompt changes to the name, so you always know which device you are typing on. It also appears in CDP, logs and SSH keys.
  • Separate passwords per entry point: the console, the remote VTY (virtual terminal) lines and privileged EXEC are three different doors. Each needs its own lock.
  • A switch's IP lives on an SVI: a Layer 2 switch port has no IP address. Instead you give an address to a switched virtual interface (SVI), a virtual interface for one VLAN, such as interface vlan 1. The switch answers management traffic on that VLAN.
  • Router interfaces start shut down: on most Cisco routers every interface is administratively down until you type no shutdown. Switch access ports are commonly enabled by default. Check the actual state and shut down unused ports.

The baseline in six steps

  1. You connect to the console and enter global configuration (see CLI modes and navigation).
  2. hostname renames the device. The prompt changes right away.
  3. enable secret protects the move from > to #. It is stored as a hash.
  4. For the console, password with login uses a line password. For SSH, create a local username, generate the device's keys and use login local on the VTY lines.
  5. An IP address on a routed interface (router) or an SVI (switch) makes the device reachable. A switch also needs ip default-gateway to reply to other subnets.
  6. You save with copy running-config startup-config, or everything is lost at the next reload.

Configuring R1 and SW1

Based on Cisco IOS / IOS XE documentation, not run on a lab device. The console line password is shown for learning. The SSH example uses a local username; access controls and stronger authentication options are covered in Passwords, local users and SSH.

Settings shared by the router and the switch

hostname R1 enable secret Str0ng-Enable! service password-encryption no ip domain-lookup banner motd # Authorised access only. Activity is logged. #

Global configuration. The banner text goes between two copies of a delimiter character (# here) that doesn't appear in the message.

line console 0 password C0nsole-Pass login logging synchronous exec-timeout 10 0

Console access uses the line password. logging synchronous redraws an interrupted input line; exec-timeout ends an idle session after ten minutes.

Enable SSH with a local account

Diagram
An SSH login needs three independent pieces
An SSH login needs three independent pieces
An SSH login needs three independent piecesFirst establish IP reachability and a return path. Then configure the device hostname, domain and RSA keys for its SSH server. Finally configure a local account and VTY login local with transport input ssh. These are requirements for this local-authentication lab, not every AAA deployment.Admin PCSW1Vlan1: 192.168.10.2/24R1Gi0/1: 192.168.10.1/241 · Reach the IPSVI or routed interface upCorrect mask and return route2 · Enable the SSH serverHostname + domain + RSA keySSH version 23 · Authenticate on VTYLocal username + login localtransport input ssh
Local-authentication lab, with no existing AAA policy. A successful ping alone does not prove that SSH is enabled or that the account can log in.

Run this from global configuration on each lab device after setting its hostname (R1 or SW1). Replace the example secret with your own. This example assumes no AAA configuration is already controlling logins.

ip domain name lab.example username labadmin secret Lab-Only-Change-Me! crypto key generate rsa modulus 2048 ip ssh version 2 line vty 0 4 login local transport input ssh exec-timeout 10 0 exit

The domain name and RSA keys establish SSH for this example. login local authenticates against the local account; transport input ssh allows SSH and excludes Telnet.

Check line vty ? for your device's available lines. If lines 5 through 15 also exist, apply the same login, transport and timeout settings to them. Some images prompt for the RSA key size separately. Keep console access while checking your first SSH login.

Router interfaces (R1)

interface GigabitEthernet0/0 description WAN to ISP ip address 198.51.100.2 255.255.255.252 no shutdown interface GigabitEthernet0/1 description LAN to SW1 Gi1/0/24 ip address 192.168.10.1 255.255.255.0 no shutdown interface GigabitEthernet0/2 description LAN 192.168.20.0/24 ip address 192.168.20.1 255.255.255.0 no shutdown interface GigabitEthernet0/3 description Unused shutdown

Each interface needs an address in its own subnet and no shutdown. The description is free text that shows up in show interfaces description.

Switch management and ports (SW1)

Diagram
The switch needs a gateway for the off-subnet reply
The switch needs a gateway for the off-subnet reply
The switch needs a gateway for the off-subnet replyAdmin 192.168.20.10 sends through R1 to switch management SVI 192.168.10.2. R1 Gi0/2 is 192.168.20.1/24, Gi0/1 is 192.168.10.1/24 and connects to SW1 Gi1/0/24. SW1 has IP routing disabled. To reply to 192.168.20.10, it sends to default gateway 192.168.10.1.Admin LANVLAN 1 · managementAdmin PC192.168.20.10/24R1SW1Vlan1: 192.168.10.2/24Gi0/2192.168.20.1/24Gi0/1192.168.10.1/24SW1 Gi1/0/24Request: admin → R1 → SW1 management SVIReply: SW1 → gateway R1 → adminSW1(config)# ip default-gateway 192.168.10.1
SW1 is a Layer 2 switch with ip routing disabled. Routes, VLAN 1 forwarding and ARP must work. Proxy ARP is not a substitute for configuring the intended gateway.
hostname SW1 interface vlan 1 description Management SVI ip address 192.168.10.2 255.255.255.0 no shutdown exit ip default-gateway 192.168.10.1 interface GigabitEthernet1/0/1 description Admin PC speed auto duplex auto interface GigabitEthernet1/0/24 description Uplink to R1 Gi0/1 interface range GigabitEthernet1/0/2 - 23 description Unused shutdown

The SVI is the switch's management address. ip default-gateway is for a Layer 2 switch (one without ip routing enabled). Shutting unused ports is a basic security step.

Leave speed and duplex on auto unless you have a reason not to. If you hard-code them on one end, hard-code the same values on the other end, or you risk a duplex mismatch (see Speed and duplex). In real networks, management usually goes on its own VLAN rather than VLAN 1; the VLANs and trunks lesson shows how.

Checking addresses, descriptions and line security

Example output · based on Cisco documentation; exact format varies by platform and software version
R1#show ip interface brief
Interface              IP-Address      OK? Method Status                Protocol
GigabitEthernet0/0     198.51.100.2    YES manual up                    up
GigabitEthernet0/1     192.168.10.1    YES manual up                    up
GigabitEthernet0/2     192.168.20.1    YES manual up                    up
GigabitEthernet0/3     unassigned      YES unset  administratively down down
manual means the address was typed in this session (after a reload it shows NVRAM). Gi0/3 is down on purpose.
Example output · based on Cisco documentation; exact format varies by platform and software version
R1#show interfaces description
Interface                      Status         Protocol Description
Gi0/0                          up             up       WAN to ISP
Gi0/1                          up             up       LAN to SW1 Gi1/0/24
Gi0/2                          up             up       LAN 192.168.20.0/24
Gi0/3                          admin down     down     Unused
A quick map of what each port is for, straight from your descriptions.
Example output · based on Cisco documentation; exact format varies by platform and software version
SW1#show ip interface brief | include Vlan|1/0/1 |1/0/24
Vlan1                  192.168.10.2    YES manual up                    up
GigabitEthernet1/0/1   unassigned      YES unset  up                    up
GigabitEthernet1/0/24  unassigned      YES unset  up                    up
The SVI is up/up. An SVI only comes up when at least one port in that VLAN is up (and the VLAN exists).
Example output · based on Cisco documentation; exact format varies by platform and software version
SW1#show running-config | include default-gateway|hostname
hostname SW1
ip default-gateway 192.168.10.1
Example output · based on Cisco documentation; exact format varies by platform and software version
R1#show running-config | section line
line con 0
 exec-timeout 10 0
 password 7 08021C401A1609125F3B0D1739
 logging synchronous
 login
line vty 0 4
 exec-timeout 10 0
 login local
 transport input ssh
With service password-encryption on, line passwords show as type 7, a weak reversible encoding. The enable secret and username secret are stored as hashes; the hash type depends on the platform and release. The VTY lines use the local username rather than a shared line password.

Check show ip ssh for SSH version 2, then connect from the admin PC with ssh -l labadmin 192.168.10.1 for R1 orssh -l labadmin 192.168.10.2 for SW1. After a successful login, use enable for privileged EXEC. Save the verified configuration with copy running-config startup-config.

Example output · based on Cisco documentation; exact format varies by platform and software version
SW1#ping 192.168.10.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.1, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/2 ms
A dot means one echo reply was not received before the timeout. Initial ARP resolution can cause this, but the output alone does not identify the cause. Repeat the ping and check for continued loss.

Down interfaces, silent consoles and unreachable switches

Diagram
Down interfaces, silent consoles and unreachable switches
Down interfaces, silent consoles and unreachable switches
SymptomLikely causeFix
Router interface is administratively downNever enabledno shutdown on the interface
SVI Vlan1 is down/downNo port in VLAN 1 is up, or the SVI is shut downConnect a port in the VLAN; no shutdown on the SVI
Switch reachable from its own subnet onlyNo default gatewayip default-gateway 192.168.10.1
Telnet/SSH says Password required, but none setlogin with no password on the VTY linesSet a password, or use login local with a username
Console never asks for a passwordpassword set but login missingAdd login under line console 0
Link errors or poor throughputPossible cabling or speed/duplex issueCheck error counters and both ends. Prefer matching auto-negotiation settings where supported.
Read each row across: the left box names the item, the others describe it.

Small slips in a baseline

  • Using enable password instead of enable secret. If both exist, the secret wins.
  • Configuring VTY 0 4 on a switch and leaving VTY 5 15 open with different settings.
  • Putting ip address on a switch's physical access port. Layer 2 ports don't take addresses; use the SVI.
  • Using ip default-gateway on a router or a Layer 3 switch with ip routing enabled. It is ignored there; those devices use a default route.
  • Choosing a banner delimiter that appears in the message, which ends the banner early.
  • Forgetting to save, then losing the whole baseline at the next reload.

Test yourself on initial setup

Predict · scenario 1

A router has both 'enable password cisco' and 'enable secret class'. Which password does enable accept?

Predict · scenario 2

SW1's SVI is 192.168.10.2/24 and up/up. Hosts in 192.168.10.0/24 can SSH to it, but an admin at 192.168.20.10 can't. What is most likely missing?

Predict · scenario 3

Under line console 0 you typed 'password C0nsole-Pass' but the console still lets anyone in without a prompt. What is missing?

Predict · scenario 4

show ip interface brief on a new router shows Gi0/1 with an IP address but 'administratively down'. What do you do?

Predict · scenario 5

After 'service password-encryption', the VTY password shows as 'password 7 0110...'. How secure is it?

Cisco reference

Configure SSH on routers documents the SSH prerequisites, local authentication and verification commands.