CCNA Cheat Sheet: https://github.com/HerrSpace/CCNA-Cheat-Sheet/


Configure basic Networking

CommandDescription
(config)# interface g1/0Enter their interface config mode
(config-if)# description Link to SomehostHuman readable link description
(config-if)# ip address 10.23.42.5 255.255.0.0Add IPv4 address to interface.
(config-if)# mac address 1234.5678.90ABOverwrite MAC address.
(config-if)# no mac addressRemove MAC overwrite.
(config-if)# ipv6 address 2001:41d0:8:e115::ccc/64Add IPv6 address to interface.
(config-if)# ipv6 address 2001:41d0:8:e115::/64 eui-64Add IPv6 address based on MAC to interface.
(config-if)# ip address dhcpGet IPv4 address via dhcp.
(config-if)# ipv6 address autoconfig [default]Get IPv6 address [and default route] via autoconfig
(config-if)# ip dhcp client client-id asccii SW2Set hostname transmitted as dhcp client to SW2
(config)# interface g1/0 - 2Configure both interfaces at once.
(config-if)# [no] shutdownEn- or Disable interface. Often shutdown is the default.
(config)# ip default-gateway 10.23.42.1Set 10.23.42.1 as the default gateway
(config)# ip route 10.20.30.0 255.255.255.0 {1.2.3.4,e0/0} [ad]Add static route via next hop or interface
(config)# ipv6 route 2001:41d0:8:e115::/64 [g1/1] [next hop]Next hop is required for Ethernet interface in IPv6
(config)# ip host the-space.agency 178.32.222.21Create a static host entry on this device.
(config)# ipv6 unicast-routingGlobally enable ipv6 routing.

Troubleshoot basic Networking

CommandDescription
# show interfaces [if-name]Show interfaces mac, bandwidth, mtu, packet stats…
# show ip[v6] route [static]Show routes and how they were learned.
# show ip[v6] interface [if-name]Show interfaces ip/arp/icmp/nd… configuration
# show ip[v6] interface brief [if-name]Only show ip, status and operational status
# show protocols [if-name]Much like show ip int brief, w/ cidr, w/o ok/method
# show mac address-tableShow the mac address table of a switch.
# clear mac address-table [dynamic]Clear the dynamically learned mac address table entries.
# show arpShow {ip,ipx,appletalk}-mac bindings
# show ip arp [{ip, mac, if-name}]Show ip-mac bindings
# clear [ip] arp 192.168.1.1Remove arp entry for ip
# debug arpShow debug messages when receiving/sending arp packets
# undebug allDisable all previously enabled debugs
# show ipv6 neighborsShow neighbor discovery table cache
# ping 1.2.3.4 [source g1/1]
# traceroute 1.2.3.4 [source g1/1]
# show control-plane host open-portsnetstat -tulpn on this cisco device, basically

Troubleshoot networks with SPAN

CommandDescription
(config)# monitor session 23 source interface g1/1 {rx,tx,both}Define SPAN #23 input as g1/1
(config)# monitor session 23 destination interface g1/2Define SPAN #23 output as g1/2
# show monitorShow all configured SPANs

Port Security

CommandDescription
(config-if)# switchport mode {access, trunk}
(config-if)# [no] switchport port-securityEn/Disable port-security
(config-if)# switchport port-security maximum 1Number of allowed MACs.
(config-if)# switchport port-security mac-address 1234.5678.9abcManually allow a MAC on this port.
(config-if)# switchport port-security mac-address stickyAllow learning of connected macs until mac reached.
(config-if)# switchport port-security violation shutdownShutdown port when other device gets connected.
(config-if)# shutdown (config-if)# no shutdownReenable if after port-security violation.
(config)# errdisable recovery cause psecure-violationReenable if automatically after problem is fixed.
(config)# errdisable recovery interval 42Recheck every 42 seconds. (min 30, default 300)

Port-security violation terms

TermDefinition
protectDrops packets, no alert
restrictDrops packets, increments security-violation count
shutdownShuts down the port (default)

Troubleshooting Port Security

CommandDescription
# show port-security [interface g1/1]port status, violation mode, max/total MACs,…
# show port-security addressSecure MACs on ports.
# show errdisable recoveryCheck if autorecovery is enabled. Disabled by default.

Configure vlans

