CCNA Switch & Router Configuration Cmds
CCNA Switch & Router Configuration Cmds
Password Encryption
Router(config)#line con 0
Set a console password to cisco Router(config-line)#login
Router(config-line)#password cisco
Router(config)#line vty 0 15
Set a telnet password Router(config-line)#login
Router(config-line)#password cisco
Set the enable password to cisco Router(config)#enable password cisco
Set the enable secret password.
This password overrides the enable password Router(config)#enable secret class
and is encrypted within the config file
Configuring a Gigabit Ethernet Interface with IPv4
Moves to gigabitethernet 0/0 interface
Router(config)#interface gigabitethernet 0/0
configuration mode
Optional descriptor of the link is locally
Router(config-if)#description Accounting LAN
significant
Router(config-if)#ip address 192.168.20.1
Assigns address and subnet mask to interface
255.255.255.0
Turns interface on Router(config-if)#no shutdown
The ip arp inspection validate {[src-mac] [dst-mac] [ip]} global configuration command is used to
configure DAI to drop ARP packets when the IP addresses are invalid.
• It can be used when the MAC addresses in the body of the ARP packets do not match the
addresses that are specified in the Ethernet header.
• Notice in the following example how only one command can be configured.
Therefore, entering multiple ip arp inspection validate commands overwrites the previous
command.
• To include more than one validation method, enter them on the same command line as
shown in the output.
VLAN
Creating Static VLANs
Switch(config)#vlan 3
• Creating Static VLANs
Switch(config-vlan)#name Engineering
Switch(config-vlan)#exit
Assigning Ports as access to VLANs
Switch(config)#interface fastethernet 0/1
• Assigning Ports to VLANs Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10
Switch(config)#interface range fastethernet 0/1 – 9
• Using the range Command Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 10
VLAN Trunking Protocol
Switch(config)#interface fastethernet 0/1
Puts the interface into permanent trunking Switch(config-if)#switchport mode trunk
mode and negotiates to convert the link into
a trunk link. Switch(config-if)#switchport trunk native VLAN 99
Switch(config-if)#switchport trunk allowed VLAN 10,20,30,99
Verifying VLAN Information and Erasing VLAN
Verifying VLAN Information
Displays VLAN information
Switch#show vlan
Displays VLAN information in brief
Displays information about VLAN 2 Switch#show vlan brief
only
Switch#show vlan id 2
Displays information about VLAN
named marketing only Switch#show vlan name marketing
Displays interface characteristics for
Switch#show interfaces vlan x
the specified VLAN
Displays VLAN information for all Switch#show interfaces switchport
interfaces
Erasing VLAN Configurations
Switch#delete flash:vlan.dat
Removes the entire VLAN database from
flash.
Moves to interface configuration mode. Switch(config)#interface fastethernet 0/5
Removes port from VLAN 5 and reassigns Switch(config-if)#no switchport access vlan 5
it to VLAN 1—the default VLAN.
Typically, the date and time settings on a router or switch can be set using one of two methods:
VTP Configuration
1. Configure the VTP Server. S1(config)# vtp mode server
2. Configure the VTP Domain Name and Password. S1(config)# vtp domain CCNA
S1(config)# vtp password cisco
S2(config)# vtp mode client
3. Configure the VTP Clients. S2(config)# vtp domain CCNA
S2(config)# vtp password cisco
4. Configure VLANs on the VTP Server. S1(config)# vlan 10
S1(config-vlan)# name Red
5. Verify the VTP Clients have received the new S2# show vtp status
VLAN information. S2# show vtp password
2. Extended VLANs
Extended range VLANs are identified by a VLAN ID between 1006 and 4094.
To configure an extended VLAN on a 2960 switch it must be set to VTP transparent mode. (By
default 2960 switches do not support Extended range VLANs.)
DTP Configuration
Switchport mode access - interface becomes
a nontrunk interface. S1(config)# Switchport mode access
Switchport mode dynamic auto - interface
becomes a trunk if the neighboring interface S1(config)# Switchport mode dynamic auto
is set to trunk or desirable mode.
Switchport mode dynamic desirable -
interface becomes a trunk if the neighboring
interface is set to trunk, desirable, or S1(config)# Switchport mode dynamic desirable
dynamic auto mode.
Switchport mode trunk - interface becomes
a trunk even if the neighboring interface is S1(config)# Switchport mode trunk
not a trunk interface.
Switchport nonegotiate - prevents the
interface from generating DTP frames. S1(config)# Switchport nonegotiate
Use show dtp interface to verify DTP.
S1# show dtp interface
Layer 3 Switching
Multilayer switches provide high-packet processing rates using hardware-based switching
Catalyst multilayer switches support the following types of Layer 3 interfaces:
• Routed port - A layer 3 interface
• Switch virtual interface (SVI) - Virtual Interface for inter- VLAN routing
STP
Spanning Tree Protocol (STP) is a Layer 2 protocol that helps especially when there are redundant links.
BPDU Guard
Enters interface range configuration Switch(config)#interface range fastethernet 0/1 – 5
mode.
STP
Verifying STP
Displays STP information Switch#show spanning-tree
CAUTION Cisco recommends caution when using this command. Cisco further
recommends that the spanning-tree vlan x root primary or the spanning-tree vlan x root
secondary command be used instead to modify the switch priority.
Edge Ports
EtherChannel
EtherChannel:
EtherChannel groups multiple physical ports into one or more logical EtherChannel
links.
• Step 2: Create the port channel interface with the channel-group command in active mode. (Channel
group number needs to be selected.)
Verifying EtherChannel
Displays all EtherChannel Switch#show etherchannel
information
Displays port channel information Switch#show etherchannel 1 portchannel
HSRP
First Hop Redundancy Protocols
To prevent a single point of failure at the default gateway, implement a virtual router.
First Hop Redundancy Protocols:
Hot Standby Router Protocol (HSRP)
Virtual Router Redundancy Protocol (VRRP)
Gateway Load Balancing Protocol (GLBP)
Static Route
There are two common types of static routes in the routing table:
Dynamic Routing
Open Shortest Path First (OSPF)
1. Single-Area OSPF
Timers
Changes the Hello Interval timer to 20
seconds.
Changes the Dead Interval timer to 80 Router(config)# interface S0/0/0
seconds. Router(config-if)#ip ospf hello-interval timer 20
NOTE Hello and Dead Interval timers must Router(config-if)#ip ospf dead-interval 80
match for routers to become neighbors.
Multi-Area OSPF
• Link Layer Discovery Protocol (LLDP) is a vendor-neutral neighbor discovery protocol similar to CDP.
With LLDP enabled, device neighbors can be S1# show lldp neighbors
discovered S1# show lldp neighbors detail
• Use the show access-list command to review the ACL in the configuration.
• Use the show ip interface command to verify the ACL is applied to the interface.
Named ACLs can also use sequence numbers to delete and add ACEs. In the example an ACE is added to deny
hosts 192.168.10.11.
Configuring the port number is required when there is not a specific protocol name listed such as SSH
(port number 22) or an HTTPS (port number 443), as shown in the next example.
For example:
ACL 103 allows requests to port 80 and 443.
ACL 104 allows established HTTP and
HTTPS replies.
The established parameter allows only
responses to traffic that originates from the
192.168.10.0/24 network to return to that
network.
o The show ip interface command is used to verify the ACL on the interface and the direction in which
it was applied.
o The show access-lists command can be used to confirm that the ACLs work as expected. The
command displays statistic counters that increase whenever an ACE is matched.
Note: Traffic must be generated to verify the operation of the ACL.
Private Addresses
Class RFC 1918 Internal Address Range CIDR Prefix
A 10.0.0.0–10.255.255.255 10.0.0.0/8
B 172.16.0.0–172.31.255.255 172.16.0.0/12
C 192.168.0.0–192.168.255.255 192.168.0.0/16
1. Static NAT
Static address translation (static NAT) assigns one public IP address to one private IP
address
2. Dynamic NAT –
Dynamic NAT assigns a public IP address from a pool of addresses to each packet that
originates from a device that has a private IP address assigned when that packet is
destined to a network outside the company.
OR