ppt - Dr. Wissam Fawaz

Download Report

Transcript ppt - Dr. Wissam Fawaz

Chapter 4: Network Layer
Chapter goals:
 understand principles behind network layer
services:
network layer service models
 forwarding versus routing
 how a router works
 routing (path selection)
 dealing with scale
 advanced topics: IPv6, mobility

 instantiation, implementation in the Internet
Network Layer
4-1
Chapter 4: Network Layer
 4. 1 Introduction
 4.2 Virtual circuit and
datagram networks
 4.3 What’s inside a
router
 4.4 IP: Internet
Protocol




Datagram format
IPv4 addressing
ICMP
IPv6
 4.5 Routing algorithms
 Link state
 Distance Vector
 Hierarchical routing
 4.6 Routing in the
Internet



RIP
OSPF
BGP
 4.7 Broadcast and
multicast routing
Network Layer
4-2
Network layer
 transport segment from




sending to receiving host
on sending side
encapsulates segments
into datagrams
on rcving side, delivers
segments to transport
layer
network layer protocols
in every host, router
router examines header
fields in all IP datagrams
passing through it
application
transport
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
network
data link
data link
physical
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
Network Layer
application
transport
network
data link
physical
4-3
Two Key Network-Layer Functions
 forwarding: move
packets from router’s
input to appropriate
router output
 routing: determine
route taken by
packets from source
to dest.

analogy:
 routing: process of
planning trip from
source to dest
 forwarding: process
of getting through
single interchange
routing algorithms
Network Layer
4-4
Interplay between routing and forwarding
routing algorithm
local forwarding table
header value output link
0100
0101
0111
1001
3
2
2
1
value in arriving
packet’s header
0111
1
3 2
Network Layer
4-5
Datagram networks
 no call setup at network layer
 routers: no state about end-to-end connections
 no network-level concept of “connection”
 packets forwarded using destination host address
 packets between same source-dest pair may take
different paths
application
transport
network
data link 1. Send data
physical
application
transport
network
2. Receive data
data link
physical
Network Layer
4-6
Forwarding table
Destination Address Range
4 billion
possible entries
Link Interface
11001000 00010111 00010000 00000000
through
11001000 00010111 00010111 11111111
0
11001000 00010111 00011000 00000000
through
11001000 00010111 00011000 11111111
1
11001000 00010111 00011001 00000000
through
11001000 00010111 00011111 11111111
2
otherwise
3
Network Layer
4-7
Longest prefix matching
Prefix Match
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
Link Interface
0
1
2
3
Examples
DA: 11001000 00010111 00010110 10100001
Which interface?
DA: 11001000 00010111 00011000 10101010
Which interface?
Network Layer
4-8
Chapter 4: Network Layer
 4. 1 Introduction
 4.2 Virtual circuit and
datagram networks
 4.3 What’s inside a
router
 4.4 IP: Internet
Protocol




Datagram format
IPv4 addressing
ICMP
IPv6
 4.5 Routing algorithms
 Link state
 Distance Vector
 Hierarchical routing
 4.6 Routing in the
Internet



RIP
OSPF
BGP
 4.7 Broadcast and
multicast routing
Network Layer
4-9
The IP protocol
The IPv4 (Internet Protocol) header.
Network Layer 4-10
IP protocol: header fields
 Version
 Keeps track of which version of the protocol
• The datagram belongs to (current = 4.0)
 IHL
 Since header is not constant, this field
• Tells how long the header is, in 32-bit words
 Total length: includes both header and data
 Max length = 65 Kbytes
 TTL: is a counter used to limit packet
lifetimes

Prevents packets from wandering aroundNetwork
forever
Layer
4-11
IP protocol: header fields
(cont’d)
 Protocol field
 Tells which transport process to give the
packet to
• TCP is one possibility and so are UDP and others
 Header checksum
 Verifies the header only,
• It must be recomputed at each hop
– Because at least one field always change (TTL field)
 The source address and destination
address

Indicate the destination network and host
Network Layer
numbers
4-12
IP options
 Strict source routing

The datagram is supposed to follow a specific route
 Record route

Allows system managers to track down bugs
• In routing algorithms
Network Layer 4-13
Chapter 4: Network Layer
 4. 1 Introduction
 4.2 Virtual circuit and
