Packet Tracer Commands - CCNA
Packet Tracer Commands - CCNA
Step 3 Router(config-if)#ip address 192.168.10.1 255.255.255.0 Assigns address and subnet mask to interface
Step 4 Router(config-if)#clock rate 56000 Assigns a clock rate for the interface
Step 5 Router(config-if)#no shutdown Turns interface on
TIP: The clock rate command is used only on a serial interface that has a DCE cable plugged into it. There must be a clock rate set on every serial link
between routers.
Configuring Passwords
Steps Command Purpose
Step 1 Router(config)#enable password cisco Sets enable password
Step 2 Router(config)#enable secret class Sets enable secret password
Router(config)#line console 0 Enters console line mode
Step 3 Router(config-line)#password console Sets console line mode password to console
Router(config-line)#login Enables password checking at login
Router(config)#line vty 0 4 Enters vty line mode for all five vty lines
Step 4 Router(config-line)#password telnet Sets vty password to telnet
Router(config-line)#login Enables password checking at login
Router(config)#line aux 0 Enters auxiliary line mode
Step 5 Router(config-line)#password auxpassword Sets auxiliary line mode password to auxpassword
Router(config-line)#login Enables password checking at login
CAUTION: The enable secret password is encrypted by default. The enable password is not. For this reason, recommended practice is that you never
use the enable password command. Use only the enable secret password command in a router or switch configuration.
You cannot set both enable secret password and enable password to the same password. Doing so defeats the use of encryption.
Password Encryption
Steps Command Purpose
Step 1 Router(config)#service password-encryption Applies a weak encryption to passwords
Step 2 Router(config)#enable password cisco Sets enable password to cisco
Step 3 ter(config)#line console 0 Moves to console line mode
Step 4 Router(config-line)#password Cisco Continue setting passwords as above
Step 5 Router(config)#no service passwordencryption Turns off password encryption
Creating a Message-of-the-Day Banner
Steps Command Purpose
Router(config)#banner motd # Building Power
will be interrupted next Tuesday evening from # is known as a delimiting character. The delimiting character must surround the banner message and
Step 1
8 – 10 PM. # can be any character so long as it is not a character used within the body of the message.
Router(config)#
TIP: The MOTD banner is displayed on all terminals and is useful for sending messages that affect all users. Use the no banner motd command to disable the
MOTD banner. The MOTD banner displays before the login prompt and the login banner, if one has been created.
Show Commands
Steps Command Purpose
Step 1 Router#show ? Lists all show commands available.
Step 2 Router#show running-config Displays the configuration currently running in RAM.
Step 3 Router#show startup-config Displays the configuration saved in NVRAM.
Step 4 Router#show interfaces Displays statistics for all interfaces.
Step 5 Router#show interface serial 0/0/0 Displays statistics for a specific interface (in this case, serial 0/0/0).
Step 6 Router#show ip interface brief Displays a summary of all interfaces, including status and IP address assigned.
Displays statistics for interface hardware. Statistics display if the clock rate is set and if the cable is
Step 7 Router#show controllers serial 0/0/0
DCE, DTE, or not attached.
Step 8 Router#show clock Displays time set on device.
Displays local host-to-IP address cache. These are the names and addresses of hosts on the network
Step 9 Router#show hosts
to which you can connect.
Step 10 Router#show users Displays all users connected to device.
Step 11 Router#show history Displays the history of commands used at this edit level.
Step 12 Router#show flash Displays info about flash memory.
Step 13 Router#show version Displays info about loaded softwareversion.
Step 14 Router#show arp Displays the Address Resolution Protocol (ARP) table.
Step 15 Router#show protocols Displays info about loaded softwareversion.
Configuring a Switch
Help Commands
Steps Command Purpose
Step 1 switch>? The ? works here the same asin a router.
Command Modes
Steps Command Purpose
Step 1 switch>enable User mode, same as a router
Step 2 switch# Privileged mode
Step 3 switch#disable Leaves privileged mode
Step 4 switch>exit Leaves user mode
Verifying Commands
Steps Command Purpose
Step 1 switch#show version Displays information aboutsoftware and hardware.
Step 2 switch#show flash: Displays information aboutflash memory (for the 2900/2950 series only).
Step 3 switch#show mac-address-table Displays the current MACaddress forwarding table.
Step 4 switch#show running-config Displays the currentconfiguration in DRAM.
Step 5 switch#show startup-config Displays the currentconfiguration in NVRAM.
Step 6 switch#show post Displays whether the switchpassed POST.
Step 7 switch#show vlan Displays the current VLANconfiguration.
Step 8 switch#show interfaces Displays the interfaceconfiguration and status ofline: up/up, up/down, admindown.
Step 9 switch#show interface vlan1 Displays setting of virtualinterface VLAN 1, thedefault VLAN on the switch.
Resetting Switch Configuration
Steps Command Purpose
Step 1 Switch#delete flash:vlan.dat Removes the VLAN databasefrom flash memory.
Step 2 Delete filename [vlan.dat]? Press®.Enter
Step 3 Delete flash:vlan.dat? [confirm] Press®.Enter
Step 4 Switch#erase startup-config Erases the file from NVRAM.
Step 5 Switch#reload Restarts the switch.
Setting Host Names
Steps Command Purpose
Step 1 Switch#configure terminal Moves to global configurationmode.
Step 2 Switch(config)#hostname S1_PSU Privileged mode
Step 3 S1_PSU(config)#
Setting Passwords
Steps Command Purpose
Step 1 S1_PSU(config)#enable password cisco Sets the enable password tocisco
Step 2 S1_PSU(config)#enable secret class Sets the encrypted secretpassword to class
Step 3 S1_PSU(config)#line console 0 Enters line console mode
Step 4 S1_PSU(config-line)#login Enables password checking
Step 5 S1_PSU(config-line)#password cisco Sets the password to cisco
Step 6 S1_PSU(config-line)#exit Exits line console mode
Step 7 S1_PSU(config-line)#line aux 0 Enters line auxiliary mode
Step 8 S1_PSU(config-line)#login Enables password checking
Step 9 S1_PSU(config-line)#password cisco Sets the password to cisco
Step 10 S1_PSU(config-line)#exit Exits line auxiliary mode
Step 11 S1_PSU(config-line)#line vty 0 4 Enters line vty mode for allfive virtual ports
Step 12 S1_PSU(config-line)#login Enables password checking
Step 13 60Switch(config-line)#password cisco Sets the password to cisco
Step 14 S1_PSU(config-line)#exit Exits line vty mode
Step 15 S1_PSU(config)#
Setting IP Addresses and Default Gateways
Steps Command Purpose
Step 1 S1_PSU(config)#interface vlan1 Enters the virtual interfacefor VLAN 1, the defaultVLAN on the switch
Step 2 S1_PSU(config-if)#ip address 172.16.10.2 255.255.255.0 Sets the IP address andnetmask to allow for remoteaccess to the switch
Step 3 S1_PSU(config-if)#exit
Step 4 S1_PSU(config)#ip default-gateway 172.16.10.1 Allows IP information anexit past the local network
Note : For the S1_PSU series switches, the IP address of the switch is just that—the IP address for the entire switch. That is why you set the address in VLAN 1 (the
default VLAN of the switch) and not in a specific Ethernet interface.
Step 8 NOTE: In shutdown mode, the port is errdisabled, a log entry is made, and manua intervention or errdisable recovery must be used to reenable the interface.
Step 9 Switch(config-if)#switchport port-security violation restrict Configures port security torestrict mode if a securityviolation occurs.
Step 10 NOTE: In restrict mode, frames from a nonallowed address are dropped, and a log entry is made. The interface remains operational.
Step 11 Switch(config-if)#switchport port-security violation protect Configures port security to protect mode if a security violation occurs.
Step 12 NOTE: In protect mode, frames from a nonallowed address are dropped, but no log entry is made. The interface remains operational.
Configuring a VLANs
Using VLAN Configuration Mode
Steps Command Purpose
Step 1 Switch(config)#vlan 10 Creates VLAN 10 and enters VLAN configuration mode for further definitions.
Step 2 Switch(config-vlan)#name Engineering Assigns a name to the VLAN. The length of the name can be from 1 to 32 characters.
Step 3 Switch(config)#vlan 30 Creates VLAN 30 and enters VLAN configuration mode for further definitions.
Step 4 Switch(config-vlan)#name HR Assigns a name to the VLAN. The length of the name can be from 1 to 32 characters.
Step 5 Switch(config-vlan)#exit Applies changes, increases the revision number by 1, and returns to global configuration mode.
Assigning Ports to VLANs
Steps Command Purpose
Step 1 Switch(config)#interface fastethernet 0/1 Moves to interface configuration mode
Step 2 Switch(config-if)#switchport mode acce Sets the port to access mode
Step 3 Switch(config-if)#switchport access vlan 10 Assigns this port to VLAN 10
Using the range Command
Steps Command Purpose
Step 1 Switch(config)#interface range fastethernet 0/1 - 9 Enables you to set the same configuration parameters on multiple ports at the same time.
Step 2 NOTE: There is a space before and after the hyphen in the interface range command.
Step 3 Switch(config-if-range)#switchport mode access Sets ports 1–9 as access ports.
Step 4 Switch(config-if-range)#switchport access vlan 10 Assigns ports 1–9 to VLAN 10.
Verifying VLAN Information
Steps Command Purpose
Step 1 Switch#show vlan Displays VLAN information
Step 2 Switch#show vlan brief Displays VLAN information in brief
Step 3 Switch#show vlan id 2 Displays information about VLAN 2 only
Step 4 Switch#show vlan name marketing Displays information about VLAN named marketing only
Step 5 Switch#show interfaces vlan x Displays interface characteristics for the specified VLAN
Loopback Interfaces
Steps Command Purpose
Creates a virtual interface named loopback 0, and then moves the router to interface configuration
Step 1 Router(config)#interface loopback 0
mode.
Step 2 Router(config-if)#ip address 192.168.100.1 255.255.255.255 Assigns the IP address to the interface.
NOTE: Loopback interfaces are always “up and up” and do not go down unless manually shut down. This makes loopback interfaces great for use as OSPF
Step 3
router IDs.
Router ID
Steps Command Purpose
Step 1 Router(config)#router ospf 1 Starts OSPF process 1.
Sets the router ID to 10.1.1.1. If this command is used on an OSPF router process that is already
Step 2 RoRouter(config-router)#router-id 10.1.1.1 active (has neighbors), the new router ID is used at the next reload or at a manual OSPF process
restart.
Removes the static router ID from the configuration. If this command is used on an OSPF router
Step 3 Router(config-router)#no router-id 10.1.1.1 process that is already active (has neighbors), the old router ID behavior is used at the next
reload or at a manual OSPF process restart.
DR/BDR Elections
Steps Command Purpose
Step 1 Router(config)#interface serial 0/0 Changes the router to interface configuration mode.
Step 2 Router(config-if)#ip ospf priority 50 Changes the OSPF interface priority to 50.
NOTE: The assigned priority can be between 0 and 255. A priority of 0 makes the router ineligible to become a designated router (DR) or backup designated router
Step 3 BDR). The highest priority wins the election. A priority of 255 guarantees a tie in the election. If all routers have the same priority, regardless of the priority
number, they tie. Ties are broken by the highest router ID.
Modifying Cost Metrics
Steps Command Purpose
Step 1 Router(config)#interface serial 0/0 Changes the router to interface configuration mode.
Step 2 Router(config-if)#bandwidth 128 If you change the bandwidth, OSPF recalculates the cost of the link.
Step 3 or
Step 4 Router(config-if)#ip ospf cost 1564 Changes the cost to a value of 1564.
NOTE: The cost of a link is determined by dividing the reference bandwidth by the interface bandwidth. The bandwidth of the interface is a
Step 5 number between 1 and 10,000,000. The unit of measurement is kilobits. The cost is a number between 1 and 65,535. The cost has no unit of measurement—it is
just a number.
Timers
Steps Command Purpose
Step 1 Router(config-if)#ip ospf hello interval timer 20 Changes the Hello Interval timer to 20 seconds.
Step 2 Router(config-if)#ip ospf deadinterval 80 Changes the Dead Interval timer to 80 seconds.
Step 3 NOTE: Hello and Dead Interval timers must match for routers to become neighbors.
Step 4 TIP: Apply a standard ACL as close as possible to the destination network or device.
Verifying ACLs
Steps Command Purpose
Step 1 Router#show ip interface Displays any ACLs applied to that interface
Step 2 Router#show access-lists Displays the contents of all ACLs on the router
Step 3 Router#show access-list access-list-number Displays the contents of the ACL by the number specified
Step 4 Router#show access-list name Displays the contents of the ACL by the name specified
Displays all ACLs and
Step 5 Router#show run
interface assignments
Removing ACLs
Steps Command Purpose
Step 1 Router(config)#no access-list 10 Removes all ACLs numbered 10
Creating Extended ACLs
Steps Command Purpose
Router(config)#access-list 110 permit tcp Read this line to say, “HTTP packets with a source IP address of 172.16.0.x will be permitted to travel
Step 1
172.16.0.0 0.0.0.255 192.168.100.0 0.0.0.255 eq 80 to the destination address 192.168.100.x.”
Step 2 access-list ACL command.
Step 3 110 Number is between 100 and 199, or 2000 and 2699, designating this as an extended IP ACL.
Step 4 permit Packets that match this statement will be allowed to continue.
Step 5 tcp Protocol must be TCP.
Step 6 172.16.0.0 Source IP address to be compared to.
Step 7 0.0.0.255 Wildcard mask for the source IP address.
Step 8 192.168.100.0 Destination IP address to be compared to.
Step 9 0.0.0.255 Wildcard mask for the destination IP address..
Step 10 eq Operand, means “equal to.”
Step 11 80 Port 80, indicating HTTP traffic.
Router(config)#access-list 110 deny tcp any Read this line to say, “Telnet packets with any source IP address will be dropped if they are addressed
Step 12
192.168.100.7 0.0.0.0 eq 23 to specific host 192.168.100.7.”
Step 13 access-list ACL command.
Step 14 110 Number is between 100 and 199, or 2000 and 2699, designating this as an extended IP ACL.
Step 15 tcp Protocol must be TCP.
Step 16 any Any source IP address.
Step 17 192.168.100.7 Destination IP address to be compared to.
Step 18 0.0.0.0 Wildcard mask; address must match exactly.
Step 19 eq Operand, means “equal to.”
Port 23, indicating Telnet
Step 20 23
traffic.
Applying Extended ACLs to an Interface
Steps Command Purpose
Step 1 Router(config)#interface fastethernet 0/0 Moves to interface configuration mode and takes all access list lines that are defined as being
part of group 110 and applies them in an outbound manner. Packets going out fastethernet 0/0
Step 2 Router(config-if)#ip access-group 110 out will be checked.
TIP: Access lists can be applied in either an inbound direction (keyword in) or in an outbound direction (keyword out).
TIP: Only one access list can be applied per interface, per direction.
TIP: Apply an extended ACL as close as possible to the source network or device.
TIP: Sequence numbers are used to allow for easier editing of your ACLs. The preceding example used numbers 10, 20, and 30 in the ACL lines. If you had
Step 12 needed to add another line to this ACL, it would have previously been added after the last line—line 30. If you had needed a line to go closer to the top, you would
have had to remove the entire ACL and then reapply it with the lines in the correct order. Now you can enter in a new line with a sequence number, placing it in the
correct location.
Step 13 NOTE: The sequence-number argument was added in Cisco IOS Software Release 12.2(14)S. It was integrated into Cisco IOS Software Release 12.2(15)T.
Step 3 The implicit deny statement restricts anyone else from being permitted to Telnet.
Step 4 Router(config)#line vty 0 4 Moves to vty line configuration mode.
Step 5 Router(config-line)access-class 2 in Applies this ACL to all 5 vty virtual interfaces in an inbound direction.
TIP: When restricting access through Telnet, use the access-class command rather than the access-group command, which is used when applying an ACL to a
Step 6
physical interface.
Block HTTP and HTTPS access from PC1 to Server1 and Server2. The servers are inside the cloud and you only know their IP
addresses.
Block FTP access from PC2 to Server1 and Server2.
Block ICMP access from PC3 to Server1 and Server2.
Step 1 Deny PC1 to access HTTP and HTTPS services on Server1 and Server2.
ip access-list extended ACL What is the command to begin the named ACL?
deny tcp host 172.31.1.101 host 64.101.255.254 eq 80 Record the statement that denies access from PC1 to Server1, only for HTTP (port 80).
deny tcp host 172.31.1.101 host 64.101.255.254 eq 443 Record the statement that denies access from PC1 to Server1, only for HTTPS (port 443).
deny tcp host 172.31.1.101 host 64.103.255.254 eq 80 Record the statement that denies access from PC1 to Server2, only for HTTP.
deny tcp host 172.31.1.101 host 64.103.255.254 eq 443 Record the statement that denies access from PC1 to Server2, only for HTTPS.
Step 2 Deny PC1 to access HTTP and HTTPS services on Server1 and Server2.
deny tcp host 172.31.1.102 host 64.101.255.254 eq 21 Record the statement that denies access from PC2 to Server1, only for FTP (port 21 only).
deny tcp host 172.31.1.102 host 64.103.255.254 eq 21 Record the statement that denies access from PC2 to Server2, only for FTP (port 21 only).
Step 3 Deny PC3 to ping Server1 and Server2.
Record the statement that denies ICMP access from PC3 to
deny icmp host 172.31.1.103 host 64.101.255.254
Server1.
Record the statement that denies ICMP access from PC3 to
deny icmp host 172.31.1.103 host 64.103.255.254
Server2.
Step 4 Permit all other IP traffic.
By default, an access list denies all traffic that does not match any rule in the list. What
permit ip any any
command permits all other traffic?
Apply and Verify the Extended ACL
Steps Command Purpose
Step 1 Apply the ACL to the correct interface and in the correct direction.
interface g0/0 What are the commands you need to apply the ACL to the correct interface and in the correct direction?
ip access-group ACL in
Step 2 Test access for each PC.
a Access the websites of Server1 and Server2 using the Web Browser of PC1 and using both HTTP and HTTPS protocols.
b Access FTP of Server1 and Server2 using PC1. The username and password is “cisco”.
c Ping Server1 and Server2 from PC1.
d Repeat Step 2a to Step 2c with PC2 and PC3 to verify proper access list operation.
Configuring DHCP
Steps Command Purpose
Router(config)#ip dhcp excludedaddress Specifies the range of addresses not to
Step 1
172.16.10.1 172.16.10.9 be leased out to clients.
Step 2 Router(config)#ip dhcp pool DHCP_PSU Creates a DHCP pool called DHCP_PSU
Defines the address of the default router
Step 3 Router(dhcp-config)#defaultrouter 172.16.10.1
for the client.
Defines the address of the Domain
Step 4 Router(dhcp-config)#dns-server 172.16.10.10 Name System (DNS) server for the
client
Step 5 Router(dhcp-config)#domain-name psu.com Defines the domain name for the client.
Turns the DHCP service off. DHCP
Step 6 Router(config)#no service dhcp service is on by default in Cisco IOS
Software.
Step 7 Router#show ip dhcp binding Displays a list of all bindings created
Step 8 Router#show ip dhcp database Displays recent activity on the DHCP database
Step 2 R1(config-if)# ip nat inside You can have more than one inside interface on a router.
Step 3 R1(config)# interface s0/0/0 Moves to interface configuration mode.
Step 4 R1(config-if)# ip nat outside Defines which interface is the outside interface for NAT.
CAUTION: Make sure that you have in your router configurations a way for packets to travel back to your NAT router. Include a static route on the ISP router
advertising your NAT pool and how to travel back to your internal network. Without this in place, a packet can leave your network with a public address, but it will
Step 5
not be able to return if your ISP router does not know where the pool of public addresses exists in the network. You should be advertising the pool of
public addresses, not your private addresses.