Cisco Commands

Router
Initial configuration

Hostname Router# configure terminal Router(Config)# hostname [Host name]

Passwords  Router(Config)#enable password [Password] Router(Config)#enable secret [Password ]

Line vty 0-4  Router(Config)#line vty 0 Router(Config-if)#password [Password] Router(Config-if)#Login Router(Config-if)#exit

Line console 0-4 Router(Config)#line console 0 Router(Config-if)#password [Password] Router(Config-if)#login Router(Config-if)#exit

Password encryption Router(Config)#service password-encryption

( Router#copy run start )

Interface Configuration:

Interfaces: Fastethernet Router(Config)# interface fastethernet 0/0 Router(Config-if)#description [Description line] Router(Config-if)#ip address [Ip address ] [Subnemask] Router(Config-if)#no shutdown

Serial Router(Config)#interface serial 0/0/0 Router(Config-if)#description [Description line] Router(Config-if)#ip address [Ip address] [Subnetmask] Router(Config-if)#no shutdown

Clock rate Router(Config)#interface serial 0/0/0 Router(Config-if)#clock rate ? Router(Config-if)#clock rate [ clock rate speed ]

Encapsulation PPP Router(Config)#interface serial 0/0/0 Router(Config-if)#encapsulation ppp

( Router#copy run start )

Router configuration options

Ip Route: Default Router(Config)#interface serial 0/0/0 Router(Configure-if)#ip route 0.0.0.0 0.0.0.0 [ip address ]

Static Router(Config)#interface serial 0/0/0 Router(Config-if)#ip route [ip address ] [Subnetmask ] [ip address]

RIP Router(Config)# router rip Router(Config-router)#version 2 Router(Config-router)#network [networknumber ]

NAT: inside Router(config)#interface fastethernet 0/0 Router(config-if)#ip address [ip address] [subnetmask] Router(config-if)#ip nat inside Router(config-if)#no shutdown

outside Router(config)#interface fastethernet 0/0 Router(config-if)#ip address [ip address] [subnetmask] Router(config-if)#ip nat outside Router(config-if)#no shutdown

Router(config)#ip nat inside source static [ip address] [ip address]
 * comment: inside Ip address is translated to external ip address *

DHCP: Router(config)# Router(config)# ip dhcp pool [poolname] Router(dhcp-config)# network [network ] [subnetmask] Router(config)#ip dhcp excluded-address [ip address] ( OR [ip address ] [ip address]) Router(dhcp-config)#default-router [ip address] { Router(dhcp-config)#domain-name [domain name] Router(dhcp-config)#dns-server [ip address] Router(dhcp-config)#lease {days [hours] [minutes] infinite} }
 * comment: between ip address and ip address*

(Router#copy run start )

Other Router Commands

Basic Router commands

Showing credentials Router#show run OR Router(config)#do show run

Router#show ip nat translations OR Router(config)#do show ip nat translations translations that have been configured and any dynamic translations that have been created by traffic*
 * The output displays the detailed NAT assignments. The command shows all static

Router#show ip nat statistics OR Router(config)#do show ip nat statistics translations, NAT configuration parameters, how many addresses are in the pool, and how many have been allocated.*
 * The show ip nat statistics command displays information about the total number of active

Saving/Restoring Router#copy run start restored configuration is saved*
 * copy the running-configuration to the startup-configuration file to ensure that the

Router#copy startup-config tftp OR Router#copy running-config tftp accessible to the router via a network connection.*
 * files can be saved to a network server is using TFTP. The TFTP server must be

Banner Router(config)#banner motd c[Your line here]c
 * cUnautorized Access Prohibitedc* example

Ping Router#ping [ip address] Router(config)#ping [ip address] Router#ping [hostname or websitename] Router(config)# ping [hostname or websitename] Router(config)#traceroute ip [ip address]

CMD PC>Tracert [ip address or name ]

Switch
Switch configuration

Initial configuration:

Hostname Switch#config terminal Switch(config)#hostname [hostname]

Passwords Switch(config)#enable password [password Switch(config)#enable secret [password]

Line vty 0-4 Switch(config)#line vty 0 Switch(config-if)#password [password] Switch(config-if)#login Switch(config-if)#exit

Line console 0-4 Switch(config)#line console 0 Switch(config-if)#password [password] Switch(config-if)#login Switch(config-if)#exit

Password encryption Switch(config)# service password-encryption

( Switch#copy run start ) Interface configuration

Vlan1 Switch(config)#interface vlan1 Switch(config-if)#ip address [ip address] [subnetmask] Switch(config-if)#no shutdown Switch(config-if)#exit

Default gateway Switch(config)#ip default-gateway [ip address]

Security Static Switch(config)#interface fastethernet 0/0 Switch(config-if)#switchport mode access Switch(config-if)#switchport port-security Switch(config-if)#switchport mac-address [Mac address] Switch(config-if)#exit

Dynamic Switch(Config)#interface fastethernet 0/0 Switch(Config-if)#port mode access Switch(Config-if)#swtichport port –security Switch(Configure-if)#exit

Sticky Switch(Configure)#interface fastethernet 0/0 Switch(Config-if)#switchport mode access Switch(Config-if)#switchport port-security Switch(Config-if)#switchport port-security maximum 50 Switch(Config-if)#switchport port-security mac-address sticky Switch(Config-if)#exit

(Switch# copy run start ) Other Switch Commands

Show credentials Switch#show run Switch#show port-security interface Switch#show port-security Switch#show port-security address

Switch#show cdp neighbors Switch#show cdp neighbors detail

Removing security credentials from a interface Switch(config)#interface fastethernet 0/0 Switch(config-if)#clear port-security sticky interface [port number]

Switch(config)#interface fastethernet 0/0 Switch(config-if)# no switchport port-security

Reset mac security Switch(config)#interface fastethernet 0/0 Switch(config-if)#clear port-security

Switch(config-)#interface fastethernet 0/0 Switch(config-if)#Clear port-security interface fa 0/0 access

Activate or Deactivate a switchport Switch(config)interface fastethernet 0/0 Switch(config-if)#no shutdown

Switch(config)interface fastethernet 0/0 Switch(config-if)#shutdown

Saving Switch#copy run start Switch#copy start tftp