datagram networks
 4.3 IP: Internet
Protocol




Datagram format
IPv4 addressing
ICMP
IPv6
 4.5 Routing algorithms
 Link state
 Distance Vector
 Hierarchical routing
 4.6 Routing in the
Internet



RIP
OSPF
BGP
Network Layer 4-14
IP datagram format
IP protocol version
number
header length
(bytes)
“type” of data
max number
remaining hops
(decremented at
each router)
upper layer protocol
to deliver payload to
how much overhead
with TCP?
 20 bytes of TCP
 20 bytes of IP
 = 40 bytes + app
layer overhead
32 bits
head. type of
length
ver
len service
fragment
16-bit identifier flgs
offset
upper
time to
header
layer
live
checksum
total datagram
length (bytes)
for
fragmentation/
reassembly
32 bit source IP address
32 bit destination IP address
Options (if any)
data
(variable length,
typically a TCP
or UDP segment)
E.g. timestamp,
record route
taken, specify
list of routers
to visit.
Network Layer 4-15
IP options
 Strict source routing

The datagram is supposed to follow a specific route
 Record route

Allows system managers to track down bugs
• In routing algorithms
Network Layer 4-16
IP Fragmentation & Reassembly
 network links have MTU
(max.transfer size) - largest
possible link-level frame.
 different link types,
different MTUs
 large IP datagram divided
(“fragmented”) within net
 one datagram becomes
several datagrams
 “reassembled” only at final
destination
 IP header bits used to
identify, order related
fragments
fragmentation:
in: one large datagram
out: 3 smaller datagrams
reassembly
Network Layer 4-17
IP Fragmentation and Reassembly
Example
 4000 byte
datagram
 MTU = 1500 bytes
1480 bytes in
data field
offset =
1480/8
length ID fragflag offset
=4000 =x
=0
=0
One large datagram becomes
several smaller datagrams
length ID fragflag offset
=1500 =x
=1
=0
length ID fragflag offset
=1500 =x
=1
=185
length ID fragflag offset
=1040 =x
=0
=370
Network Layer 4-18
Chapter 4: Network Layer
 4. 1 Introduction
 4.2 Virtual circuit and
datagram networks
 4.3 What’s inside a
router
 4.4 IP: Internet
Protocol




Datagram format
IPv4 addressing
ICMP
IPv6
 4.5 Routing algorithms
 Link state
 Distance Vector
 Hierarchical routing
 4.6 Routing in the
Internet



RIP
OSPF
BGP
 4.7 Broadcast and
multicast routing
Network Layer 4-19
IP Addresses
Network Layer 4-20
Special IP addresses
 The IP address 0.0.0.0
 Is
used by hosts when they are booting
 IP addresses with 0 as network number
Network Layer
 Refer to the current network
4-21
Class A, B, and C networks: default
masks without subnetting
 Routers use a default mask
 To define size of the network and host parts of
address
 Default mask
 is a 32 bit binary number written in dotteddecimal

defines the structure of an IP address
• Identifying the size of the network part of an IP
address
– Class A mask has a default mask of 255.0.0.0
– Class B default mask => 255.255.0.0
Network Layer
– Class C default mask => 255.255.255.0
4-22
A typical campus network
A
E
B
F
C
G
D
H
Network Layer 4-23
Subnets
 Main objective

Allow networks to be split into several parts
(subnets)
• For internal use and still act like a single network to
outside
 Idea

Some bits are taken away from the host number
• To create a subnet number

A third part appears in the middle of the address
Network Layer 4-24
Subnets: example
 The main router uses a subnet mask
 Indicating the split between
• network + subnet and host

The subnet mask in this case
is 255.255.252.0
• alternative notation is /22 indicating a 22 bit long mask

Outside the network, subnetting is not visible
Network Layer
4-25
How IP packets are processed
at a router
 Without subnetting
 Each router has a routing table listing
• Some number of network IP addresses
– Telling how to get to distant networks
• Some number of local host IP addresses
– Telling how to get to local hosts
 With subnetting
 Router table is reduced furthermore
• By creating a three-level hierarchy (network, subnet, and
host)

A router on subnet k
• Knows how to get to all other subnets and to local hosts
• does not have to know details about hosts on other
subnets
Network Layer 4-26
Scaling the IP address for the
Internet
 In the early 1990s

