2e_01_routing_intro

Download Report

Transcript 2e_01_routing_intro

Introduction to Routing
and Packet Forwarding
Routing Protocols and
Concepts – Chapter 1
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
1
Objectives

Router = computer with an OS and hardware
designed for the routing

Configuring devices and applying addresses

Structure of a routing table

How a router determines a path and routes packets
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
2
Router as a Computer
 Basic purpose of a router
– Computers specialized in sending packets over the network
– Responsible for selecting the best path for a packet
 Routers generally have 2 connections:
– WAN connection (Connection to ISP)
– LAN connection
Hlavní účel
•
Specializované počítače
•
Vybírají nejlepší cestu pro pakety
Mají obvykle dva druhy připojení
•
WAN (např. připojení k ISP)
•
LAN (připojení našich počítačů)
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
3
Router as a Computer
 Data is sent in form of packets between 2 end devices
 Routers are used to direct packet to its destination
•
Data posíláme v paketech mezi dvěma koncovými
zařízeními
•
Routery směrují pakety k jejich cíli
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
4
Router as a Computer
 Routers examine a packet’s destination IP address and
determine the best path by the aid of a routing table
Směrovací
tabulku
používá
jako mapu
Router zjistí cílovou IP adresu paketu a ve směrovací tabulce
nalistuje nejlepší cestu.
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
5
Router as a Computer
 Router components and their functions
 CPU - Executes operating system instructions
 Random access memory (RAM) - Contains the running copy of
configuration file. Stores routing table. RAM contents lost when
power is off
 Read-only memory (ROM) - Holds diagnostic software used when
router is powered up. Stores the router’s bootstrap program.
 CPU provádí instrukce operačního systému
 RAM se vymaže při vypnutí. Obsahuje
 současnou kopii konfigurace (tu, ve které se právě hrabeme)
 směrovací tabulku
 ROM obsahuje
 diagnostický SW potřebný pro zapnutí
 bootstrap program potřebný pro natažení operačního
systému
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
6
Router as a Computer
 Router components and their functions
Non-volatile RAM (NVRAM) - Stores startup configuration. This may
include IP addresses (Routing protocol, Hostname of router)
Flash memory - Contains the operating system (Cisco IOS)
Interfaces - There exist multiple physical interfaces that are used to
connect network. Examples of interface types:
-Ethernet / fast Ethernet interfaces
-Serial interfaces
-Management interfaces
 NVRAM = nezapomínající RAM, obsahuje startovní konfiguraci, tj.
tu, která se použije po zapnutí nebo restartu. Ta obsahuje např. IP
adresy, směrovací protokol, jméno routeru
 Flash paměť obsahuje operační systém (Cisco OS)
 Rozhraní, především
• Ethernet – pro připojení místní LAN
• Sériové – pro dálkové spoje s ostatními routery
• Řídicí – pro ovládání routeru a pro změny jeho konfigurace, např. konzola
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
7
Router as a Computer
 Router components
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
8
Router as a Computer
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
9
Router as a Computer
Steps in Router Initialization
Kde ...
... najde co ...
... a udělá co
OBDOBA V PC:
Spustí BIOS, udělá
základní kontroly
Vyhledá DOS, spustí ho
Vyhledá konfigurační
soubory (config,
autoexec) a zařídí se
podle nich
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
10
Router as a Computer
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
11
Router as a Computer
 Router Interface is a physical connector that enables a
router to send or receive packets
 Each interface connects to a separate network
 Consist of socket or jack found on the outside of a router
 Types of router interfaces:
-Ethernet
-Fastethernet
-Serial
-DSL
-ISDN
-Cable
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
12
Router as a Computer
 Router Interfaces
 Na začátku jsme rozdělili interfaces na
• Ethernet
• Sériové
• Management = ovládací
 V dalším budeme pod „Router Interfaces“ rozumět
především ty konektory, po kterých chodí pakety, tj.
ethernet a sériové.
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
13
Router as a Computer
Two major groups of Router Interfaces
Slouží k připojení místních
počítačů např. přes
přepínač.
ITE PC v4.0
Chapter 1
Slouží k propojení mezi
sítěmi, např. přes ADSL,
modem, sériovou linku.
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
14
Router as a Computer
Two major groups of Router Interfaces
 LAN Interfaces

