CS 372 – introduction to computer networks* Announcements: Chapter 4

advertisement
CS 372 – introduction to computer networks*
Friday July 16, 2010
Announcements:
 Chapter 4
* Based in part on slides by Bechir Hamdaoui and Paul D. Paulson.
Acknowledgement: slides drawn heavily from Kurose & Ross
Chapter 4, slide: 1
Chapter 4: Network Layer
Chapter goals:
 understand principles behind network layer
services:
network layer service models
 forwarding versus routing
 subnetting and IP addressing
 routing algorithms (path selection)
 advanced topics: IPv6

Chapter 4, slide: 2
Chapter 4: Network Layer
 Introduction
 IP: Internet Protocol
 IPv4 addressing
 NAT
 IPv6
 Routing algorithms
 Link state
 Distance Vector
 Routing in the Internet
 RIP
 OSPF
 BGP
Chapter 4, slide: 3
Network layer
 network layer protocols
run at


end systems &
routers
 Sender side:
 get segments from
transport layer
 encapsulates segments
into IP datagrams
 router examines header
fields in all IP datagrams
 Receiver side:

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
application
transport
network
data link
physical
delivers segments to
transport layer
Chapter 4, slide: 4
Interplay between routing and forwarding
 forwarding
table: a lookup
table for
figuring out
output port for
each input pkt
 routing algorithm:
constructs routing
tables
routing algorithm
local forwarding table
header value output link
0100
0101
0111
1001
 forwarding process:
3
2
2
1
move pkts from input
to output
value in arriving
packet’s header
0111
1
3 2
 routing process: find
Destination
route taken by packets
from source to dest.
Chapter 4, slide: 5
Two Key Network-Layer Functions
Important !!
 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
Chapter 4, slide: 6
Network service model
Q: What services are needed/offered to transport
datagrams from sender to receiver?
Example services for
individual datagrams:
 Reliability

Guaranteed delivery
 End-to-end delay
 guaranteed delivery
within 40 msec delay
Example services for a flow
of datagrams:
 In-order

in-order datagram delivery
 Throughput
 guaranteed minimum
bandwidth to flow
 Jitter delay
 restrictions on changes in
inter-packet spacing
Chapter 4, slide: 7
Network layer: connection and
connection-less services
 Network-layer versus transport-layer services
Transport layer
Network layer
Service
Process to process Host to host
Choice
Reliable (TCP) and
unreliable (UDP)
Implementation Edge (Hosts)
Unreliable only
(Best effort)
Core (routers)
 datagram network provides network-layer
connectionless service
 Virtual Circuit (VC) network provides network-layer
Chapter 4, slide: 8
connection service
Virtual circuits
“source-to-dest path behaves much like telephone
circuit”


performance-wise
network actions along source-to-dest path
 call setup/teardown for each call before data can flow
 VC identifier in each packet (not destination address)
 Maintain state for each VC in every router on the
source-dest. path
 Allocate resources for each VC: bandwidth, buffers in
links, routers involved in the VC
Chapter 4, slide: 9
VC implementation
a VC consists of:
1.
2.
3.
path from source to destination
VC numbers, one number for each link along path
entries in forwarding tables in routers along path
 packet belonging to VC carries VC number
(rather than dest. address)
 VC number can be changed on each link.

New VC number comes from forwarding table
Chapter 4, slide: 10
Forwarding table
VC number
22
12
1
Forwarding table in
northwest router:
Incoming interface
1
2
3
1
…
2
32
3
interface
number
Incoming VC #
12
63
7
97
…
Outgoing interface
3
1
2
3
…
Outgoing VC #
22
18
17
87
…
Routers maintain connection state information!
Chapter 4, slide: 11
Virtual circuits: signaling protocols
 used to setup, maintain teardown VC
 used in ATM, frame-relay, X.25
 not used in today’s Internet
application
transport 5. Data flow begins
network 4. Call connected
data link 1. Initiate call
physical
6. Receive data application
3. Accept call transport
2. incoming call network
data link
physical
Chapter 4, slide: 12
Datagram networks
 no call setup at network layer
 no state about end-to-end connections is kept in
routers

no network-level concept of “connection”
 packets forwarded using dest. host address
 packets (same source-dest pair) may take different paths
application
transport
network
data link 1. Send data
physical
application
transport
2. Receive data network
data link
physical
Chapter 4, slide: 13
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
Chapter 4, slide: 14
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?
Chapter 4, slide: 15
Datagram or VC network: why?
Internet (datagram)
 data exchange among
ATM (VC)
 evolved from telephony
computers
 voice conversation:
 “elastic” service, no strict
 strict timing, reliability
timing req.
requirements
 “smart” end systems
 need for guaranteed
(computers)
service
 can adapt, perform
 “dumb” end systems
control, error recovery
 telephones
 simple inside network,
 complexity inside
complexity at “edge”
network
 many link types
 different characteristics
 uniform service difficult
Chapter 4, slide: 16
Router Architecture:
a little about hardware
Two key router functions:
 run routing algorithms/protocol (OSPF, BGP)
 forwarding datagrams from incoming to outgoing link
