Transcript lecture2

Internetwork:
• Arbitrary collection of possibly heterogeneous
networks interconnected to provide host-to-host
packet delivery service.
• Network: Directly connected or switched network
that uses a single technology (i.e. ATM, 802.5,
Ethernet).
– Could be many physical networks creating a single
logical network.
Spring 2002
CS 332
1
Internetwork
• Internet—THE internetwork.
– Runs the Internet Protocol (Kahn-Cerf)
– Interesting because it has faced the problems of scale
• Internet—abstract internetwork
Spring 2002
CS 332
2
IP Internet
• Concatenation of Networks
Network 1 (Ethernet)
H7
H2
H1
R3
H8
H3
Network 4
(point-to-point)
Network 2 (Ethernet)
R1
R2
H4
• Protocol Stack
Network 3 (FDDI)
H5
H6
H1
H8
TCP
R1
IP
IP
ETH
Spring 2002
R2
ETH
R3
IP
FDDI
FDDI
IP
PPP
CS 332
PPP
TCP
IP
ETH
ETH
3
Assumptions
• Data pipe from every machine to every other
machine.
– Need not be single link (and in most cases will involve
several links and several networks).
– Pipe can lose or corrupt messages (think postal system
analogy – vast majority of time it arrives, but not
always).
• So what info do we need to build a single
“logical” network (either reliable or unreliable)?
Spring 2002
CS 332
4
Internetworking
Outline
Best Effort Service Model
Global Addressing Scheme
Spring 2002
CS 332
5
Service Model
• Connectionless (datagram-based)
– So each packet must be “self-contained”
• Best-effort delivery (unreliable service)
–
–
–
–
packets are lost
packets are delivered out of order
duplicate copies of a packet are delivered (?!)
packets can be delayed for a long time
Spring 2002
CS 332
6
Service Model
• Why unreliable?
– Make service model undemanding enough so that any physical
network could support service model
– Best-effort over reliable network is fine, but reliable service over
an unreliable network means lots of extra functionality for routers
– IP design goal: keep routers simple
• Datagram format
0
4
Version
8
HLen
16
TOS
31
Length
Ident
TTL
19
Flags
Protocol
Offset
Checksum
SourceAddr
DestinationAddr
Options (variable)
Pad
(variable)
Data
Spring 2002
CS 332
7
Fragmentation and Reassembly
• Each network has some MTU (why?)
– Why not some uniform standard?
– What is a reasonable choice for a given host?
• Strategy
–
–
–
–
–
–
fragment when necessary (MTU < Datagram)
try to avoid fragmentation at source host
re-fragmentation is possible
fragments are self-contained datagrams
delay reassembly until destination host
do not recover from lost fragments
Spring 2002
CS 332
8
Example
Start of header
Ident= x
0
Offset= 0
Rest of header
1400 data bytes
Start of header
Ident= x
H1
R1
R2
R3
H8
1
Offset= 0
Rest of header
512 data bytes
Start of header
ETH IP (1400)
FDDI IP (1400)
PPP IP (512)
ETH IP (512)
PPP IP (512)
ETH IP (512)
Rest of header
PPP IP (376)
ETH IP (376)
512 data bytes
Ident= x
1 Offset= 512
Start of header
Ident= x
0 Offset= 1024
Rest of header
376 data bytes
Spring 2002
CS 332
9
Global Addresses
• Properties
– globally unique (don’t want anyone with my phone #)
– hierarchical: network + host (really interface)
• Dot Notation
– 10.3.2.4
– 128.96.33.81
– 192.12.69.77
A:
B:
C:
Spring 2002
0
7
24
Network
Host
1 0
1 1 0
CS 332
14
16
Network
Host
21
8
Network
Host
10
Terminology
•
•
Routing Mechanism: How a router selects the
link over which to forward a packet
Routing Protocol: Policies that determine what is
placed in the routing tables.
These are not the same thing!
Spring 2002
CS 332
11
Datagram Forwarding
• Strategy
– every datagram contains destination’s address
– if directly connected to destination network, then forward
to host
– if not directly connected to destination network, then
forward to some router
– forwarding table maps network number into next hop
– each host has a default router
– each router maintains a forwarding table
• Example (R2)
Spring 2002
Network Number
1
2
3
4
CS 332
Next Hop
R3
R1
interface 1
interface 0
12
Recall:
Network 1 (Ethernet)
H7
H2
H1
R3
H8
H3
Network 4
(point-to-point)
Network 2 (Ethernet)
R1
R2
H4
Network 3 (FDDI)
H5
Spring 2002
H6
CS 332
13
Pseudocode
if (networknum dest = networknum my interface)
deliver packet over that interface
else
if (networknum in my routing table)
deliver packet to next hop router
else
deliver packet to default router
Spring 2002
CS 332
14
Address Translation
• Map IP addresses into physical addresses
– destination host
– next hop router
• Techniques
– encode physical address in host part of IP address
– table-based
• ARP
–
–
–
–
table of IP to physical address bindings
broadcast request if IP address not in table
target machine responds with its physical address
table entries are discarded if not refreshed
Spring 2002
CS 332
15
ARP Details
• Request Format
–
–
–
–
–
HardwareType: type of physical network (e.g., Ethernet)
ProtocolType: type of higher layer protocol (e.g., IP)
HLEN & PLEN: length of physical and protocol addresses
Operation: request or response
Source/Target-Physical/Protocol addresses
• Notes
–
–
–
–
table entries timeout in about 10 minutes
update table with source when you are the target (why?)
update table if already have an entry
do not refresh table entries upon reference
Spring 2002
CS 332
16
ARP Packet Format
0
8
16
Hardware type = 1
HLen = 48
31
ProtocolT ype = 0x0800
PLen = 32
Operation
SourceHardwareAddr (bytes 0 – 3)
SourceHardwareAddr (bytes 4 – 5) SourceProtocolAddr (bytes 0 – 1)
SourceProtocolAddr (bytes 2 – 3) TargetHardwareAddr (bytes 0 – 1)
TargetHardwareAddr (bytes 2 – 5)
TargetProtocolAddr (bytes 0 – 3)
Spring 2002
CS 332
17
Dynamic Host Configuration
Protocol (DHCP)
• Manually configuring IP information can be hard
– Large networks (lots of hosts, many of which are
unreachable until configured!)
– Configuration process error prone
• Every host needs correct network number
• No two hosts can have same IP address
• DHCP automates process
– Important aspect of scaling: scaling of network
management!
Spring 2002
CS 332
18
DHCP (continued)
• At least one DHCP server per administrative
domain
– Centralized repository for host configuration info
• Info can be sent to hosts at boot or connection time.
• Can also be used to maintain pool of available addresses
assigned on demand
• Method
– Send DHCPDISCOVER msg to 255.255.255.255.
– Relay agents
Spring 2002
CS 332
19
Internet Control Message Protocol
(ICMP)
•
•
•
•
•
•
•
Echo (ping)
Redirect (from router to source host)
Destination unreachable (protocol, port, or host)
TTL exceeded (so datagrams don’t cycle forever)
Checksum failed
Reassembly failed
Cannot fragment
Spring 2002
CS 332
20
Virtual Private Networks (VPNs)
You read about them!
Spring 2002
CS 332
21