Připojují počítače k sítím LAN

Mají MAC adresy

Mohou mít IP adresy

Obyčejně se připojují přes RJ-45 jack
 WAN Interfaces
 Umožňují směrovačům propojovat sítě LAN mezi sebou
 Používají IP adresy
 Někdy užívají MAC adresy
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
15
Router as a Computer
 Routers and the Network Layer
Směrovače posílají pakety podle cílových IP adres:
 Směrovač určí cestu, kterou má paket poslat, po
prostudování směrovací tabulky.
 Když směrovač určí nejlepší cestu, zabalí paket do
framu.
 Pak vyšle frame na síťové médium jako jednotlivé
bity.
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
16
Router as a Computer
Každý směrovač zkoumá především cílovou IP adresu.
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
17
Router as a Computer
 Routers Operate at Layers 1, 2 & 3
• Směrovač přijímá tok zakódovaných bitů – vrstva 1, fyzická
• Přečte bity z média a předá je dále na vrstvu 2, datovou
• Strhne vnější obal = frame, aby se dostal k paketu a IP adresám
• Přesune paket na vrstvu 3, síťovou
• Ve vrstvě 3, síťové, rozhodne podle IP adresy, kam paket poslat
• Znovu zabalí paket do framu, na něj napíše MAC adresu dalšího
zařízení (např. směrovač nebo počítač) a vyšle frame jako tok
zakódovaných bitů
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
18
Router as a Computer
Na koncových počítačích se
ve vrstvách 7, 6, 5, 4 data
zpracují, poskládají, zobrazí.
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
19
Router as a Computer
Na směrovačích po trase se pracuje s bity na vrstvě 1 –
fyzické, s framy a MAC adresami na vrstvě 2 - datové, s
pakety a IP adresami na vrstvě 3 – síťové.
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
20
Configure Devices and Apply Addresses
Basic Addressing Schemes
Při návrhu nové nebo kontrole staré sítě je potřebná tato
dokumentace:
 Výkres topologie, ze kterého je jasné fyzické propojení
 Tabulka adres s těmito informacemi:
 Device name
 Interfaces used
 IP addresses
 Default gateway
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
21
Configure Devices and Apply Addresses
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
22
Configure Devices and Apply Addresses
 Basic Router Configuration
 Základní konfigurace směrovače má obsahovat:
• Router name
• Passwords
• Interface configurations
• Interface type
• IP address and subnet mask
• Odvypnout: no shutdown
• Na sériovém DCE rozhraní nastavit hodiny: clock rate ....
 Po dokončení konfigurace:
• Verify
• Save
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
23
Configure Devices and Apply Addresses
„Uživatelský“ mód, ve kterém
skoro nic nemůžeme dělat
Po zadání příkazu „enable“ a
hesla se dostaneme do
privilegovaného módu, ve
kterém můžeme router
ovládat
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
24
Configure Devices and Apply Addresses
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
25
Configure Devices and Apply Addresses
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
26
Configure Devices and Apply Addresses
 Verify Basic Router Configuration
Save the router configuration:copy running-config startup-config
Zkrácené verze příkazů: copy run start
Verify router configuration:
 Show running-config – configuration in RAM
 sh run
 Show startup-config - configuration file NVRAM
 sh start
 Show IP route - routing table
 Show interfaces - all interface configurations
 Show IP int brief - abbreviated interface configuration
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
27
Routing Table Structure
 Routing Table = směrovací tabulka je uložena v RAM a
obsahuje informace:
 Directly connected networks
 Remotely connected networks
 Detailed information about the networks
 source of information
 network address & subnet mask
 IP address of next-hop router
 Zobrazení obsahu tabulky: show ip route
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
28
Routing Table Structure
 Adding a connected network to the routing table
-Router interfaces
Each router interface is a member of a different network
Activated using the no shutdown command
You must have directly connected networks
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
29
Routing Table Structure
 Adding a connected network to the routing table
 Každé rozhraní směrovače musí patřit do jiné sítě
 Každé rozhraní se musí aktivovat příkazem no shutdown
 Musí být definovány přímo připojené sítě, jinak nic nebude
fungovat
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
30
Routing Table Structure
 Static routes
Include:
• network address and subnet mask
• IP address of next hop router or exit interface
 When to use static routes