Chapter 4, slide: 17
Input Port Functions
Physical layer:
bit-level
reception
Data link layer:
e.g., Ethernet
see chapter 5
Decentralized switching:
 Lookup: given datagram dest., lookup output port
using forwarding table in input port memory
 forward: forward to appropriate output port
 queuing: if datagrams arrive faster than forwarding
rate into switch fabric
Chapter 4, slide: 18
Three types of switching fabrics
Chapter 4, slide: 19
Output Port Functions
 Buffering required when datagrams arrive from
fabric faster than the transmission rate
 Scheduling discipline chooses among queued
datagrams for transmission
Chapter 4, slide: 20
Input Port Queuing
 Fabric slower than input ports combined -> queueing
may occur at input queues
 Head-of-the-Line (HOL) blocking: queued datagram
at front of queue prevents others in queue from
moving forward
 queueing delay and loss due to input buffer overflow!
Chapter 4, slide: 21
Output port queueing
 buffering when arrival rate via switch exceeds
output line speed
 queueing (delay) and loss due to output port
buffer overflow!
Chapter 4, slide: 22
Chapter 4: Network Layer
 Introduction
 IP: Internet Protocol
 IPv4 addressing
 NAT
 IPv6
 Routing algorithms
 Link state
 Distance Vector
 Routing in the Internet
 RIP
 OSPF
 BGP
Chapter 4, slide: 23
The Internet Network layer
Host, router network layer functions:
Transport layer: TCP, UDP
Network
layer
IP protocol
•addressing conventions
•datagram format
•packet handling conventions
Routing protocols
•path selection
•RIP, OSPF, BGP
forwarding
table
ICMP protocol
•error reporting
•router “signaling”
Link layer
physical layer
Chapter 4, slide: 24
The Internet Protocol (IP)
 TCP accepts data, destination (source port,
destination address/port)
Encapsulates data segments, ports, other info
 Gives TCP packet, destination address to IP

 UDP is similar
 IP accepts TCP / UDP packets, destination
address
Encapsulates packets, source address,
destination address, other info
 Provides “best-effort”, host-to-host delivery

 The IP unit is called a datagram
Chapter 4, slide: 25
IP datagram format
IP protocol version
number
header length
(4-byte units)
“type” of data
max number
remaining hops
(decremented at
each router)
upper layer protocol
to deliver payload to
How much overhead
with TCP?
At least:
20 bytes of TCP
20 bytes of IP
= 40 bytes for every
packet
32 bits
type of
ver head.
len service
length
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.
Chapter 4, slide: 26
IP datagram header
 VERS - version of IP (currently 4)
 H. LEN - header length (number of 4-byte units)
 SERVICE TYPE - sender's preference for low latency, high







reliability (rarely used)
TOTAL LENGTH - total octets in datagram
IDENT, FLAGS, FRAGMENT OFFSET - used with fragmentation
(later)
TTL - time to live; decremented in each router; datagram
discarded when TTL = 0
TYPE - type of protocol carried in datagram; e.g., TCP, UDP
HEADER CHECKSUM - 1s complement of sum
SOURCE IP ADDRESS - IP address of original source
DEST IP ADDRESS - IP address of ultimate destination
Chapter 4, slide: 27
IP datagram options
 Added to IP header:
 Record route (e.g., traceroute)
 Source route (e.g., for connection-oriented services)
 Timestamp
 Header with no options has H. LEN field value 5;
TCP/UDP header begins immediately after
DESTINATION IP ADDRESS
 Options added in multiples of 32 bits between
DESTINATION IP ADDRESS and DATA. Padding
added if necessary
 Header with 1 to 32 bits of options has H. LEN field
value 6
Chapter 4, slide: 28
IP Datagram
 Datagrams can have different sizes
Header area usually fixed (20 octets*) but can
have options
 Total length can be between 0 and 65,535
 Usually, data area is much larger than header, but
not even close to maximum size

• Try to balance efficiency and reliability
 TCP/UDP header is part of datagram “data”
 *octet: usually same as byte
 called "octet" in internet protocols for historical
reasons
Chapter 4, slide: 29
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
Chapter 4, slide: 30
IP Fragmentation & Reassembly (ctd)
Example
 4000 byte datagram
= 20 (header) + 3980 (data)
 MTU = 1500 bytes
length ID fragflag offset
=4000 =x
=0
=0
One large datagram becomes
several smaller datagrams
Chapter 4, slide: 31
IP Fragmentation & Reassembly (ctd)
Example
 4000 byte datagram
= 20 (header) + 3980 (data)
 MTU = 1500 bytes
length ID fragflag offset
=4000 =x
=0
=0
One large datagram becomes
several smaller datagrams
1480 bytes in
data field
offset =
1480/8
1040= 20 (header) + 1020 (data)
1020 (data) =3980 – 1480 -1480
length ID fragflag offset
=1500 =x
=1
=0
length ID fragflag offset
=1500 =x
=1
=185
length ID fragflag offset
=1040 =x
=0
=370
Chapter 4, slide: 32
Download