It became apparent that Internet was growing
so fast
• That all IP addresses would be assigned by mid-1990s
– new organizations would be unable to connect to Internet
 Several solutions were developed
 That allowed the Internet to grow
• Without letting us run out of IP addresses
– Classless Interdomain Routing (CIDR)
– Network Address Translation (NAT)
Network Layer 4-27
IP Addressing
 IP address: 32-bit
identifier for host,
router interface
 interface: connection
between host/router
and physical link



router’s typically have
multiple interfaces
host typically has one
interface
IP addresses
associated with each
interface
223.1.1.1
223.1.2.1
223.1.1.2
223.1.1.4
223.1.1.3
223.1.2.9
223.1.3.27
223.1.2.2
223.1.3.2
223.1.3.1
223.1.1.1 = 11011111 00000001 00000001 00000001
223
1
1
1
Network Layer 4-28
Subnets
 IP address:
 subnet part (high
order bits)
 host part (low order
bits)
 What’s a subnet ?
 device interfaces with
same subnet part of IP
address
 can physically reach
each other without
intervening router
223.1.1.1
223.1.2.1
223.1.1.2
223.1.1.4
223.1.1.3
223.1.2.9
223.1.3.27
223.1.2.2
subnet
223.1.3.1
223.1.3.2
network consisting of 3 subnets
Network Layer 4-29
Subnets
Recipe
 To determine the
subnets, detach each
interface from its
host or router,
creating islands of
isolated networks.
Each isolated network
is called a subnet.
223.1.1.0/24
223.1.2.0/24
223.1.3.0/24
Subnet mask: /24
Network Layer 4-30
Subnets
223.1.1.2
How many?
223.1.1.1
223.1.1.4
223.1.1.3
223.1.9.2
223.1.7.0
223.1.9.1
223.1.7.1
223.1.8.1
223.1.8.0
223.1.2.6
223.1.2.1
223.1.3.27
223.1.2.2
223.1.3.1
223.1.3.2
Network Layer 4-31
IP addressing: CIDR
CIDR: Classless InterDomain Routing
subnet portion of address of arbitrary length
 address format: a.b.c.d/x, where x is # bits in
subnet portion of address

subnet
part
host
part
11001000 00010111 00010000 00000000
200.23.16.0/23
Network Layer 4-32
Exercises
 You have a class C network, and you need
to design it for 7 usable subnets with
each subnet handling a minimum of 18
hosts each. Which of the following
network masks should you use?





255.255.224.0
255.255..255.230
255.255.255.224
255.255.255.240
None of the above
Network Layer 4-33
Exercises
 If a host on a network has the address
172.16.210.0/22, what is the address of
the subnetwork to which the host
belongs?





172.16.42.0
172.16.107.0
172.16.208.0
172.16.255.208
172.16.254.0
Network Layer 4-34
IP addresses: how to get one?
Q: How does network get subnet part of IP
addr?
A: gets allocated portion of its provider ISP’s
address space
ISP's block
11001000 00010111 00010000 00000000
200.23.16.0/20
Organization 0
Organization 1
Organization 2
...
11001000 00010111 00010000 00000000
11001000 00010111 00010010 00000000
11001000 00010111 00010100 00000000
…..
….
200.23.16.0/23
200.23.18.0/23
200.23.20.0/23
….
Organization 7
11001000 00010111 00011110 00000000
200.23.30.0/23
Network Layer 4-35
CDR – Classless InterDomain
Routing
A set of IP address assignments.
5-59
Network Layer 4-36
CIDR (ctd)
 Routing tables:

Address
• C: 11000010 00011…
• E: 194.24.00001…
• O: 194.24.0001…
Mask
255.255.11111000.0
255.255.11111100.0
255.255.11110…..
 A packet addressed to 194.24.17.4
 Matches the Oxford base
 A router
 with a single line for all 3 universities =>
• Three entries may be combined: 194.24.0.0/19
Network Layer 4-37
IP addresses: how to get one?
Q: How does a host get IP address?
 hard-coded by system admin in a file
Windows: control-panel->network->configuration>tcp/ip->properties
 UNIX: /etc/rc.config
 DHCP: Dynamic Host Configuration Protocol:
dynamically get address from as server
 “plug-and-play”

Network Layer 4-38