Note: Even when a switch port is changed from access to trunk, its access vlan is maintained in the config. When automatic trunk negotiation fails (e.g. because I unplug a link between to switches and put it into my laptop) the configured access vlan becomes active once again and I might be able to reach network parts I’m not supposed to. Always disable DTP / trunk auto negotiation.

Layer2 Switch Vlan Config

CommandDescription
(config)# [no] vlan 23[delete vlan or] create vlan and enter config-vlan mode
(config-vlan)# name TelephoneSanitizerName this vlan TelephoneSanitizer
(config)# int g1/1
(config-if)# switchport mode accessMake frames out this port untagged
(config-if)# switchport access vlan 23
(config)# int g1/2
(config-if)# switchport mode trunkMake frames out this port tagged by default
(config-if)# switchport trunk encapsulation dot1qSometimes the default is ciscos old isl.
(config-if)# switchport trunk native vlan 256Except for vlan 256, which is still untagged.
(config-if)# switchport nonegotiateDisable DTP

Layer3 Switch Vlan Config

CommandDescription
(config)# interface vlan 23enter interface config mode
(config-if)# ip address 1.2.3.4 255.255.255.0set device ip in vlan 23
(config-if)# no shutdownvirtual interfaces are disabled by default
(config-if)# int g
(config)# no vlan 23delete vlan 23

Router (on a Stick) Vlan Config

CommandDescription
(config)# interface g1/1.10Create subinterface g1/1.10 on g1/1
(config-subif)# encapsulation dot1q 10enable ieee 802.1Q vlan tagging with vlan 10 on the subinterface
(config-subif)# ip address 10.0.10.1 255.255.255.0
# show vlansShow vlans and their trunk interfaces

Troubleshoot Vlans on a switch

CommandDescription
# show vlan [{id 23, name TelephoneSanitizer}] [brief]Show vlan settings for all switch ports
# show interfaces g1/1 switchportVerify mode and vlan of g1/1
# show interfaces g1/1 trunkShow trunk settings and state
# show run interface vlan 1Quick way to search the running config.
# show interface statusShow trunk mode / access vlan
# show dtp interface g1/1Show current DTP mode for g1/1

VTP

CommandDescription
(config)# vtp mode [server, client, transparent]
(config)# vtp domain
(config)# vtp password
(config)# vtp pruning

Troubleshoot VTP

CommandDescription
show vtp statusshow vtp domain, pruning, mode and more
show vtp password

STP

Spaning Tree Protocol (802.1D) blocks ports with redundant links to prevent layer 2 loops and broadcast storms.

CommandDescription
(config)# spanning-tree vlan 1 root {primary, secondary}Make this device the primary/secondary root bridge.
(config)# spanning-tree portfast bpduguard defaultEnable bpdu guard for all portfast enable interfaces
(config)# spanning-tree portfast defaultEnable portfast for all non-trunk interfaces
(config-if)# spanning-tree bpduguard enableEnable gpduguard on this interface
(config-if)# spanning-tree portfastEnable portfast on this interface
(config-if)# spanning-tree guard rootEnable root guard on this interface

Troubleshoot STP

CommandDescription
# show spanning-tree [vlan 1]Who’s the root and how do I get there?
# show spanning-tree summaryIs global portfast/bpduguard configured?
# show running-config interface g1/1Is portfast/bpduguard configured on this interface?
# show spanning-tree interface g1/1 portfastIs portfast active on this interface?

RSTP

Rapid Spanning Tree Protocol (802.1w) reduces convergence time after a topology change compares to STP.

CommandDescription
(config)# spanning-tree mode rapid-pvstChange spanning-tree mode to RSTP

Etherchannel (Link Aggregation)

How to set LACP? TODO: Look at modes again

CommandDescription
(config)# interface range g1/1 - 2configure g1/1 and g1/2 at the same time
(config-if-range)# channel-group 1 mode {auto, desirable}Add both interfaces to etherchannel 1 (PAgP)
(config-if-range)# channel-group 1 mode {active, passive}Add both interfaces to etherchannel 1 (LACP)
(config-if-range)# channel-group 1 mode onAdd both interfaces to etherchannel 1 (Static)
(config)# interface port-channel 1Configure virtual interface for etherchannel 1
(config-if)# switchport mode trunkPut etherchannel 1 in trunk mode
(config-if)# switchport trunk allowed vlan 10,20,30Add tagged vlans 10,20,30 on ethercahnnel 1
CommandDescription
# show interface port-channel 1Has the combined bandwidth and members as extra info.
# show etherchannel summaryShow etherchannel protocols and members as a list
# show etherchannel port-channel 1Show per member state and stats

