Cisco_Commands
Cisco_Commands
Hi. I am Panteleimon Sarantos (You can call me Pantelis) and I made this list of
commands for the Cisco Routers and Switches.
2 License
This work is licensed under the Creative Commons Attribution-NonCommercial-
ShareAlike 4.0 International License. To view a copy of this license, visit
http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative
Commons, PO Box 1866, Mountain View, CA 94042, USA.
3 Table of Contents
1 Intro....................................................................................................................................... 1
2 License...................................................................................................................................1
3 Table of Contents.................................................................................................................1
4 Save Progress.......................................................................................................................3
5 Router.................................................................................................................................... 3
5.1 Security..........................................................................................................................3
5.1.1 Management Security...........................................................................................3
5.1.1.1 Enable CLI Password.....................................................................................3
5.1.1.2 Enable Password after enable – EXEC – Global Configuration.................3
5.1.1.3 Enable Telnet Password................................................................................3
5.1.1.4 SSH..................................................................................................................4
5.1.1.4.1 SSH Configuration.................................................................................4
5.1.1.4.2 More SSH Settings..................................................................................4
5.1.2 Access Lists Security.............................................................................................4
5.1.2.1 Standard ACLs................................................................................................4
5.1.2.1.1 Numbered Standard ACLs....................................................................4
5.1.2.1.2 Named Standard ACLs..........................................................................4
5.1.2.1.3 Modify Named ACLs..............................................................................5
5.1.2.2 Extended ACLs...............................................................................................5
5.1.2.2.1 Numbered Extended ACLs....................................................................5
5.1.2.2.2 Named Extended ACLs..........................................................................5
5.1.2.2.3 Modify Numbered Extended ACLs.......................................................5
5.1.2.2.4 Modify Named Extended ACLs.............................................................6
5.1.2.3 Access Lists Info.............................................................................................6
5.1.2.3.1 More SSH Settings..................................................................................6
5.2 IP..................................................................................................................................... 6
5.2.1 Assign IP to Interface............................................................................................6
5.2.1.1 IPv4..................................................................................................................6
5.2.1.2 IPv6..................................................................................................................6
5.3 Routing...........................................................................................................................6
5.3.1 OSPF........................................................................................................................6
5.3.2 EIGRP......................................................................................................................7
5.3.3 RIPv2.......................................................................................................................7
5.4 InterVLAN Routing........................................................................................................7
5.5 DHCP..............................................................................................................................7
5.6 NAT.................................................................................................................................8
5.6.1 Static NAT...............................................................................................................8
5.6.1.1 Configuration.................................................................................................8
5.6.1.2 Assign NAT to Interfaces...............................................................................8
5.6.2 Dynamic NAT.........................................................................................................8
5.6.2.1 Configuration.................................................................................................8
5.6.3 PAT..........................................................................................................................8
5.6.4 General...................................................................................................................8
5.6.4.1 Verify Configuration......................................................................................8
5.6.4.2 Clear Static NAT.............................................................................................8
5.6.4.3 Clear Dynamic NAT........................................................................................9
5.6.4.4 Remove the public NAT pool........................................................................9
5.6.4.5 Remove the NAT translation from inside source list to outside pool.....9
5.7 General Settings............................................................................................................9
5.7.1 Date and Time Settings........................................................................................9
5.7.2 Prevent unwanted DNS Lookups........................................................................9
6 Switch.....................................................................................................................................9
6.1 Security..........................................................................................................................9
6.1.1 Management Security...........................................................................................9
6.1.1.1 Enable CLI Password.....................................................................................9
6.1.1.2 Enable Encrypted Password after enable – EXEC – Global Configuration
.....................................................................................................................................10
6.1.1.3 Enable Telnet Password.............................................................................10
6.1.1.3.1 SSH.........................................................................................................10
6.1.1.3.1.1 SSH Configuration........................................................................10
6.1.1.3.1.2 More SSH Settings........................................................................10
6.1.2 Port Security........................................................................................................10
6.1.2.1 Close unused physical ports......................................................................10
6.1.2.2 Configure Basic Port Security.....................................................................11
6.2 VLAN.............................................................................................................................11
6.2.1 Create a VLAN......................................................................................................11
6.2.2 Assign Physical Access Ports to VLAN...............................................................11
6.2.3 Set Physical Ports to Trunk................................................................................11
6.2.4 Set Physical Ports to Native Trunking...............................................................11
6.2.5 Assign IP to VLAN................................................................................................11
6.2.6 Verify VLAN..........................................................................................................12
6.3 IP...................................................................................................................................12
6.3.1 Prevent unwanted DNS Lookups......................................................................12
6.3.2 Default Gateway..................................................................................................12
6.4 General Settings.........................................................................................................12
6.4.1 Date and Time Settings......................................................................................12
6.4.2 Log In Banner Message......................................................................................12
4 Save Progress
To save the following commands to the startup-config run:
en
conf t
wr
#or
do wr
5 Router
5.1 Security
en
conf t
interface g0/1
ip access-group 1 out
5.1.2.1.2 Named Standard ACLs
en
conf t
ip access-list standard BRANCH-OFFICE-POLICY
permit host 192.168.30.3
permit 192.168.40.0 0.0.0.255
end
en
conf t
int g0/1
ip access-group BRANCH-OFFICE-POLICY out
5.1.2.1.3 Modify Named ACLs
en
conf t
ip access-list standard BRANCH-OFFICE-POLICY
30 permit 209.165.200.224 0.0.0.31
40 deny any
end
5.1.2.2 Extended ACLs
en
conf t
interface g0/1
ip access-group 100 out
5.1.2.2.2 Named Extended ACLs
en
conf t
ip access-list extended WEB-POLICY
permit tcp 192.168.30.0 0.0.0.255 host 10.1.1.1 eq 80
permit tcp 192.168.30.0 0.0.0.255 209.165.200.224 0.0.0.31 eq 80
en
conf t
interface S0/0/1
ip access-group WEB-POLICY out
5.1.2.2.3 Modify Numbered Extended ACLs
en
conf t
ip access-list extended 100
30 permit ip 192.168.10.0 0.0.0.255 192.168.30.0 0.0.0.255
end
5.1.2.2.4 Modify Named Extended ACLs
en
conf t
ip access-list extended WEB-POLICY
30 permit ip 192.168.30.0 0.0.0.255 192.168.10.0 0.0.0.255
end
5.1.2.3 Access Lists Info
en
show access-lists
5.1.2.3.1 More SSH Settings
en
conf t
ip ssh time-out 75
ip ssh authentication-retries 2
5.2 IP
5.2.1.1 IPv4
En
conf t
int g0/0
ip add 192.168.1.1 255.255.255.0
no shut
5.2.1.2 IPv6
en
conf t
ipv6 unicast-routing
int g0/0
ipv6 add 2001:db8:1:1::1/64
ipv6 add fe80::1 link-local
no shut
5.3 Routing
5.3.1 OSPF
en
conf t
router ospf 1
network 192.168.1.0 0.0.0.255 area 0
network 10.0.0.0 0.0.0.3 area 0
network 10.1.1.0 0.0.0.3 area 0
5.3.2 EIGRP
en
conf t
router eigrp 1
network 200.200.200.0 0.0.0.3
network 100.100.100.0 0.0.0.255
auto-summary
5.3.3 RIPv2
en
conf t
router rip
version 2
network 192.168.10.0
network 192.168.20.0
network 192.168.30.0
no auto-summary
5.5 DHCP
en
conf t
ip dhcp excluded-address 100.100.100.1
ip dhcp pool KATOSTARI
network 100.100.100.0 255.255.255.0
default-router 100.100.100.1
5.6 NAT
5.6.1.1 Configuration
en
conf t
ip nat inside source static <Private Address> <Public Address>
ip nat inside source static 192.168.1.20 209.169.200.225
5.6.1.2 Assign NAT to Interfaces
en
conf t
int g0/1
ip nat inside
int s0/0/1
ip nat outside
5.6.2.1 Configuration
en
conf t
access-list 1 permit 192.168.1.1 0.0.0.255
ip nat pool public_access 209.169.200.242 209.169.200.254 netmask 255.255.255.224
ip nat inside source list 1 pool public_access
5.6.3 PAT
en
conf t
access-list 1 permit 192.168.1.1 0.0.0.255
ip nat inside source list 1 interface serial 0/0/1 overload
5.6.4 General
5.7 VPN
5.7.2.1 ACL
en
conf t
access-list 110 permit ip 192.168.1.0 0.0.0.255 192.168.3.0 0.0.0.255
5.7.2.2 ISAKMP Phase 1
en
conf t
crypto isakmp policy 10
encryption aes
authentication pre-share
group 2
exit
isakmp key cisco address 10.2.2.2
5.7.2.3 ISAKMP Phase 2
en
conf t
crypto ipsec transform-set VPN-SET esp-3des esp-sha-hmac
crypto map VPN-MAP 10 ipsec-isakmp
description VPN connection to R3
set peer 10.2.2.2
set transform-set VPN-SET
match address 110
exit
5.7.2.4 Configure the crypto map on the outgoing interface.
en
conf t
interface S0/0/0
crypto map VPN-MAP
5.7.3.1 ACL
en
conf t
access-list 110 permit ip 192.168.3.0 0.0.0.255 192.168.1.0 0.0.0.255
5.7.3.2 ISAKMP Phase 1
en
conf t
Crypto isakmp policy 10
encryption aes
authentication pre-share
group 2
exit
isakmp key cisco address 10.1.1.2
5.7.3.3 ISAKMP Phase 2
en
conf t
crypto ipsec transform-set VPN-SET esp-3des esp-sha-hmac
crypto map VPN-MAP 10 ipsec-isakmp
description VPN connection to R1
set peer 10.1.1.2
set transform-set VPN-SET
match address 110
exit
5.7.3.4 Configure the crypto map on the outgoing interface
en
conf t
interface S0/0/1
crypto map VPN-MAP
6 Switch
6.1 Security
6.2 VLAN
6.3 IP