• When network only consists of a few routers
• Network is connected to internet only through one ISP
• Hub & spoke topology is used on a large network
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
31
Routing Table Structure
 Static routes
Obsahují:
• adresu vzdálené sítě a její masku
• cestu do té sítě, tj. IP adresu následujícího směrovače nebo
jméno našeho rozhraní, přes které se tam dostaneme
 Kdy použít statické cesty
• Když je síť jednoduchá a má jen pár směrovačů
• Síť je připojena k internetu přes jediného ISP
• Používá se topologie Hub & spoke, tj. čep a loukotě neboli
hvězda se středem a paprsky
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
32
Routing Table Structure
 Connected and Static routes
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
33
Routing Table Structure
 Dynamic routing protocols are used to
• add remote networks to a routing table
• discover networks
• update and maintain routing tables
 Dynamické směrovací protokoly se používají k
• přidání vzdálených sítí do směrovací tabulky
• objevování nových sítí
• aktualizaci a údržbě směrovacích tabulek
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
34
Routing Table Structure
 IP routing protocols
• RIP
• IGRP
• EIGRP
• OSPF
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
35
Routing Table Structure
 3 Routing Table Principles
 Every router makes its decisions alone, based on the
information it has in its routing table.
 Different routing tables may contain different information

A routing table can tell how to get to a destination but not how
to get back
 3 hlavní zásady pro směrování
 Každý směrovač činí svoje rozhodnutí sám na základě informací ve
své směrovací tabulce.
 Směrovací tabulky různých směrovačů obsahují rozdílné informace
 Směrovací tabulka umí říci cestu tam, ale ne cestu zpátky
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
36
Routing Table Structure
 Effects of the 3 Routing Table Principles
•
Packets are forwarded from one router to another, on a hop by
hop basis.
•
Packets can take path “X” to a destination but return via path
“Y” (Asymmetric routing).
 Důsledky tří hlavních zásad
ITE PC v4.0
Chapter 1
•
Pakety jsou směrovány od jednoho směrovače ke druhému,
skok za skokem.
•
Pakety mohou jít „tam“ jednou cestou, zpátky jinou
(asymetrické směrování).
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
37
Router Paths and Packet Switching
 Internet Protocol (IP) packet contains information about
the packet and the sending and receiving hosts
 Importent fields of a packet:
• Destination IP address
• Source IP address
• Version & TTL
• IP header length
• Packet length
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
38
Router Paths and Packet Switching
 Internet Protocol (IP) paket nese informaci o sobě a o
vysílací a cílové straně.
 Důležitá pole paketu:
• Cílová IP adresa
• Zdrojová IP adresa
• Verze, TTL
• Délka hlavičky
• Délka paketu
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
39
Router Paths and Packet Switching
 MAC Layer Frame Format
 MAC Frames are also divided into fields. They include:
-Preamble
-Start of frame delimiter
-Destination MAC address
-Source MAC address
-Type/length
-Data and pad
-Frame check sequence
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
40
Router Paths and Packet Switching
 A Metric is a numerical value used by routing protocols help
determine the best path to a destination
–The smaller the metric value the better the path
 2 types of metrics used by routing protocols are:
-Hop count - this is the number of routers a packet must travel
through to get to its destination
-Bandwidth - this is the “speed” of a link also known as the data
capacity of a link
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
41
Router Paths and Packet Switching
 Equal cost metric is a condition where a router has multiple paths
to the same destination that all have the same metric
 To solve this dilemma, a router will use Equal Cost Load
Balancing. This means the router sends packets over the multiple
exit interfaces listed in the routing table.
Do cíle existují dvě
rovnocenné cesty.
Co s tím?
Router vyvažuje
(balancuje) provoz tak,
aby obě cesty byly
stejně zatížené.
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
42
Router Paths and Packet Switching
 Path determination is a process used by a router to pick the best
path to a destination
 One of 3 path determinations results from searching for the best
path
1. Directly connected network
2. Remote network
3. No route determined
Hledání nejlepší cesty má
tři možné výsledky:
1. Přímo připojená síť
2. Vzdálená síť
3. Žádná cesta nenalezena
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
43
Router Paths and Packet Switching
 Switching Function of Router is the process used by a