Configure a Serial

Layer 1 link speed is dictated by a CSU/DSU, in a lab without an external CSU/DSU a DTE (Data Terminal Equipment) cable and DCE (Data Communications Equipment) cable are used.

CommandDescription
(config)# interface serial 1/0Configure interface serial 1/0
(config-if)# clock rate 128000Set clock rate on DCE router side to 128 kbps
(config)# show controllers serial 1/0Verify clock rate for serial interface 1/0

ACLs

1-99,1300-1999: Standard IPv4 ACL

100-199,2000-2699: Extended IPv4 ACL

Default mask for standard ACLs: 0.0.0.0

CommandDescription
(config)# access-list 23 permit 1.2.3.4 [0.0.255.255]Create ACL #23 or append a rule to ACL #23, allow 1.2.x.x
(config)# no access-list 23Delete entire ACL #23
(config)# ip[v6] access-list resequence local_only 5 10Renumber ACL Rules, put first on #5, increment by 10.
(config)# ip access-list {standard, extended} 23Create ACL and/or enter config mode for ACL #23
(config)# ip access-list {standard, extended} local_onlyCreate ACL and/or enter config mode for ACL ā€˜local_only’
(config-std-nac1)# permit 10.20.30.0 0.0.0.255Append rule to standard ACL ā€˜local_only’
(config-std-nac1)# 5 permit 10.20.30.0 0.0.0.255Append rule to ACL at sequence number 5.
(config-std-nac1)# no <sequence#>Remove rule with sequence# from ACL
(config-ext-nac1)# deny tcp any any
(config-ext-nac1)# permit udp host 10.20.30.40 any lt 1024
(config-ext-nac1)# permit udp host 10.20.30.40 any eq dns
(config-ext-nac1)# deny udp host 10.20.30.40 any
(config-ext-nac1)# permit ip any any

Interface ACLs

CommandDescription
(config)# inter g1/1Enter if-config mode for g1/1
(config-if)# ip access-group 23 outApply ACL #23 to outgoing packets, not send by the router
(config-if)# ip access-group 42 inApply ACL #42 to incoming packets
(config-if)# ip access-group local_only inOverwrite the used ACL, only one ACL per if + proto + direction!
(config-if)# ipv6 traffic-filter 23 outThe v6 syntax of course differs…
# show ip interface g1/1 | incl access listShow ACLs on g1/1 (When none set shows not set for v4 and nothing for v6)

Troubleshooting ACLs

CommandDescription
# show [ip[v6]] access-listsShow all configured ACLs
# show access-list 10Display all rules in ACL #10 and how often they matched.

NAT

Local addresses are any address as it appears inside the network. Global addresses are any address as it appears outside the network.

TermDefinition
inside localIP address assigned to a host inside the network, non-routable
inside globalIP address assigned by Network Information Center or ISP, routable
outside localIP address of a remote host as it appears inside the network, non-routable
outside globalIP address of a remote host assigned by the host owner, routable
CommandDescription
(config)# int g1/1Enter if-config mode for g1/1
(config-if)# ip address 1.2.3.4 255.255.255.240configure 1.2.3.4/28 on g1/1
(config-if)# ip nat outsidePackets going out, need to change their src, incoming their dest ip.
(config)# int g1/2Enter if-config mode for g1/2
(config-if)# ip address 10.10.23.1 255.255.255.0configure 10.10.23.1/24 on g1/2
(config-if)# ip nat insidePackets going out, need to change their dest, incoming their src ip.

SNAT

CommandDescription
(config)# ip nat inside source static 10.10.23.2 1.2.3.5SNAT - statically map an internal ip 1:1 to an external ip.

DNAT

CommandDescription
(config)# access-list 42 permit 10.10.23.0 0.0.0.255Create an ACL identifying 10.10.23/24
(config)# ip nat pool POOL 1.2.3.5 1.2.3.10 netmask 255.255.255.240Create an IP Address Pool for NATing
(config)# ip nat inside source list 42 pool POOLDNAT IPs matching ACL #42 1:1 with IPs from nat pool ā€˜POOL’.

Note the missing overload.

PAT

