IMT2521 Network administration, Routing basics

advertisement
IMT2521 Network administration,
Routing basics
IMT2521 Network administration, Routing basics
What is a router?
A simple computer
I
Man processor (CPU)
I
RAM
I
Permanent storage (ROM, FLASH, NVRAM)
I
I/O-ports (Ethernet, serial ports, modules)
I
Operating system
I
Configuration
IMT2521 Network administration, Routing basics
What is a router?
A specialized computer
I
I
Ties networks together, LAN, MAN or WAN
Reads and forwards packets between networks
I
I
I
Based on rules deciding the pest path
Statically defined or from routing protocols
Information about where packets ”go”: the routing table
IMT2521 Network administration, Routing basics
The main task of the router
Forwarding of packets.
A and B are in the same network segment through a switch, the
same IP range. Computer C is connected to a different network
segment and IP range.
A and B can communicate without other help, bot for A and B to
be able to talk to computer C, the packets have to be forwarded
from the ”first” network though to the second, where C is located.
This is the task of the router.
IMT2521 Network administration, Routing basics
The components of the router
I
CPU
I
I
RAM
I
I
I
I
I
Runs the operating system, executes instructions.
Contains the running operating system and running
configuration.
Contains the IP routing table.
Contains the ARP/MAC table.
Holds packets that are not fully forwarded (buffer)
ROM
I
Permanent storage, contains diagnose software & bootstrap
IMT2521 Network administration, Routing basics
The components of the router, cont.
I
NVRAM
I
I
FLASH
I
I
Battery backed memory (non-volatile), contains configuration
Re-writable storage, contains the router operating system.
Interfaces:
I
I
I
I
Ethernet, FastEthernet, GigabitEthernet, TenGigabitEthernet
Serial ports
Modules with other types of connections
Management connection (console)
IMT2521 Network administration, Routing basics
The components of the router, diagram.
IMT2521 Network administration, Routing basics
The boot process
The following are standard steps int the boot process of routers.
Actual boot process varies from maker to maker, but these are still
common steps and sequence of the process.
I
POST
I
Bootstrap
I
Locate and load Router OS
I
Locate and load configuration.
If the configuration is not located, a router normally goes to a
”Setup mode”. On Cisco routers you will almost never use the
”Setup-mode”!
IMT2521 Network administration, Routing basics
Different connections
LAN connections, 10, 10/100, 10/100/1000 or faster for Ethernet,
FastEthernet, GigabitEthernet etc.
I
Connects the router to a local network
I
Has Layer 2 addresses (MAC addresses) and are seen as
regular nodes/hosts by the layer 2 ethernet network.
I
Uses ARP for translation between layer 2 and layer 3
addressing.
WAN connections, e.g. PPP, HDLC, Frame Relay over serial links,
optical carriers like SONET/SDH.
I
Connects a router to a dedicated WAN-connection (PPP,
HDLC, SONET) or a packet switched WAN (FrameRelay,
x.25)
I
Does not use MAC addressing in the sense that Ethernet does
on L2
IMT2521 Network administration, Routing basics
Connection naming (Cisco)
All connections on Cisco equipment has names according to
function, and numbering according to physical connection to the
router I/O bus.
I
Ethernet, FastEthernet, GigabitEthernet, TenGigabitEthernet,
TokenRing, Serial
Examples:
I
FastEthernet0/0
First 10/100Mbit Ethernet in the router, on the I/O bus.
I
FastEthernet1/3
Fourth 10/100Mbit Ethernet on an Ethernet add-on module.
I
Serial0/0/0
First serial port on the first UART (serial controller)
Abbrev. e/eth, f/fa, g/gig, s/ser
IMT2521 Network administration, Routing basics
Router management connection
I
The absolute primary interface for management is the
command line
I
I
I
I
I
CLI sessions via Console or remote terminal
I
I
I
I
Requires only a terminal
Low system requirements on both sides
Efficient
Scriptable
Local serial console (RS232)
Telnet
SSHv2
Possible Out-of-band dial-in AUX console
IMT2521 Network administration, Routing basics
Other management options
I
Most boxes: Web-UI
I
Some boxes: Text-based menu system
I
Most boxes: Management application
I
Enterprise: Centralized management
I
Home-brew: Pure SNMP management
IMT2521 Network administration, Routing basics
Connecting to a local console
On most Cisco routers (and switches):
I
Console port is labeled Console (in blue)
I
Uses a DB9 or RJ45 connector
I
RJ45 uses a so-called rollover cable
Standard serial setting:
I
I
I
I
I
I
I
9600 baud (bps)
8 bits data
No parity
One stop bit
No flow control
aka. 9600-8-n-1
IMT2521 Network administration, Routing basics
Cisco router CLI sessions, modes
I
User mode
Router>
I
Privileged (enabled) mode
Router#
I
Configuration mode
Router(config)#
I
Task oriented configuration mode (e.g. interface config)
Router(config-if)#
IMT2521 Network administration, Routing basics
First boot
[... snip ...]
DRAM configuration is 64 bits wide with parity disabled.
191K bytes of NVRAM.
62720K bytes of ATA CompactFlash (Read/Write)
--- System Configuration Dialog --Would you like to enter the initial configuration dialog? [yes/no]: no
Would you like to terminate autoinstall? [yes]: yes
Press RETURN to get started!
NOTE: Answer NO to the startup wizard
IMT2521 Network administration, Routing basics
Standard basic configuration
Things to set as a standard base config:
I
Set a host-name
I
Set a password protecting the configuration
I
Protect the local console with a password
I
Enable and protect the remote management
I
Set a welcoming banner
I
Disable DNS lookups (during initial config)
I
Set up synchronized logging (during initial conf)
IMT2521 Network administration, Routing basics
Standard basic configuration, CLI session
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname ExampleRouter
ExampleRouter(config)#no ip domain-lookup
ExampleRouter(config)#enable secret cisco
ExampleRouter(config)#banner motd "Welcome to the ExampleRouter."
ExampleRouter(config)#line console 0
ExampleRouter(config-line)#password cisco
ExampleRouter(config-line)#login
ExampleRouter(config-line)#logging synchronous
ExampleRouter(config-line)#exit
ExampleRouter(config)#line vty 0 4
ExampleRouter(config-line)#password cisco
ExampleRouter(config-line)#login
ExampleRouter(config-line)#exit
ExampleRouter(config)#end
ExampleRouter#
IMT2521 Network administration, Routing basics
Simple configuration tasks
I
Going from User to Privileged to Config to Interface Config
I
Setting IP addresses
I
Adding descriptions
I
Activating an interface (take it out of shutdown)
I
Set clocking for serial DCE interfaces
I
Showing running configuration
I
Storing configuration to NVRAM
IMT2521 Network administration, Routing basics
Simple configuration tasks, CLI examples
ExampleRouter>enable
Password:
ExampleRouter#
ExampleRouter#configure terminal
Enter configuration commands, one per line.
ExampleRouter(config)#
End with CNTL/Z.
ExampleRouter(config)#interface FastEthernet0/1
ExampleRouter(config-if)#
ExampleRouter(config-if)#ip address 192.168.1.1 255.255.255.0
ExampleRouter(config-if)#description Connected to MainRouter on Fa2/28
ExampleRouter(config-if)#no shutdown
ExampleRouter(config)#interface Serial 0/1/0
ExampleRouter(config-if)#clock rate 64000
IMT2521 Network administration, Routing basics
Simple configuration tasks, more examples
ExampleRouter#show running-config
Building configuration...
[... snip ...]
hostname ExampleRouter
[... snip ...]
enable secret 5 $1$3D.n$4pb7aK74myhI4dl1RzYLx.
interface FastEthernet0/1
description Connected to MainRouter on Fa2/28
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
[... snip ...]
ExampleRouter#
ExampleRouter#copy running-config startup-config
ExampleRouter#write memory
NOTE: DO NOT copy run start or write mem IN THE LAB
Always remember to copy run start in production
IMT2521 Network administration, Routing basics
OSI vs TCP models, reminder.
IMT2521 Network administration, Routing basics
What layers do routers operate on?
Routers operate on the three lower layers of the OSI model.
I
The interfaces receive and send signals on layer 1
I
The router encapsulates and decapsulates layer 2 frames, e.g.
Ethernet, HDLC
I
The router reads and processes packets on layer 3, network
layer
IMT2521 Network administration, Routing basics
What layers do routers operate on (cont)?
The primary task of the router is to make decisions, and perform
packet forwarding or not, based on layer 3 information.
I
The actual receiving occurs via layer 1 and 2, opposite on
transmission/forwarding
A lot of the communication protocols that are part of the router
operations, operate directly on layer 2.
Ex: CDP, HDLC, PPP, LMI, ARP
IMT2521 Network administration, Routing basics
The routing table
As we should have learned, the purpose of the router is to forward/
transfer data packets from one network to another, so the packets
can reach their recipient(s).
The routing table is where how this is accomplished is stored.
I
I
Lookup-table, stored in RAM.
Contains information about routes:
I
I
I
information about which network the route applies to
what interfaces the network is available through
what is the so-called ”next-hop” on the way to the target
IMT2521 Network administration, Routing basics
The routing table contents
I
Directly attached routes
Networks that are connected directly to the router. To reach
these, the packet only requires Layer 2 encapsulation.
I
Static routes
Static routes are defined by a network admin in the
configuration of the router. A static route is a predefined,
non-dynamic path.
I
Dynamic routes.
Learned via one (or more) of the routing protocols we will be
going learning over the up-coming lectures and chapters. All
packets do not need to travel the same path.
IMT2521 Network administration, Routing basics
Path determination
How to find the way to the target.
When a packet is transmitted to the router, the L3 information is
inspected, and the next action is determined by the destination IP:
I
I
I
Directly attached network
The receiver IP address belongs to a directly connected
network. The router will locate the MAC of the receiver via
ARP , and forward the packet onto the segment.
Ether network
The receiver IP is not in a directly attached network, but the
network is known in the routing table. The router will forward
the packet via Layer 2 to the next router.
No route determined
The receiver address of the packet does not match any entries
in the routing table, and the router is unable to deliver it. The
packet is dropped, and commonly a ”ICMP Unreachable”
packet is sent back to the (layer 2) source/sender.
IMT2521 Network administration, Routing basics
Routing protocols
Routing protocols are separated into ”Internal”
and ”External” (or ”edge”) routing protocols
I
IGP, Interior Gateway Protocols, routing in internal
networks.
I
I
I
I
RIP, RIPv2
IGRP, EIGRP
OSPF, IS-IS
EGP, Exterior Gateway Protocol denotes routing protocols
for communication between internal nets, in other words
routing for the Internet.
I
BGP is the accepted standard for EGP-routing today.
CCNA: RIP, RIPv2, EIGRP, OSPF
IMT2521 Network administration, Routing basics
Example topology
IMT2521 Network administration, Routing basics
Directly attached routes, the table
R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
C
C
C
172.16.0.0/24 is subnetted, 2 subnets
172.16.1.0 is directly connected, FastEthernet0/0
172.16.2.0 is directly connected, Serial0/0/0
192.168.1.0/24 is directly connected, Serial0/0/1
IMT2521 Network administration, Routing basics
Directly attached routes in the table
On the previous screen-dump, three lines were indicated with a C.
These were the router’s directly attached networks.
I
I
Local connections
Must satisfy:
I
I
I
Is administratively operational (no shutdown)
Has link (is physically operational with a link on layer 2)
Has an IP address (is operational on layer 3)
All connections that satisfy these criteria will be found in the
routing table, and will be prefixed/indicated with a ”C”.
IMT2521 Network administration, Routing basics
About Directly attached routes
As Router 2 (R2) in the topology has entries in the routing table
for the directly attached, operational networks, R2 is able to:
I
Communicate directly with nodes in the networks
172.16.1.0/24, 172.16.2.0/24, 192.168.1.0/24
I
Forward packets between these networks.
Without any further configuration, the routers cannot
communicate with any other networks. If the router is unable to
communicate with a network, item follows that packets cannot be
forwarded to that network.
I
R2, and thereby the network 172.16.1.0/24, knows nothing
about:
I
I
172.16.3.0/24
192.168.2.0/24
IMT2521 Network administration, Routing basics
Example topology (again)
IMT2521 Network administration, Routing basics
How to get to a different network?
When a router is configured with nothing apart from IP addresses
on its interfaces, the routing table will contain only information
about directly attached networks.
As mentioned, the routing table can contain three primary types of
information
I
Directly attached routes
I
Static routes
I
Dynamic routes
Dynamic routes will take up a large portion of the semester, but
first: Static routes!
IMT2521 Network administration, Routing basics
Static routing: Syntax
On Cisco routers, the command ip route is used to define static
routes. The command has a lot of options, but we are only
interested in a subset, and the following syntax:
ip route network-address subnet-mask { ip-address | exit-interface }
IMT2521 Network administration, Routing basics
Static route via next hop
The network S3/R3 currently only knows two nets: 192.168.2.0/24
and 192.168.1.0/24. To reach anything else, we must help it with
some routing entries.
I
To reach 172.16.1.0/24, 172.16.2.0/24 or 172.16.3.0/24,
the traffic must travel via R2.
I
R3 knows about the network R2 is reachable via
I
We know the IP address of R2, and can tell R3 about it.
So, next-hop for R3’s traffic out is the address 192.168.1.2.
R3(config)# ip route 172.16.1.0 255.255.255.0 192.168.1.2
R3(config)# ip route 172.16.2.0 255.255.255.0 192.168.1.2
R3(config)# ip route 172.16.3.0 255.255.255.0 192.168.1.2
IMT2521 Network administration, Routing basics
Core routing principle
I
”Every router makes its decision alone, based on the
information it has in its own routing table.”
I
”The fact that one router has certain information in its
routing table does not mean that other routers have the same
information.”
I
”Routing information about a path from one network to
another does not provide routing information about the
reverse, or return path. ”
IMT2521 Network administration, Routing basics
Static route, Exit interface
I
The net S3/R3 is now able to send traffic to 172.16.1.0/24,
172.16.2.0/24 og 172.16.3.0/24, in addition to its own
directly attached.
I
But R2 does not know how to send packets to the network
192.168.2.0/24, and knows nothing about the net
172.16.3.0/24.
I
We add static routes for the nets R2 does not know about.
This time, in stead of using the address of the next hop, we
tell R2 which interface to use to forward the packets!
R2(config)# ip route 172.16.3.0 255.255.255.0 Serial0/0/0
R2(config)# ip route 192.168.2.0 255.255.255.0 Serial0/0/1
This method is ONLY to be used when there is no ambiguity about what is on the
other end of the link. Possible uses: Point-to-point links, or links with
two-host-addressing (/31, /30 nets).
IMT2521 Network administration, Routing basics
Static route, all-zeroes
A network that only has one path towards the rest of the ”world”
is called a ”stubby network”. A stubby network can be configured
with the simplest static route available:
I
All Zeroes
I
Network address: 0.0.0.0
I
Network mask: 0.0.0.0
I
CIDR notation: 0.0.0.0/0
All-zeroes is a way of saying ”All IP-addresses in all networks”.
With that definition, an All-zeroes route tells the router ”send all
traffic not destined for a directly attached net this way.”
IMT2521 Network administration, Routing basics
Example topology (one last time)
IMT2521 Network administration, Routing basics
Using the all-zeroes static route
To the network S1/R1 in the example topology, there exists only
one path to the other networks, via Serial0/0/0. In the other en of
the serial link we find R2, with the address 172.16.2.2.
ip route 0.0.0.0 0.0.0.0 Serial0/0/0
To use the next-hop version of the same configuration:
ip route 0.0.0.0 0.0.0.0 172.16.2.2
IMT2521 Network administration, Routing basics
R1#show ip route
[snip]
172.16.0.0/24 is subnetted, 2 subnets
C
172.16.2.0 is directly connected, Serial0/0/0
C
172.16.3.0 is directly connected, FastEthernet0/0
S*
0.0.0.0/0 [1/0] via 172.16.2.2
R2#show ip route
[snip]
172.16.0.0/24 is subnetted, 2 subnets
C
172.16.1.0 is directly connected, FastEthernet0/0
C
172.16.2.0 is directly connected, Serial0/0/0
S
172.16.3.0 is directly connected, Serial0/0/0
C
192.168.1.0 is directly connected, Serial0/0/1
S
192.168.1.0 is directly connected, Serial0/0/1
R3#show ip route
[snip]
172.16.0.0/24 is subnetted, 2 subnets
S
172.16.1.0 [1/0] via 192.168.1.2
S
172.16.2.0 [1/0] via 192.168.1.2
S
172.16.3.0 [1/0] via 192.168.1.2
C
192.168.1.0 is directly connected, Serial0/0/1
C
192.168.1.0 is directly connected, FastEthernet0/0
IMT2521 Network administration, Routing basics
Recursive lookup
I
I
I
When a packet arrives at the router, a look-up in the routing
table is made.
If there is a match, the exit information is read.
If the exit information is not an interface, a new lookup is
performed.
I
I
I
the next-hop address is checked against the routing table
If the next-hop matches a route in the table, the exit
information is checked.
If the exit information is an interface, the packet is forwarded
out this.
R3#show ip route
[snip]
172.16.0.0/24 is subnetted, 2 subnets
S
172.16.1.0 [1/0] via 192.168.1.2
S
172.16.2.0 [1/0] via 192.168.1.2
S
172.16.3.0 [1/0] via 192.168.1.2
C
192.168.1.0 is directly connected, Serial0/0/1
C
192.168.1.0 is directly connected, FastEthernet0/0
<- 1
<- 2
IMT2521 Network administration, Routing basics
Summarizations
We have already seen an example of routing table summarization:
ip route 0.0.0.0 0.0.0.0 Serial0/0/0
Summarizations are used in routing tables, using standard
sub/supernet calculations with VLSM and CIDR, and groups small
nets to larger logical ranges.
IMT2521 Network administration, Routing basics
Summarization, example
Remember the routing commands from R3:
R3(config)# ip route 172.16.1.0 255.255.255.0 192.168.1.2
R3(config)# ip route 172.16.2.0 255.255.255.0 192.168.1.2
R3(config)# ip route 172.16.3.0 255.255.255.0 192.168.1.2
Doing a bit of ”loose handed” calculations:
172.16.0.0/24 + 172.16.1.0/24− > 172.16.0.0/23
172.16.2.0/24 + 172.16.3.0/24− > 172.16.2.0/23
172.16.0.0/23 + 172.16.2.0/23− > 172.16.0.0/22
The following routing command does this summarization:
R3(config)# ip route 172.16.0.0 255.255.252.0 192.168.1.2
IMT2521 Network administration, Routing basics
Longest Match
Entries in the routing table are selected from the principle
Longest Match
172.16.1.0/24 -> 10101100 . 00010000 . 00000001 . ________
172.16.0.0/22 -> 10101100 . 00010000 . 000000__ . ________
Here, the nets 172.16.1.0/24 & 172.16.0.0/22 are shown in binary,
and ”irrelevant” numbers are represented by .
A lookup for 172.16.1.12 will hit both the lines as candidates, but
as the first (172.16.1.0/24) has more bits matching, this is what
will be called the longest match, and is the one that will be chosen.
IMT2521 Network administration, Routing basics
Longest Match, default route
Looking at the routing entries of R1, and include the directly
attached networks:
172.16.2.0/24 -> 10101100 . 00010000 . 00000010 . ________
172.16.3.0/24 -> 10101100 . 00010000 . 00000011 . ________
0.0.0.0/0
-> ________ . ________ . ________ . ________
Here, it is the Longest Match that tells R1 to deliver packets
correctly to the networks 172.16.2.0/24 and 172.16.3.0/24, even
though we have told R1 to ”Send all traffic out the interface
Serial0/0/0”
Longest Match is also called the Most Specific Match
IMT2521 Network administration, Routing basics
Deleting routes
On R3 we saw that we could replace three entries using
summarization. To do this, we first have to remove the old routes,
before we add the new entry.
To remove a route, we must use the ”no” negation command,
followed by exactly the entries found in the running configuration.
R3(config)# no ip route 172.16.1.0 255.255.255.0 192.168.1.2
R3(config)# no ip route 172.16.2.0 255.255.255.0 192.168.1.2
R3(config)# no ip route 172.16.3.0 255.255.255.0 192.168.1.2
After negation of the routes, the new summarized one is added..
R3(config)# ip route 172.16.0.0 255.255.252.0 192.168.1.2
IMT2521 Network administration, Routing basics
Deleting routes, exactly you say?
As mentioned, we must enter exactly the commands present in the
running configuration after the negation command.
Why? Because in reality, we must remove a configuration entry,
not a routing table entry.
”What if I don’t know what is in the config?”. You should. And
you could read it from the routing table. BUT. You can ”ask”.
From Privileged Exec (not user/config) on IOS 12:
R3# show
ip route
ip route
ip route
R3#
running-config | include
172.16.1.0 255.255.255.0
172.16.2.0 255.255.255.0
172.16.3.0 255.255.255.0
ip route
192.168.1.2
192.168.1.2
192.168.1.2
IMT2521 Network administration, Routing basics
LAB!
We need hands-on experience. Freshing up on basic router
connections and concepts, and the first static routing LAB’s are
MANDATORY.
I
1.5.3/4: Challenge Router configuration
I
2.8.1: Basic static route configuration
I
2.8.2: Challenge Static Route configuration
I
2.8.3: Troubleshooting static routes.
Next topic: Chapters 3 and 4: Intro to dynamic routing, Distance
Vector routing.
IMT2521 Network administration, Routing basics
IMT2521 Network administration, Routing basics
Download