router to switch a packet from an incoming interface to
an outgoing interface on the same router.
-A packet received by a router will do the following:
1. Strips off layer 2 headers.
2. Examines destination IP address located in Layer 3 header
to find best route to destination.
3. Re-encapsulates layer 3 packet into layer 2 frame.
4. Forwards frame out exit interface.
Dostane frame na jeden interface, a co s ním udělá?
1.
2.
3.
4.
Strhne vrchní obal vrstvy 2 s MAC adresami a zahodí ho.
Podívá se na IP adresu na paketu a najde k ní nejlepší cestu.
Zabalí paket do nového framu s novými MAC adresami.
Pošle frame na správný interface.
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
44
Router Paths and Packet Switching
 As a packet travels from one networking device to another
• The Source and Destination IP addresses NEVER change
• The Source & Destination MAC addresses CHANGE as packet is
forwarded from one router to the next.
• TTL field decrements by one until a value of zero is reached at
which point router discards packet (prevents packets from
endlessly traversing the network)
Při cestě paketu po síti
• Zdrojová a cílová IP adresa se nikdy nemění
• Zdrojová a cílová MAC adresa se přepisuje na každém
routeru
• Hodnota TTL se na každém routeru snižuje o 1. Když
dosáhne nuly, paket se zahodí, aby nekoloval donekonečna.
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
45
Router Paths and Packet Switching
 Path determination and switching function details
PC1 Wants to send something to PC 2.
Step 1 - PC1 encapsulates packet into a frame. Frame
contains R1’s destination MAC address
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
46
Router Paths and Packet Switching
Step 2 - R1 receives Ethernet frame.







ITE PC v4.0
Chapter 1
R1 sees that destination MAC address matches its own MAC.
R1 strips off Ethernet frame.
R1 Examines destination IP.
R1 consults routing table looking for destination IP.
After finding destination IP in routing table, R1 now looks up
next hop IP address.
R1 re-encapsulates IP packet with a new Ethernet frame.
R1 forwards Ethernet packet out Fa0/1 interface.
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
47
Router Paths and Packet Switching
Step 3 - Packet arrives at R2
 R2 receives Ethernet frame
 R2 sees that destination MAC address matches its own MAC
 R2 then strips off Ethernet frame
 R2 Examines destination IP
 R2 consults routing table looking for destination IP
 After finding destination IP in routing table, R2 now looks up next
hop IP address
 R2 re-encapsulates IP packet with a new data link frame
 R2 forwards Ethernet packet out S0/0 interface
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
48
Router Paths and Packet Switching
Step 4 - Packet arrives at R3
R3 receives PPP frame
R3 then strips off PPP frame
R3 Examines destination IP
R3 consults routing table looking for destination IP
After finding destination IP in routing table, R3 is directly
connected to destination via its fast Ethernet interface
R3 re-encapsulates IP packet with a new Ethernet frame
R3 forwards Ethernet packet out Fa0/0 interface
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
49
Router Paths and Packet Switching
Step 5 - IP packet arrives at PC2.
Frame is decapsulated & processed by upper layer protocols.
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
50
Summary
 Routers are computers that specialize in routing data over a network.
 Routers are composed of:
-Hardware i.e. CPU, Memory, System bus, Interfaces
-Software used to direct the routing process
 IOS
 Configuration file
 Diagnostic and bootstrap SW in ROM
 Routers need to be configured. Basic configuration consists of:
• Router name
• Password(s)
• Interface configurations i.e. IP address and subnet mask
 Routing tables contain
• Directly connected networks
• Remotely connected networks
• Network addresses and subnet masks
• IP address of next hop address
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
51
Summary
 Routers determine a packet‘s path to its destination by
doing the following
 Receiving an encapsulated frame & examining destination
MAC address.
 If the MAC address matches then Frame is de-encapsulated so
that router can examine the destination IP address.
 If destination IP address is in routing table or there is a static
route then Router determines next hop IP address. Router will
re-encapsulate packet with appropriate layer 2 frame and send
it out to next destination.
 Process continues until packet reaches destination.
 Note - only the MAC addresses will change the source and
destination. IP addresses do not change.
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
52
ITE PC v4.0
Chapter 1
© 2007 Cisco Systems, Inc. All rights reserved.
Cisco Public
53