The overload keyword means, that one or a couple of external IPs are to be used for multiple internal IPs. Higher level information like connection port numbers are used to identify the correct internal destination for incoming packets. Cisco calls this PAT, while this is what your average joes home router would call NAT.

CommandDescription
(config)# access-list 10 permit 10.10.0.0 0.0.255.255Create an ACL identifying 10.10/16
(config)# ip nat inside source list 10 interface g1/1 overloadPAT IPs matching ACL #10 many:1 with g1/1s public IP

Troubleshooting NAT

CommandDescription
# show ip nat translationsShow nat table entries if any
# show ip nat statisticsShow translations are actually used and interfaces are marked in/out correctly.
# clear ip nat translation {ip, *}Clear dynamic translations. Doesn’t mess with SNAT!
# debug ip nat [detailed]

Is the ACL correct? Is there a route to the address? Note: NAT Table entries are kept for 24h after the last use by default.

DHCP Server

CommandDescription
(config)# ip dhcp excluded-address 10.30.4.1 10.30.4.100Don’t distribute these IPs in leases
(config)# ip dhcp pool PCsCreat and/or enter dhcp config for pool ā€˜PCs’
(dhcp-config)# network 10.30.4.0 /24define pool addresses
(dhcp-config)# default-router 10.2.1.1define default-gateway to be distributed in the leases
(dhcp-config)# dns-server 10.30.4.1
(dhcp-config)# domain-name acme.com
(dhcp-config)# lease lease validity time
(config)# int g1/1Enter interface config mode on client facing interface
(config-if)# ip helper-address 192.168.1.1Relay DHCP Requests to this host

Troubleshooting DHCP

CommandDescription
# debug ip dhcp server packet
# show dhcp leaseShow dhcp lease information
# show ip dhcp poolShow pool size and addresses in use
# show ip dhcp bindingShow which mac got which ip
# sh run | section dhcpSee if ip dhcp exclude-address / pool stuff is wrong.
# sh run int g1/1See if ip helper-address is wrong.

HSRP

CommandDescription
(config-if)# standby [group-number] ip Join HSRP Group
(config-if)# standby [group-number] priority (optional) Set prio of this router.
(config-if)# standby [group-number] preempt(optional) Preempt other routers when this router becomes active
(config-if)# standby {1,2}(optional) Set HSRP Version

Troubleshooting HSRP

CommandDescription
# show standbyHSRP Groups, their VIPs, state, active router, standby router, preemption.

SLAs

CommandDescription
(config)# ip sla 23Create ip sla test #23 and enter its config mode.
(config-ip-sla)# icmp-echo 1.2.3.4Define icmp-echo test.
(config-ip-sla)# frequency 42frequency in seconds.
(config)# ip sla schedule 23 life {forever, seconds} start-time nowStart test #23 now and until manually stopped.

Troubleshooting SLAs

CommandDescription
# show ip sla configurationShow all configured ip sla configs
# show ip sla statisticsShow sla results

Device Management

CommandDescription
(config)# hostname R1Set hostname to R1
(config)# enable password Set enable passwort.
(config)# enable secret Same, but with hashing.
(config)# service password-encryptionVery weak encryption of passwords passwords.
# copy flash0: tftp:Copy something from flash to tftp. Wizard asks for details. Works both ways.
# write# copy running-config startup-config
# write erase# erase startup-config
# reloadrestart the device and load the startup-config
# copy running-config tftp:copy running-config to an tftp server. (interactive)
# copy running-configMerge source config into the running config.
# setupinitial configuration dialog
# show versionios, bootloader and hardware infos, uptime, configuration register
# show {running,startup}-config

Firmware Management

Note: flash: is the main flash memory on all iOS devices

CommandDescription
(config)# boot system flash:filename.binBoot filename.bin from flash memory.
(config)# boot system tftp://10.20.30.40/filename.binBoot filename.bin from tftp.
(config)# boot system romBoot ROM monitor as a backup.
(config)# config-register 0x2342Set the 16bit Configuration Register value used after reboot.
# show file systemsLists available file systems
# show flash0:List fs content and free space.

License Management

