Networking Test Friday Online
© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
ITE PC v4.0
Chapter 1 1
Chapter 1 Introduction to Routing and Packet Forwarding
Routing Protocols and Concepts – Dr. C. BouSaba
ITE PC v4.0
Chapter 1 2 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Router Functions
Connect networks together
Direct packets to their proper destination efficiently
Find best routes
Switch packets from one network to another
Provide
– Security (Permitting or denying specified types of packet)
– Quality of service (Prioritizing packets)
ITE PC v4.0
Chapter 1 3 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Router as a computer
CPU: control unit handles instructions, ALU for calculations
RAM: volatile working storage
ROM: permanent storage for POST and start-up instructions
Operating System: software that runs the computer
System bus, Power supply Long term storage is Flash and
NVRAM, not hard disk
Range of different interfaces all on different networks
No input/output peripherals. Connect via a console PC and use PC’s keyboard and screen
Router VS computer
ITE PC v4.0
Chapter 1 4 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Hardware Components of a Router
ITE PC v4.0
Chapter 1 5 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Integrated Services Routers
ITE PC v4.0
Chapter 1 6 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
ITE PC v4.0
Chapter 1 7 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
RAM Dynamic random access memory
Temporary memory while router is on
Loses content when the router loses power or is restarted
Holds running configuration
Holds routing tables
Holds ARP cache
Holds fast-switching cache etc.
NVRAM Non-volatile RAM: keeps its contents
when the router is off
Stores the startup configuration file
When you have configured a router, you must save your configuration to NVRAM if you want to keep it
Flash Electronically erasable, programmable
ROM (EEPROM)
Keeps its contents when the router is off
Holds the operating system image (IOS)
Allows the IOS to be updated
Can store multiple versions of IOS software if it has enough capacity
Can be upgraded by adding SIMMs
ROM Permanent memory: cannot be upgraded
without replacing the chip
Holds power-on self test (POST) inst.
Stores bootstrap program
Stores ROM monitor SW (for emergency download of IOS, for password recovery)
May store basic IOS for emergency use (less common than it was)
ITE PC v4.0
Chapter 1 8 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Router storage
ROM
Permanent
Holds POST, boot instructions, basic IOS
Flash
Keeps contents
Holds IOS image
NVRAM
Keeps contents
Holds startup configuration file
RAM
Volatile
Holds running config, tables, queues etc
ITE PC v4.0
Chapter 1 9 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Interfaces
Can be attached directly to the motherboard (like our Fast Ethernet or Ethernet interfaces)
Can be on removable and interchangeable modules (like our serial interfaces)
Modules for different serial connections
ITE PC v4.0
Chapter 1 10 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Operating system
As specialized computers, routers and switches need operating systems.
Cisco devices use the Cisco Internetwork Operating System (IOS)
There are versions for different models of router and switch, and different feature sets
The IOS can be upgraded periodically
ITE PC v4.0
Chapter 1 11 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Naming IOS image files
Platform-features-format-version
c2600-i-mz.122-8.T5
c2600 is the platform: Cisco 2600 series router
i is a code for the set of features in this IOS, another is ipbase
mz is a code to say that the IOS runs in RAM and the file is zip compressed
122-8.T5 is the upgrade version
ITE PC v4.0
Chapter 1 12 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
IOS storage
The IOS is stored in the router’s flash memory, often in compressed form
Most routers copy the IOS to RAM when they start up
You need enough space in flash and in RAM if you upgrade the IOS
Some of our routers have more features than others – it depends on the IOS.
ITE PC v4.0
Chapter 1 13 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
IOS modes
ROM monitor:
Used to recover from system failure or loss of password
Needs direct access from console port
Boot ROM (optional, may not have this):
Used when upgrading IOS
Cisco IOS
Normal operation, stored in Flash, runs in RAM
ITE PC v4.0
Chapter 1 14 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Router startup
ITE PC v4.0
Chapter 1 15 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
‘Normal’ start up
1. Run POST and bootup instructions from ROM
2. Load IOS file from flash
3. Load configuration from NVRAM
4. Fully operational
ITE PC v4.0
Chapter 1 16 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Configuration register
Has 4 hex digits – that’s 16 binary digits
Configuration register is saved in NVRAM
show version to see its value
Value of last hex digit tells how to load IOS
Usual is 0x2102 (2 means load from flash)
Third hex digit controls whether configuration file is loaded. (0 means load, 4 means do not)
Check Configuration Register value (NVRAM)
0 = ROM Monitor mode
1 = ROM IOS
2 - 15 = Boot system from Flash
ITE PC v4.0
Chapter 1 17 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
How a Cisco device locates and loads IOS
Demo
config-register
The config-register can be Downloaded from:
http://www.lilligren.com/cisco/downloads.htm
ITE PC v4.0
Chapter 1 18 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Configuration register: 0, 1, and 2 and above
ITE PC v4.0
Chapter 1 19 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Configuration register: 2102 and 2142
ITE PC v4.0
Chapter 1 20 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Configuration register Router(config)#config-register value
1 2
3
ITE PC v4.0
Chapter 1 21 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Loading IOS You see ############# as IOS loads from flash memory.
If you see a prompt instead:
rommon1>
Then the IOS was not loaded and you are in ROM monitor mode.
Try reload or boot
If this fails, the IOS file is probably missing…
ITE PC v4.0
Chapter 1 22 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Configuration
If there is a startup configuration file in NVRAM then it will normally load into RAM as the running configuration.
If not, the router may look for a configuration on a TFTP server. Wait until it gives up.
It then prompts you to enter Setup mode: Would you like to enter the initial configuration dialog? [yes/no]: no (If it asks if you want to exit Autoinstall: yes)
ITE PC v4.0
Chapter 1 23 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Show version
IOS version
Bootstrap version
Router model and CPU
Amount of RAM
Number and type of interfaces
Amount of NVRAM
Amount of Flash
Configuration register
ITE PC v4.0
Chapter 1 24 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
ITE PC v4.0
Chapter 1 25 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Basic Configuration (revision)
Name
Passwords
Interfaces
Routing
Banner (Message of the day)
Save configuration
Check configuration
ITE PC v4.0
Chapter 1 26 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Global configuration
Router>enable
Router#configure terminal (config t)
Router(config)#
Start in user exec mode
Go to privileged exec mode (no configuration so no password)
Go to global configuration mode
ITE PC v4.0
Chapter 1 27 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Hostname
Give the router a name to show at its prompt
Do this in global configuration mode
Router(config)# hostname ITT
ITT(config)#
ITE PC v4.0
Chapter 1 28 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Enable secret
Protect privileged exec mode with an encrypted password.
ITT(config)# enable secret class
You could set an enable password but this is not encrypted
There is no need to set both, but if you do then the enable secret will be used
ITE PC v4.0
Chapter 1 29 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Passwords for login
Set login password on console port for security
ITT(config)# line con 0
ITT(config-line) password cisco
ITT(config-line) login
ITT(config-line) exit
You can also put a password on the AUX port in a similar way
ITE PC v4.0
Chapter 1 30 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Passwords for Telnet login
Set login password on virtual lines to allow you to Telnet to the router
ITT(config)# line vty 0 4
ITT(config-line) password cisco
ITT(config-line) login
ITT(config-line) exit
ITE PC v4.0
Chapter 1 31 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Interface configuration
ITT(config)# interface serial 0
ITT(config-if)# ip address 192.168.3.1 255.255.255.0
ITT(config-if)# no shutdown
ITT(config-if)# exit
This is for a DTE serial interface
Ethernet interfaces are configured the same way
ITE PC v4.0
Chapter 1 32 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Interface DCE configuration
A DCE serial interface needs an extra line:
ITT(config)# interface serial 0
ITT(config-if)# ip address 192.168.3.1 255.255.255.0
ITT(config-if)# clock rate 64000
ITT(config-if)# no shutdown
ITT(config-if)# exit
ITE PC v4.0
Chapter 1 33 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Interface description
You can give an interface a description
This does not affect the operation of the router but it is useful documentation
Do it in interface configuration mode for the required interface
ITT(config-if) description Serial line to Rocco 01993 876543
ITE PC v4.0
Chapter 1 34 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Message of the day
You can configure a message to be shown before the user logs on
Cisco recommend that you show a warning to unauthorized users (NOT “welcome”)
ITT(config)# banner motd # authorized users only #
# is a delimiter. Any character can be used.
ITE PC v4.0
Chapter 1 35 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Routing
The router knows its directly attached networks because you have put IP addresses on its interfaces
It can put these networks in its routing table
It needs to find routes to networks that are not directly attached
You can give it static routes
You can enable a routing protocol
ITE PC v4.0
Chapter 1 36 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Routing protocol: RIP
You choose the routing protocol
Then you tell the router which directly attached networks it should advertise
ITT(config) router rip
ITT(config-router) network 192.168.1.0
ITT(config-router) network 192.168.3.0
ITT(config-router) exit
ITE PC v4.0
Chapter 1 37 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Save configuration
Your configuration is held in RAM as the running configuration
If you want to keep this configuration then you must save it to NVRAM into the startup configuration file
ITT# copy running-config startup-config
ITE PC v4.0
Chapter 1 38 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Shortened commands
The Cisco IOS accepts shortened forms of commands
You need to type enough to distinguish the command from other commands
copy run start can be used instead of copy running- config startup-config
int s 0 can be used instead of interface serial 0
ITE PC v4.0
Chapter 1 39 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Show commands
Show running-config
Show startup-config
Show ip route
Show ip interfaces
Show ip interface brief
ITE PC v4.0
Chapter 1 40 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
OSI layers 1, 2 and 3
Receive signals
from cable, convert
to binary.
Check layer 2
address,
decapsulate
Find destination network, check routing table for route,
direct packet to correct outgoing interface
Encapsulate with
frame for next link
Encode binary,
place signals on
cable
ITE PC v4.0
Chapter 1 41 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
What the router does 1
Ethernet frame received from PC1 through port Fa0/0
Destination MAC address is router’s address
ITE PC v4.0
Chapter 1 42 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
What the router does 2
Strip off frame header and trailer (decapsulate)
Read destination IP address 192.168.4.9
ITE PC v4.0
Chapter 1 43 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
What the router does 3
Logical AND with IP address 192.168.4.9 and subnet mask 255.255.255.0 (/24) gives destination network address 192.168.4.0
ITE PC v4.0
Chapter 1 44 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
What the router does 4
Look in routing table for network address 192.168.4.0
Route found via 192.168.3.2 through S0/0
ITE PC v4.0
Chapter 1 45 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
What the router does 5
S0/0 connects to a WAN link using PPP
Encapsulate packet in PPP frame
Send frame out through S0/0
ITE PC v4.0
Chapter 1 46 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
No route found
If the destination network is not in the routing table:
Use a default route if one exists
Otherwise drop the packet and send an ICMP destination unreachable message to the source host.
ITE PC v4.0
Chapter 1 47 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Routing tables
A router uses the routing table to select the best path to a network
Directly connected networks are taken from the interface configuration
Static routes can be added by administrator
Routes can be learned dynamically from other routers by using a routing protocol
ITE PC v4.0
Chapter 1 48 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Show ip route
List of codes
List of routes
ITE PC v4.0
Chapter 1 49 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Routing table
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, Serial0/0
S 192.168.3.0/24 [1/0] via 192.168.2.2
R 192.168.4.0/24 [120/1] via 192.168.2.2, 00:00:20, Serial0/0
Directly connected Network and mask
Exit port
ITE PC v4.0
Chapter 1 50 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Routing table
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, Serial0/0
S 192.168.3.0/24 [1/0] via 192.168.2.2
R 192.168.4.0/24 [120/1] via 192.168.2.2, 00:00:20, Serial0/0
Static route Network and mask
Administrative
distance and metric Address of next
hop router
ITE PC v4.0
Chapter 1 51 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Routing table
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, Serial0/0
S 192.168.3.0/24 [1/0] via 192.168.2.2
R 192.168.4.0/24 [120/1] via 192.168.2.2, 00:00:20, Serial0/0
Dynamic route, RIP Network and mask
Administrative
distance and metric Address of next
hop router Time since
last update
Exit port
ITE PC v4.0
Chapter 1 52 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Static routes Dynamic routes
Entered by administrator
Time consuming, different for each router
Must be updated if routes change
Little processing
No bandwidth used
Gives nothing away
Learned from other routers
Start the protocol then it runs by itself
Automatically updates when routes change
More processing
Uses bandwidth
Gives away information
ITE PC v4.0
Chapter 1 53 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Routing protocols
Interior, used within
an organization’s
networks
Exterior, used
between different
organizations’
networks
BGP OSPF
IS-IS
Distance vector Link state
RIP
(IGRP)
EIGRP
Routing Information Protocol Interior Gateway Routing Protocol Enhanced Interior Gateway RP
Opens Shortest Path First Intermediate System to…
Border Gateway Protocol
ITE PC v4.0
Chapter 1 54 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Routing Table Principles
1. Every router makes its decision alone, based on the information it has in its own routing table.
2. The fact that one router has certain information in its routing table does not mean that other routers have the same information.
3. Routing information about a path from one network to another does not provide routing information about the reverse, or return, path.
ITE PC v4.0
Chapter 1 55 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Metrics
A routing protocol may learn of several possible routes to a destination.
It uses metrics to pick the best route.
RIP uses hop count as its only metric.
OSPF uses “cost” based on bandwidth.
EIGRP uses bandwidth and delay and can use load and reliability as well.
ITE PC v4.0
Chapter 1 56 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Metrics
RIP uses hop count. It
picks this route as the
best.
ITE PC v4.0
Chapter 1 57 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Metrics
OSPF uses cost based
on bandwidth. It picks
this route as the best.
ITE PC v4.0
Chapter 1 58 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public
Administrative distance
There may be more than one routing protocol running. There may also be static routes.
Static routes have administrative distance 1 or 0 by default.
RIP routes have administrative distance 120
OSPF routes have administrative distance 110
The route with the lowest administrative distance goes in the routing table
ITE PC v4.0
Chapter 1 59 © 2007 Cisco Systems, Inc. All rights reserved. Cisco Public