Command Guide
Command Guide
Command Guide
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
Mostafa Abdelrahman
Common show commands include:
• show running-config
• show interfaces
• show ip interface brief
• show arp
• show ip route
• show protocols
• show version
When using windows, use the tracert command.
When performing a trace from a router CLI, use the traceroute command.
On a Windows computer, the IP address of the default gateway can be viewed by using the ipconfig
command.
• The ipconfig /all command can be used to view the MAC address as well as other important
details regarding the Layer 3 addressing of the device.
• The ipconfig /displaydns command displays all of the cached DNS entries on a Windows
computer system.
On a Windows computer, the arp -a command lists all devices currently stored in the ARP cache of a
particular host.
The arp cache can be cleared using the command arp-d
show cdp neighbors detail
• To disable CDP globally, use the global configuration command no cdp run. To disable CDP on
an interface, use the interface command no cdp enable.
Use the show ip route command to verify that the default route has been set.
Mostafa Abdelrahman
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.
Mostafa Abdelrahman
Removes VLAN 5 from the VLAN Switch(config)#no vlan 5
database.
Inter-VLAN Communication Using an External Router: Router-on-a-Stick
Router(config)#interface gigabitethernet 0/0
Moves to interface configuration mode. Router(config-if)#no shutdown
Enables the interface. Router(config-if)#exit
Mostafa Abdelrahman
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
Mostafa Abdelrahman
Dynamic Trunking Protocol (DTP)
Trunk negotiation is managed by the Dynamic Trunking Protocol (DTP). DTP is a Cisco proprietary
protocol
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
Mostafa Abdelrahman
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.)
Mostafa Abdelrahman
EtherChannel with LACP and configures
Places the interface into an S1(config)#interface range fastethernet 0/1 – 2
active negotiating state— S1 (config-if)#channel-group 1 mode Active
will send LACP packets to S1 (config-if)#exit
start negotiations.
S1(config)#interface port-channel 1
Configure Port Channel S1(config-if)# Switchport mode Trunk
S1(config-if)# switchport trunk native vlan 999
S1(config-if)# switchport trunk allowed vlan 1,10,20
S1 (config-if)#exit
Places the interface into a S1(config)#interface range fastethernet 0/1 – 2
passive negotiating state— S1 (config-if)#channel-group 1 mode passive
will respond to LACP S1 (config-if)#exit
packets but will not initiate
S1(config)#interface port-channel 1
LACP negotiation. S1(config-if)# Switchport mode Trunk
Configure Port Channel S1(config-if)# switchport trunk native vlan 999
S1(config-if)# switchport trunk allowed vlan 1,10,20
S1 (config-if)#exit
EtherChannel with PAgP and configures
Places the interface into an S1(config)#interface range fastethernet 0/1 – 2
active negotiating state— S1 (config-if)#channel-group 1 mode Desirable
will send PAgP packets to S1 (config-if)#exit
start negotiations.
S1(config)#interface port-channel 1
Configure Port Channel S1(config-if)# Switchport mode Trunk
S1(config-if)# switchport trunk native vlan 999
S1(config-if)# switchport trunk allowed vlan 1,10,20
Places the interface into a S1(config)#interface range fastethernet 0/1 – 2
passive negotiating state— S1 (config-if)#channel-group 1 mode Auto
will respond to PAgP S1 (config-if)#exit
packets but will not initiate
S1(config)#interface port-channel 1
PAgP negotiation. S1(config-if)# Switchport mode Trunk
Configure Port Channel S1(config-if)# switchport trunk native vlan 999
S1(config-if)# switchport trunk allowed vlan 1,10,20
Mostafa Abdelrahman
Verifying EtherChannel
Displays all EtherChannel Switch#show etherchannel
information
Displays port channel information Switch#show etherchannel 1 portchannel
Mostafa Abdelrahman
Switch Port Security
VLAN
Mostafa Abdelrahman
Mitigate DHCP Attacks
DHCP Snooping Configuration Example
Mostafa Abdelrahman
Mitigate ARP Attacks
Dynamic ARP Inspection
• DHCP snooping is enabled because
DAI requires the DHCP snooping
binding table to operate.
• Next, DHCP snooping and ARP
inspection are enabled for the PCs on
VLAN10.
• The uplink port to the router is trusted,
and therefore, is configured as trusted
for DHCP snooping and ARP inspection.
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.
Mostafa Abdelrahman
Setting the System Clock
Typically, the date and time settings on a router or switch can be set using one of two methods:
Mostafa Abdelrahman
VTP, Extended VLANs, and DTP
1. VLAN Trunking Protocol (VTP):
Reduces administration in a switched network. A switch in VTP server mode can manage
additions, deletions and renaming of VLANs across the domain.
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.)
BPDU Guard
Enters interface range configuration Switch(config)#interface range fastethernet 0/1 – 5
mode.
Mostafa Abdelrahman
Enables BPDU Guard on the Switch(config-if)#spanning-tree bpduguard enable
interface.
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
Mostafa Abdelrahman
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)
Mostafa Abdelrahman
Static Route
There are two common types of static routes in the routing table:
Mostafa Abdelrahman
Send all packets destined for networks not in
my routing table out my exit Interface serial Router(config)# ip route 0.0.0.0 0.0.0.0 serial 0/0/0
0/0 interface.
Floating Static Route
Mostafa Abdelrahman