CommandDescription
# license save flash:licenses.licSave a copy of all licenses.
# license install flash0:license.xmlInstall a license.
(config)# license boot module technology-package active a evaluation right-to-use license.
# reloadReboot to activate the package and right to use license.
(config)# license boot module technology-package disabledeactive a technology-package.
# reloadReboot without that technology-package.
# license clear Remove license from the license storage.
(config)# no license boot module technology-package disableRemove the no longer needed line from the config.
# reloadI don’t even know why this is needed. Fu cisco.
# show licenseactive licenses
# show license featuretechnology packe and feature licenses supported.
# show license udiproduct id and serial number needed to order licenses

Reset Password

CommandDescription
> confreqShow the configuration register in rom monitor
> confreq 0x2142Set the configuration register in rom monitor to not load startup-conf
> resetReboot in rom monitor
# copy startup running
(config)# enable secret foobarOverwrite forgotten password
(config)# config-register 0x2102Do load startup-config after boot again.
# save

Telnet / Console

CommandDescription
(config)# banner login ā€œInsert snarky banner.ā€Make sure to include legal terms to sound smart.
(config)# banner motd ā€œInsert snarky banner.ā€Set Login Banner.
(config)# line vty 0 4Enter config mode for vty 0 to 4 (up to 15 allowed).
(config)# line console 0Enter config mode for the console port
(config-line)# loginRequire login on telnet/console connection.
(config-line)# password Enable Telnet and set vty login password.
(config-line)# access-class 10 inSet ACL to limit inbound IPs allowed to access vty
(config-line)# access-class 42 inOverwrite the used ACL, only one ACL per vty + direction!
(config-line)# exec-timeout 10Autologout after 10 Minutes
(config-line)# login localRequire login on telnet/console connection via local users.
(config)# username h.acker secret C1sco123Create local user with encrypted password.

SSH

CommandDescription
(config)# hostname FoobarRequired to generate SSH keys.
(config)# ip domain-name example.comRequired to generate SSH keys.
(config)# crypto key generate rsa modulus 2048Generate keys like it’s 1995! Potentially takes forever.
(config)# ip ssh version 2Force SSHv2
(config-line)# transport input sshForce ssh, disable telnet.
# show ip sshSSH version, timeout time, auth retries..
# show sshList of active connections

Clock

CommandDescription
# show clockShow time and date
(config)# clock set 23:50:42 10 Jan 2017Update clock
(config)# clock timezone EST 0Update timezone to EST
(config)# ntp server 10.20.30.40Configure upstream ntp server.
(config)# ntp master [stratum]Enable ntp server.
# show ntp associationsntp connections.
# show ntp statussynchronized?, statum, …

Disable unused services

CommandDescription
# show control-plane host open-portsShow open ports
(config)# no ip http serverStop the http server (but not https).
(config)# no cdp enableStop CDP
# auto secure

Radius

CommandDescription
(config)# username password Local backup user.
(config)# aaa new-modelEnable aaa services.
(config)# radius server Add and define Radius conf.
(config-radius-server)# address ipv4 [auth-port ]Use this hostname/ip of server.
(config-radius-server)# key Radius PSK
(config)# aaa group server radius Create authentication group.
(config-sg-radius)# server name Using the radius config.
(config)# aaa authentication login group localAllow that group and local users in.

TACACS+

CommandDescription
(config)# username password Local backup user.
(config)# aaa new-modelEnable aaa services.
(config)# tacacs server Add and define TACACS conf.
(config-server-tacacs)# address ipv4
(config-server-tacacs)# [port ]
(config-server-tacacs)# key
(config)# aaa group server tacacs+ Multiple possible.
(config-sg-tacacs+)# server name
(config)# aaa authentication login group localAllow that group and local users in.

Syslog

CommandDescription
# logging 10.20.30.40Log to this syslog server (name or ip)
# logging trap informationalOnly log messages with min. informational sev.

service sequence-number | Needed for seqence number in syslog messages service time stamps log [datetime, log] | Needed for date and time in syslog messages

CommandDescription
# show loggingsyslog status, local logging buffer

SNMP

CommandDescription
(config)# snmp-server contact admin@example.comContact email
(config)# snmp-server location RZ-HamburgWhere is the device
(config)# snmp-server community [ro, rw]Add community
(config)# snmp-server host 10.20.30.40 SNMP notifications recipient
CommandDescription
# show snmp community
# show snmp location
# show snmp contact
# show snmp host

CDP - Cisco Discovery Protocol

