Download Csci5211: Computer Networks

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Wireless security wikipedia , lookup

Dynamic Host Configuration Protocol wikipedia , lookup

Asynchronous Transfer Mode wikipedia , lookup

Peering wikipedia , lookup

IEEE 1355 wikipedia , lookup

Deep packet inspection wikipedia , lookup

AppleTalk wikipedia , lookup

Distributed firewall wikipedia , lookup

Multiprotocol Label Switching wikipedia , lookup

IEEE 802.1aq wikipedia , lookup

Piggybacking (Internet access) wikipedia , lookup

Internet protocol suite wikipedia , lookup

Network tap wikipedia , lookup

List of wireless community networks by region wikipedia , lookup

Computer network wikipedia , lookup

Airborne Networking wikipedia , lookup

Wake-on-LAN wikipedia , lookup

Routing in delay-tolerant networking wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

Zero-configuration networking wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

Transcript
•
•
Switching and Forwarding
Network Layer Part I
Switching and Forwarding
–
–
Generic Router Architecture
Forwarding Tables:
• Bridges/Layer 2 Switches; VLAN
• Routers and Layer 3 Switches
Forwarding in Layer 3 (Network Layer)
– Network Layer Functions
– Network Service Models: VC vs. Datagram
• ATM and IP Datagram Forwarding
– IP Addressing
• Network vs. host: address blocks, longest prefix matching
• Address allocation and DHCP
– IP Datagram Forwarding Model and ARP Protocol
– IP and ICMP Protocols, IP Fragmentation and Re-assembly
Readings: Textbook: Chapter 4: Section 4.1;
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
1
Routing & Forwarding:
Logical View of a Router
5
A
2
1
B
2
D
3
3
1
C
5
1
E
F
2
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
2
IP Addressing: Basics
• Globally unique (for “public” IP addresses)
• IP address: 32-bit identifier for host, router
interface
• Interface: connection between host/router and
physical link
– router’s typically have multiple interfaces
– host may have multiple interfaces
– IP addresses associated with each interface
• Dot notation (for ease of human reading)
223.1.1.1 = 11011111 00000001 00000001 00000001
223
Csci 183/183W/232: Computer
Networks
1
1
Forwarding and Routing
Network Layer Part I
1
3
IP Addressing: Network vs. Host
multi-access
LAN
223.1.1.2
• Two-level hierarchy
– network part (high order
bits)
– host part (low order bits)
• What’s a network ?
(from IP address perspective)
223.1.1.1
223.1.1.4
223.1.1.3
223.1.9.2
– device interfaces with
same network part of IP 223.1.9.1
address
223.1.8.1
– can physically reach each 223.1.2.6
other without intervening
router
223.1.2.1
223.1.2.2
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
223.1.7.0
point-to-point
link
223.1.7.1
223.1.8.0
223.1.3.27
223.1.3.1
223.1.3.2
4
“Classful” IP Addressing
class
77
A
0 network
B
10
C
110
D
1110
15
23
31
host
network
128.0.0.0 to
191.255.255.255
host
network
1.0.0.0 to
127.255.255.255
host
multicast address
192.0.0.0 to
223.255.255.255
224.0.0.0 to
239.255.255.255
32 bits
• Disadvantage: inefficient use of address space; address
space exhaustion
• e.g., class B net allocated enough addresses for 65K
hosts, even if only 2K hosts in that network
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
5
Classless Addressing: CIDR
CIDR: Classless InterDomain Routing
• Network portion of address is of arbitrary length
• Addresses allocated in contiguous blocks
– Number of addresses assigned always power of 2
• Address format: a.b.c.d/x
– x is number of bits in network portion of address
network
part
host
part
11001000 00010111 00010000 00000000
200.23.16.0/23
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
6
Representation of Address Blocks
• “Human Readable” address format: a.b.c.d/x
•
– x is number of bits in network portion of address, the network
portion is also called the network prefix
machine representation of a network (addr block):
using a combination of
– first IP of address blocks of the network
– network mask ( x “1”’s followed by 32-x “0”’s
network w/ address block: 200.23.16.0/23
first IP address of address block:
11001000 00010111 00010000 00000000
network mask:
11111111 11111111 11111110 00000000
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
7
More Examples
Three Address Blocks:
First IP address:
11001000 00010111 00010000 00000000
Network mask:
11111111 11111111 11111000 00000000
First IP address:
11001000 00010111 00011000 00000000
Last IP address:
11001000 00010111 00011000 11111111
what is the network prefix?
11001000 00010111 00011000
First IP address:
11001000 00010111 00011001 00000000
Last IP address:
11001000 00010111 00011111 11111111
what is the network prefix?
11001000 00010111 00011
Csci 183/183W/232: Computer
Networks
Given an IP address, which
network (or address block)
does it belong to?
Example 1:
11001000 00010111 00010110 10100001
Example 2:
11001000 00010111 00011000 10101010
Use longest prefix matching!
Forwarding and Routing
Network Layer Part I
8
Another Example
•
Consider a datagram network using 32-bit host addresses, suppose
a router has four links, numbered 0 through 3, and packets are to
be forwarded to the link interfaces as follows:
Destination Addr Range
Link Interface
11100000 00000000 00000000 00000000
through
11100000 11111111 11111111 11111111
0
11100001 00000000 00000000 00000000
through
11100001 00000000 11111111 11111111
1
11100001 00000001 00000000 00000000
through
11100001 11111111 11111111 11111111
2
O.W.
3
Provide the forwarding table – a table containing the network prefix and
the outgoing interface.
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
9
IP Addresses: How to Get One?
Q: How does host get IP address?
• “static” assigned: i.e., hard-coded in a file
– Wintel: control-panel->network->configuration->tcp/ip>properties
– UNIX: /etc/rc.config
• Dynamically assigned: using DHCP (Dynamic Host
Configuration Protocol)
dynamically get address from a server
– “plug-and-play”
–
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
10
DHCP: Dynamic Host Configuration Protocol
Goal: allow host to dynamically obtain its IP address
from network DHCP server when it joins network
Can renew its lease on address in use
Allows reuse of addresses (only hold address while connected as “on”)
Support for mobile users who want to join network (more shortly)
DHCP overview:
–
–
–
–
host broadcasts “DHCP discover” msg
DHCP server responds with “DHCP offer” msg
host requests IP address: “DHCP request” msg
DHCP server sends address: “DHCP ack” msg
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
11
DHCP Client-Server Scenario
A
223.1.2.1
DHCP
server
223.1.1.1
223.1.1.2
B
223.1.1.4
223.1.2.9
223.1.2.2
223.1.1.3
223.1.3.1
Csci 183/183W/232: Computer
Networks
223.1.3.27
E
223.1.3.2
Forwarding and Routing
Network Layer Part I
arriving DHCP
client needs
address in this
network
12
DHCP Client-Server Scenario
DHCP server: 223.1.2.5
DHCP discover
arriving
client
src : 0.0.0.0, 68
dest.: 255.255.255.255,67
yiaddr: 0.0.0.0
transaction ID: 654
DHCP offer
src: 223.1.2.5, 67
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4
transaction ID: 654
Lifetime: 3600 secs
DHCP request
time
src: 0.0.0.0, 68
dest:: 255.255.255.255, 67
yiaddrr: 223.1.2.4
transaction ID: 655
Lifetime: 3600 secs
DHCP ACK
src: 223.1.2.5, 67
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4
transaction ID: 655
Lifetime: 3600 secs
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
13
IP Addresses: How to Get One? …
Q: How does a network get network part of IP
addr?
A: gets an 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
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
14
IP Addressing: the Last Word...
Q: How does an ISP get block of addresses?
A: ICANN: Internet Corporation for
Assigned Names and Numbers
– allocates addresses
– manages DNS
– assigns domain names, resolves disputes
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
15
NAT: Network Address Translation
rest of
Internet
local network
(e.g., home network)
10.0.0/24
10.0.0.4
10.0.0.1
10.0.0.2
138.76.29.7
10.0.0.3
All datagrams leaving local
network have same single source
NAT IP address: 138.76.29.7,
different source port numbers
Datagrams with source or
destination in this network
have 10.0.0/24 address for
source, destination (as usual)
10.0.0.0/8 has been reserved for private networks!
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
16
NAT: Network Address Translation
• Motivation: local network uses just one IP address as
far as outside world is concerned:
– no need to be allocated range of addresses from ISP: - just one
IP address is used for all devices
– can change addresses of devices in local network without
notifying outside world
– can change ISP without changing addresses of devices in local
network
– devices inside local net not explicitly addressable, visible by
outside world (a security plus).
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
17
NAT: Network Address Translation
Implementation: NAT router must:
– outgoing datagrams: replace (source IP address, port #) of
every outgoing datagram to (NAT IP address, new port #)
. . . remote clients/servers will respond using (NAT IP address,
new port #) as destination addr.
– remember (in NAT translation table) every (source IP address,
port #) to (NAT IP address, new port #) translation pair
– incoming datagrams: replace (NAT IP address, new port #) in
dest fields of every incoming datagram with corresponding
(source IP address, port #) stored in NAT table
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
18
NAT: Network Address Translation
2: NAT router
changes datagram
source addr from
10.0.0.1, 3345 to
138.76.29.7, 5001,
updates table
2
NAT translation table
WAN side addr
LAN side addr
1: host 10.0.0.1
sends datagram to
128.119.40, 80
138.76.29.7, 5001 10.0.0.1, 3345
……
……
S: 10.0.0.1, 3345
D: 128.119.40.186, 80
S: 138.76.29.7, 5001
D: 128.119.40.186, 80
138.76.29.7
S: 128.119.40.186, 80
D: 138.76.29.7, 5001
3: Reply arrives
dest. address:
138.76.29.7, 5001
Csci 183/183W/232: Computer
Networks
3
1
10.0.0.4
S: 128.119.40.186, 80
D: 10.0.0.1, 3345
10.0.0.1
10.0.0.2
4
10.0.0.3
4: NAT router
changes datagram
dest addr from
138.76.29.7, 5001 to 10.0.0.1, 3345
Forwarding and Routing
Network Layer Part I
19
NAT: Network Address Translation
• 16-bit port-number field:
– 60,000 simultaneous connections with a single LAN-side
address!
• NAT is controversial:
– routers should only process up to layer 3
– violates end-to-end argument
• NAT possibility must be taken into account by app
designers, eg, P2P applications
– address shortage should instead be solved by IPv6
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
20
IP Forwarding & IP/ICMP Protocol
Transport layer: TCP, UDP
IP protocol
•addressing conventions
•packet handling conventions
Routing protocols
•path selection
•RIP, OSPF, BGP
Network
layer
routing
table
ICMP protocol
•error reporting
•router “signaling”
Data Link layer (Ethernet, WiFi, PPP, …)
Physical Layer (SONET, …)
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
21
IP Service Model and Datagram Forwarding
• Connectionless (datagram-based)
– Each datagram carries source and destination
• Best-effort delivery (unreliable service)
–
–
–
–
packets may be lost
packets can be delivered out of order
duplicate copies of a packet may be delivered
packets can be delayed for a long time
• Forwarding and IP address
– forwarding based on network id
• Delivers packet to the appropriate network
• Once on destination network, direct delivery using host id
• IP destination-based next-hop forwarding paradigm
– Each host/router has IP forwarding table
• Entries like <network prefix, next-hop, output interface>
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
22
IP Datagram Format
IP protocol version
number
header length
(32-bit words)
“type” of data
max number
remaining hops
(decremented at
each router)
32 bits
ver head. type of
length
len service
fragment
16-bit identifier flgs
offset
upper
time to
Internet
layer
live
checksum
32 bit source IP address
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
Csci 183/183W/232: Computer
Networks
total datagram
length (bytes)
for
fragmentation/
reassembly
32 bit destination IP address
Options (if any)
data
(variable length,
typically a TCP
or UDP segment)
Forwarding and Routing
Network Layer Part I
E.g. timestamp,
record route
taken, specify
list of routers
to visit.
23
IP Datagram Forwarding Model
forwarding table in A
Dest. Net. next router Nhops
223.1.1
223.1.2
223.1.3
IP datagram:
misc source dest
fields IP addr IP addr
data
• datagram remains
unchanged, as it travels
source to destination
• addr fields of interest
here
A
B
223.1.1.1
223.1.1.2
223.1.1.4
223.1.2.1
223.1.2.9
223.1.2.2
223.1.1.3
223.1.3.1
Csci 183/183W/232: Computer
Networks
223.1.1.4
223.1.1.4
1
2
2
Forwarding and Routing
Network Layer Part I
223.1.3.27
E
223.1.3.2
24
IP Forwarding Table
4 billion possible entries!
(in reality, far less, but can still have millions of “routes”)
forwarding table entry format
destination network
(1st IP address , network mask )
next-hop (IP address)
link interface
11001000 00010111 00010000 00000000,
11111111 11111111 11111000 00000000
200.23.16.1
0
11001000 00010111 00011000 00000000,
11111111 11111111 11111111 00000000
- (direct)
1
11001000 00010111 00011001 00000000,
11111111 11111111 11111000 00000000
200.23.25.6
2
128.30.0.1
3
otherwise
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
25
Forwarding Table Lookup
using Longest Prefix Matching
Prefix Match
Next Hop
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
200.23.16.1
200.23.25.6
128.30.0.1
Link Interface
0
1
2
3
Examples
DA: 11001000 00010111 00010110 10100001
Which interface?
DA: 11001000 00010111 00011000 10101010
Which interface?
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
26
IP Forwarding: Destination in Same Net
forwarding table in A
Dest. Net. next router Nhops
misc
data
fields 223.1.1.1 223.1.1.3
Starting at A, send IP
datagram addressed to B:
• look up net. address of B in
forwarding table
• find B is on same net. as A
• link layer will send datagram
directly to B inside link-layer
frame
– B and A are directly connected
Csci 183/183W/232: Computer
Networks
223.1.1
223.1.2
223.1.3
A
B
223.1.1.4
223.1.1.4
1
2
2
223.1.1.1
223.1.1.2
223.1.1.4
223.1.2.1
223.1.2.9
223.1.2.2
223.1.1.3
223.1.3.1
Forwarding and Routing
Network Layer Part I
223.1.3.27
E
223.1.3.2
27
IP Datagram Forwarding on Same LAN:
Interaction of IP and data link layers
Starting at A, given IP
datagram addressed to B:
• look up net. address of B, find B
on same net. as A
• link layer send datagram to B
inside link-layer frame
frame source,
dest address
A
223.1.1.1
223.1.2.1
223.1.1.2
223.1.1.4 223.1.2.9
B
223.1.1.3
223.1.3.27
datagram source, 223.1.3.1
dest address
A’s IP
addr
B’s MAC A’s MAC
addr
addr
B’s IP
addr
223.1.2.2
E
223.1.3.2
IP payload
datagram
frame
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
28
MAC (Physical) Addresses -- Revisited
• used to get frames from one interface to another physicallyconnected interface (same physical network, i.e., p2p or LAN)
• 48 bit MAC address (for most LANs)
– fixed for each adaptor, burned in the adapter ROM
– MAC address allocation administered by IEEE
• 1st bit: 0 unicast, 1 multicast.
• all 1’s : broadcast
• MAC flat address -> portability
– can move LAN card from one LAN to another
• MAC addressing operations on a LAN:
–
–
–
–
–
each adaptor on the LAN “sees” all frames
accept a frame if dest. MAC address matches its own MAC address
accept all broadcast (MAC= all1’s) frames
accept all frames if set in “promiscuous” mode
can configure to accept certain multicast addresses (first bit = 1)
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
29
MAC vs. IP Addresses
32-bit IP address:
• network-layer address, logical
–
i.e., not bound to any physical device, can be re-assigned
• IP hierarchical address NOT portable
– depends on IP network to which an interface is attached
– when move to another IP network, IP address re-assigned
• used to get IP packets to destination IP network
– Recall how IP datagram forwarding is performed
• IP network is “virtual,” actually packet delivery done by the
underlying physical networks
– from source host to destination host, hop-by-hop via IP routers
– over each link, different link layer protocol used, with its own frame
headers, and source and destination MAC addresses
• Underlying physical networks do not understand IP protocol and
datagram format!
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
30
ARP: Address Resolution Protocol
Question: how to determine • Each IP node (host, router)
on LAN has ARP table
MAC address of B
• ARP Table: IP/MAC address
knowing B’s IP address?
mappings for some LAN
nodes
< IP address; MAC address;
timer>
– timer: time after which
address mapping will be
forgotten (typically 15
min)
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
31
ARP Protocol
• A wants to send datagram
to B, and A knows B’s IP
address.
• A looks up B’s MAC address
in its ARP table
• Suppose B’s MAC address
is not in A’s ARP table.
• A broadcasts (why?) ARP
query packet, containing
B's IP address
– all machines on LAN
receive ARP query
Csci 183/183W/232: Computer
Networks
• B receives ARP packet,
replies to A with its (B's)
MAC address
•
– frame sent to A’s MAC
address (unicast)
A caches (saves) IP-to-MAC
address pair in its ARP table
until information becomes old
(times out)
– soft state: information
that times out (goes away)
unless refreshed
• ARP is “plug-and-play”:
– nodes create their ARP
tables without
intervention from net
administrator
Forwarding and Routing
Network Layer Part I
32
ARP Messages
Hardware Address Type: e.g., Ethernet
Protocol address Type: e.g., IP
Operation: ARP request or ARP response
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
33
ARP Request & Response Processing
• The requester broadcasts ARP request
• The target node unicasts (why?) ARP reply to
requester
– With its physical address
– Adds the requester into its ARP table (why?)
• On receiving the response, requester
– updates its table, sets timer
• Other nodes upon receiving the ARP request
– Refresh the requester entry if already there
– No action otherwise (why?)
• Some questions to think about:
– Shall requester buffer IP datagram while performing ARP?
– What shall requester do if never receive any ARP response?
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
34
ARP Operation Illustration
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
35
IP Forwarding: Destination in Diff. Net
misc
data
fields 223.1.1.1 223.1.2.3
forwarding table in A
Dest. Net. next router Nhops
223.1.1
1
223.1.2
223.1.1.4
2
223.1.3
223.1.1.4
2
Starting at A, dest. E:
• look up network address of E
in forwarding table
• E on different network
A
223.1.1.1
– A, E not directly attached
• routing table: next hop
router to E is 223.1.1.4
• link layer sends datagram to
router 223.1.1.4 inside linklayer frame
• datagram arrives at 223.1.1.4
• continued…..
Csci 183/183W/232: Computer
Networks
B
223.1.1.2
223.1.1.4
223.1.1.3
223.1.3.1
Forwarding and Routing
Network Layer Part I
223.1.2.1
223.1.2.9
223.1.2.2
223.1.3.27
223.1.3.2
36
E
IP Forwarding: Destination in Diff. Net …
forwarding table in router
misc
data
fields 223.1.1.1 223.1.2.3
Dest. Net router Nhops interface
Arriving at 223.1.4,
destined for 223.1.2.2
• look up network address of E
in router’s forwarding table
• E on same network as router’s
interface 223.1.2.9
– router, E directly attached
• link layer sends datagram to
223.1.2.2 inside link-layer
frame via interface 223.1.2.9
• datagram arrives at
223.1.2.2!!! (hooray!)
Csci 183/183W/232: Computer
Networks
223.1.1
223.1.2
223.1.3
A
-
1
1
1
223.1.1.4
223.1.2.9
223.1.3.27
223.1.1.1
223.1.2.1
B
223.1.1.2
223.1.1.4
223.1.2.9
223.1.2.2
223.1.1.3
223.1.3.1
Forwarding and Routing
Network Layer Part I
223.1.3.27
E
223.1.3.2
37
Forwarding to Another LAN:
Interaction of IP and Data Link Layer
walkthrough: send datagram from A to B via R
assume A knows B IP address
A
R
•
•
•
B
Two ARP tables in router R, one for each IP network (LAN)
In routing table at source host, find router 111.111.111.110
In ARP table at source, find MAC address E6-E9-00-17-BB-4B, etc
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
38
A
R
B
• A creates datagram with source A, destination B
• A uses ARP to get R’s MAC address for 111.111.111.110
• A creates link-layer frame with R's MAC address as dest,
frame contains A-to-B IP datagram
• A’s data link layer sends frame
• R’s data link layer receives frame
• R removes IP datagram from Ethernet frame, sees its
destined to B
• R uses ARP to get B’s physical layer address
• R creates frame containing A-to-B IP datagram sends to B
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
39
IP Datagram Format Again
IP protocol version
number
header length
(bytes)
“type” of data
max number
remaining hops
(decremented at
each router)
32 bits
ver head. type of
length
len service
fragment
16-bit identifier flgs
offset
upper
time to
Internet
layer
live
checksum
32 bit source IP address
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
Csci 183/183W/232: Computer
Networks
total datagram
length (bytes)
for
fragmentation/
reassembly
32 bit destination IP address
Options (if any)
data
(variable length,
typically a TCP
or UDP segment)
Forwarding and Routing
Network Layer Part I
E.g. timestamp,
record route
taken, specify
list of routers
to visit.
40
Fields in IP Datagram
• IP protocol version: current version is 4, IPv4, new: IPv6
• Header length: number of 32-bit words in the header
• Type of Service:
–
3-bit priority,e.g, delay, throughput, reliability bits, …
• Total length: including header (maximum 65535 bytes)
• Identification: all fragments of a packet have same
identification
• Flags: don’t fragment, more fragments
• Fragment offset: where in the original packet (count in 8
byte units)
• Time to live: maximum life time of a packet
• Protocol Type: e.g., ICMP, TCP, UDP etc
• IP Option: non-default processing, e.g., IP source routing
option, etc.
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
41
IP Fragmentation & Reassembly: Why
• network links have MTU
(maximum transmission
unit) - largest possible data
gram.
– 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
Csci 183/183W/232: Computer
Networks
fragmentation:
in: one large datagram
out: 3 smaller datagrams
reassembly
Forwarding and Routing
Network Layer Part I
42
IP Fragmentation & Reassembly: How
• An IP datagram is chopped by a router into smaller pieces if
– datagram size is greater than network MTU
– Don’t fragment option is not set
• Each datagram has unique datagram identification
– Generated by source hosts
– All fragments of a packet carry original datagram id
• All fragments except the last have more flag set
– Fragment offset and Length fields are modified appropriately
• Fragments of IP packet can be further fragmented by other
routers along the way to destination !
• Reassembly only done at destination host (why?)
– Use IP datagram id, fragment offset, fragment flags. Length
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
43
IP Fragmentation and Reassembly: Exp
Example
• 4000 byte
datagram
• MTU = 1500 bytes
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
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
44
ICMP: Internet Control Message Protocol
• used by hosts, routers,
gateways to communicate
network-level information
– error reporting:
unreachable host,
network, port, protocol
– echo request/reply
(used by ping)
• network-layer “above” IP:
– ICMP msgs carried in IP
datagrams
• ICMP message: type, code
plus first 8 bytes of IP
datagram causing error
Csci 183/183W/232: Computer
Networks
Type
0
3
3
3
3
3
3
4
Code
0
0
1
2
3
6
7
0
8
9
10
11
12
0
0
0
0
0
Forwarding and Routing
Network Layer Part I
description
echo reply (ping)
dest. network unreachable
dest host unreachable
dest protocol unreachable
dest port unreachable
dest network unknown
dest host unknown
source quench (congestion
control - not used)
echo request (ping)
route advertisement
router discovery
TTL expired
bad IP header
45
ICMP Message Transport & Usage
• ICMP messages carried in IP datagrams
• Treated like any other datagrams
– But no error message sent if ICMP message causes error
• Message sent to the source
– 8 bytes of the original header included
• ICMP Usage (non-error, informational): Examples
– Testing reachability: ICMP echo request/reply
• ping
– Tracing route to a destination: Time-to-live field
• traceroute
– Path MTU discovery
• Don’t fragment bit
–
IP direct (for hosts only): inform hosts of better routes
Csci 183/183W/232: Computer
Networks
Forwarding and Routing
Network Layer Part I
46