CommandDescription
# [no] cdp runEnables cdp globaly and on all interfaces (default)
# (config-if)# [no] cdp enableEnable cdp on an interface
# show cdp neighbors [detail]List connected cisco devices (name, local/remote port, [ip] ..)
# show cdp entry *
CommandDescription
# [no] lldp runEnables lldp globaly and on all interfaces
(config-if)# [no] lldp transmitEnable lldp packet transmission on interface
(config-if)# [no] lddp receiveEnable lldp packet reception on interace

PPP

CommandDescription
(config)# username fnord password passCreate users for pap auth.
(config)# inteface S0/0/0
(config-if)# clock rate 125000Baud rate. Only on DCE cable!
(config-if)# bandwidth 125Logical speed used for routing cost calc, RSVP…
(config-if)# encapsulation pppDefault is HDLC
(config-if)# ppp authentication papRequire remote to authenticate via pap
(config-if)# ppp pap sent-username fnord password passAuthenticate to remote pap
(config)# hostname routy1Required for CHAP, used as chap client username
(config)# username routy2 password foobarCreate users for chap auth for routy2
(config)# inteface S0/0/0
(config-if)# no ppp authentication papRemove in favor of chap
(config-if)# no ppp pap sent-username fnord password passRemove in favor of chap
(config-if)# ppp authentication chapRequire remote to authenticate via chap

Note: When routy1 connects to routy2 it looks in it’s local user database for a user named routy2 and uses that users password. This means the passwords have to be the same on both sides and the usernames must be the other sides hostname.

Troubleshooting PPP

CommandDescription
# show controllers S0/0/0interface, connected type of cable, clock rate
# show interfacesencapsulation, logical bandwidth
# show ppp allsession state, auth type, peer ip and name
# debug ppp authentication

MLP

CommandDescription
(config)# interface Multilink23Create and configure virtual if
(config-if)# ip address 10.20.30.40 255.255.255.0
(config-if)# ppp multilinkEnable mlp
(conifg-if)# ppp multilink group 23Make phys ifs with mlp #23 join.
(config)# interface s0/0/0Configure phys ifs
(config-if)# no ip addressRemove ip addrs.
(config-if)# encapsulation ppp
(config-if)# ppp multilink
(config-if)# ppp multilink group 23Join mlp group #23.

Troubleshooting MLP

CommandDescription
show ppp multilinkPhysical IFs,

PPPoE

CommandDescription
(config)# interface Dialer23Create and configure virtual dialer interface.
(config-if)# ip address negotiatedGet IP via PPP/IPCP
(config-if)# encapsulation ppp
(config-if)# dialer pool 23The dialer interface is a member of one dialer pool…
(config)# interface s0/0/0
(config-if)# no ip address
(config-if)# pppoe-client dial-pool-number 23… the pool is a group of one or more physical interfaces.

Troubleshooting PPPoE

CommandDescription
# show ip interface briefis the dialer if up? Does the dialer have an IP via IPCP?
# show pppoe sessionAre PPPoE sessions established? Which ports.

GRE

Note: We can run OSPF and other routing protocols through this gre tunnel, as gre supports multicast.

CommandDescription
(config)# interface tunnel23
(config-if)# ip address 192.168.1.1 255.255.255.0transit net
(config-if)# tunnel source 10.20.30.40local, can be linklocal
(config-if)# tunnel destination 6.5.4.3remote, can be linklocal

tunnel mode gre ip ip mtu

Troubleshooting GRE

CommandDescription
# show ip interface brief tunnel23Line hould be up, given a route to the destination.
# show inteface tunnel23Tunnel source, dest, protocol
# show ip routeShould include the transit net as directly connected.

RIPv2

CommandDescription
(config)# router ripEnable RIP and enter it’s config mode
(config-router)# version 2Set RIPv2, which is Classless
(config-router)# network 192.168.0.0Advertise connected networks which are within .
(config-router)# network 0.0.0.0Advertise all connected networks.
(config-router)# timers basic
(config-router)# no auto-summaryDon’t summarize a smaller subnet route in a bigger one.
(config-router)# passive-interface g1/1Don’t send RIP updates out this interface
(config-router)# passive-interface defaultDon’t send RIP updates on any if by default
(config-router)# no passive-interface g1/2Overwrite passive-interface default
(config-router)# default information originateAdvertise the default route.
(config-if)# no ip rip advertise 123

Troubleshooting RIPv2

CommandDescription
# show ip[v6] protocolsShow rip timers, interfaces, networks,
# show ip rip databaseRoutes learned by rip, used to combile the routing table
# show ip routeShow learned routes
# clear ip route *Get rid of all routes

EIGRP

Note: The network command enables any interface with an ip in that net to send and receive EIGRP updates. Also it enables routes to this nets to start beeing advertised.

CommandDescription
# show run &#124 section eigrpShow EIGRP settings.
# show interfaces g1/1Show configured/default bandwith and delay.
(config-if)# bandwidth Overwrite bandwidth used for eigrp metric.
(config-if)# delay Overwrite deplay used for eigrp metric.
(config)# router eigrp 23Add and conf EIGRP AS#23
(config-router)# network 10.20.30.0 0.0.0.255Announce routes to 10.20.30.0/24
(config-router)# no shutdownOn some iOS versions it’s off by default.
(config-router)# [no] eigrp router-id Defaults to highest loopback ip
(config-router)# [no] passive-interface g1/2Disable EIGRP here. Ignore incoming pkgs.
(config-router)# [no] passive-interface defaultDisable EIGRP on all ifs by default.
(config-router)# maximum-paths Default 4, must match, number of loadbalanced paths.
(config-router)# variance 4Default 1, Max 4:1 variance for unequal lb.
(config-router)# no auto-summaryDon’t summarize a smaller subnet route in a big one.
# show ip[v6] eigrp neighborsNeighbor addr, if, hold time, uptime, queued pkgs
# show ip[v6] eigrp interfaces [if-name]If, Number of peers, pending routes, queued pkgs
# show ip[v6] route [eigrp]Routes starting with D were learned via EIGRP
# show ip[v6] eigrp topology [all-links]Topology table, as#, router-id

EIGRP with ipv6

CommandDescription
(config)# ipv6 unicast-routingEnable v6 routing on the router
(config)# ipv6 router eigrp 23Configure eigrp as #23
(config-rtr)# no shutdownEnable this eigrp routing process.
(config-if)# [no] ipv6 eigrp 23Enable eigrp with ipv6 for as #23 on this if.

OSPF

cost = reference bandwidth / interface bandwidth

The default reference bandwith is 100Mbps. Everything faster has a cost of 1.

CommandDescription
(config)# router ospf 11 is the pid, not the area.
(config-router)# router-id 1.2.3.4Defaults to highest IPv4 on lo, then other ifs.
(config-router)# network 10.20.30.0 0.0.0.255 area 0enable interfaces for ospf with matching IPs
(config-router)# (no) passive-interface g1/1Stop in- and egress ospf hello packets.
(config-router)# passive-interface defaultMark all ifs passive by default.
(config-router)# default-information originate (always)Advertise default routes into a normal area
(config-router)# auto-cost reference-bandwidth <refbw in Mb/s>Change reference bandwidth speed
(config-if)# ip ospf cost 23Overwrite interface cost to 23
(config-if)# bandwidth <bw in kb/s>Change interface bandwidth

Router Types

TermDefinition
Internal RouterAll OSPF interfaces in one area
Backbone RouterHas one or more OSPF interfaces in the backbone
Area Boundary Router (ABR)Has at least one interface in the backbone area and at least one in another area
Autonomous System Boundary Router (ASBR)Injects routes into OSPF via redistribution from other routing protocols

OSPF with ipv6 (OSPFv3)

CommandDescription
(config)# ipv6 unicast-routing
(config)# ipv6 router ospf
(config-router)# router-id Required if we don’t have any v4 addrs configured.
(config-if)# ipv6 ospf area Required for OSPFv3.

The networks command does not exist, non mentioned commands are the same.

Troubleshooting OSPF

CommandDescription
# show run | sect ospf
# show ip(v6) protocolsOther protocols with lower AD?
# show ipv6 ospfreference bandwidth, router id, networks, interface per area
# show ip(v6) ospf neighborneighbor IDs, IPs and via interface.
# show ip(v6) ospf neighbor detaildr, bdr, timers, …
# show interface briefadmin down? link?
# show ip(v6) ospf interface briefospf enabled interfaces
# show ip(v6) ospf interface g1/1ospf related infos for g1/1, passive?
# show ip(v6) route (ospf)ospf routes are marked O, show route ad and cost

BGP

Note: In other routing protocols the network statement is used to determin the interfaces over which the protocol should talk to its neighbors. In BGP it indicates only which routes should be advertised to the BGP neighbors. The network needs to match an exact route in the routing table or it will still not be announced.

CommandDescription
(config)# router bgp Create routing process.
(config)# neighbor remote-as BGP does not auto discover neighbors.
(config)# network [mask ]Advertise this network.
CommandDescription
# show run | sect bgp
# show ip bgp summaryneighbors IPs, ASs and session states, bgp version
# show ip bgp neighbors [peer-ip]tcp sessions and timers, bgp parameters
# show ip bgprouting infos received from all peers

CLI

Default Behavior

Here I’ll collect crazy default behaviors and how to fix them, I guess..

CommandDescription
(config)# no ip domain-lookupDon’t try to telnet unknown single word commands

Modes

ModePromptenter
User>N/A
Exec#> enable
Config(config)## configure terminal
Interface(config-if)#(config)# interface g1/0
Line(config-line)#(config)# line vty 0 4
DHCP(dhcp-config)#(config)# ip dhcp pool Foobar

Filters

NameFunction
include hostnamefind a line including ā€˜hostname’
section interfacefind a section including ā€˜interface’
begin interfaceShow remaining config starting with the first line containing ā€˜interface’
exclude !exclude all line containing ! (comments)
SequenceFunction
Ctrl-Shfit-6Kill many commands
Ctrl-Shift-6 xMove telnet session to background
Esc-BCtrl-Left arrow
Esc-FCtrl-Right arrow
Ctrl-RRedraw the current line
Ctrl-UErase line
Ctrl-WDelete the word left of the cursor
Ctrl-CDrop back to Exec, does not kill processes..
Ctrl-AMove Cursor to the beginning of the line
Ctrl-EMove Cursor to the end of the line
TabAutocompletion
?Help, can be entered mostly everywhere

Packet Types

Ethernet Frame

FieldField LengthDescription
Preamble8 bytesAlternating 1s and 0s used to synchronize
Destination MAC (DA)6 bytesMAC of recipient
Source MAC (SA)6 bytesMAC of sender
802.1Q tag (optional)4 bytesOptional vlan tag. Starts with 0x8100 to mark 802.1Q mode in type location.
Type or Length2 bytesLayer three type OR length if smaler then 1536 bytes.
Data46 - 1500 bytesPayload
Frame check sequence (FCS)4 bytes32 bit CRC Checksum

IPv4 Header

FieldField LengthDescription
Version4 bitsIP Version, always four
Internet Header Length (IHL)4 bitsLength of the header
Service Type8 bitsDesired QOS information (DSCP and ECN)
Total Length2 bytesPacket length, including this header
Identification2 bytesA unique ID
Flag3 bitsfragmentation behaviour
Fragment Offset13 bits
TTL1 byteTTL, decreased by every router by one.
Protocol1 byteLayer four type
Header Checksum2 bytes
Options (optional)16 bytes
Paddingmax. 31 bitsPad to the nearest 32 bit boundary

TCP Segment

FieldField LengthDescription
Source Port2 bytes
Destination Port2 bytes
Squence Number4 bytesUnique Number for this Segment
Acknowledgement Number4 bytesNext expected sequence number, acknowledge all prior Segments.
Header Lenght4 bitsHeader size in multiples of 4 bytes, sometimes also called Data Offset.
Reserved3 bitsN/A
Flags9 bitsControl Flags like SYN, ACK, FIN, RST and Flags for congestion control.
Window size2 bytesbytes sender is currently willing to receive
Checksum2 bytesHeader Checksum
Urgent Pointer2 bytesPoints to the last ā€˜urgent’ byte in the Segment, used when URG flag is set.
Options0 - 320 bitsThe Size is determined by Header length. TODO:
Datavariable

UDP Segment

FieldField LengthDescription
Source Port2 bytes
Destination Port2 bytes
Length2 bytesLength of the whole Segment
Checksum (optional)2 bytesChecksum of the whole Segment
Datavariable

To Sort and Misc

CommandDescription
# telnet 1.2.3.4 23Telnet to 1.2.3.4 using port 23
# disconnectDisconnect background telnet session
# ssh -l h.acker 1.2.3.4SSH to 1.2.3.4 using h.acker user
(config-if)# duplex {full, auto}Set duplex mode or set it to autonegotiation.
(config-if)# speed {100, auto}Set speed or set it to autonegotiation.