internet protocol. ip overview service model addressing forwarding (routing later)
TRANSCRIPT
Internet Protocol
IP overview
Service model Addressing Forwarding (Routing later)
Layer reminder
Bridges - emulate single link Everything broadcast Same collision domain
Switches - emulate single network Flat addressing Broadcast supported
Internet - connect multiple networks Hierarchical addressing No broadcast Highly scalable
IP service model
Service provided to transport layer (TCP, UDP) Global name space Host-to-host connectivity (connectionless) Best-effort packet delivery
Not in IP service model Delivery guarantees on bandwidth, delay or loss
Delivery failure modes Packet delayed for a very long time Packet loss Packet delivered more than once Packets delivered out of order
IP comparison with ATM
Network Architecture
Service Model
Guarantees Congestion Feedback
Bandwidth Loss Order Timing
Internet best effort
none no no no no
ATM CBR constant yes yes yes no congestion
ATM VBR guaranteed rate
yes yes yes no congestion
ATM ABR guaranteed minimum
no yes no yes
ATM UBR none no yes no no
IP addressing
Ethernet address space Flat Assigned at manufacture time
IP address space Hierarchical Assigned at configuration time
IP Addressing: introduction
IP address: 32-bit identifier for host, router interface
interface: connection between host/router and physical link routers typically have
multiple interfaces host typically has one
interface IP addresses
associated with each interface
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2223.1.3.1
223.1.3.27
223.1.1.1 = 11011111 00000001 00000001 00000001
223 1 11
IP networks
Address has 2 components Network (high-order
bits) Host (low-order bits)
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2223.1.3.1
223.1.3.27
IPv4 Address Model
Class Network ID Host ID # of Addresses
# of Networks
A 0 + 7 bit 24 bit 224-2 126
B 10 + 14 bit 16 bit 65,536 - 2 214
C 110 + 21 bit 8 bit 256 - 2 221
D 1110 + Multicast Address IP Multicast
E Future Use
0 Network (7 bits)
Network (14 bits)
1 1 0
1 0
Network (21 bits)
Host (24 bits)
Host (16 bits)
Host (8 bits)
Class A:
Class B:
Class C:
IP networks
Class A network: 18.0.0.0 (MIT) www.mit.edu has address 18.7.22.83
Class B network: 128.174.0.0 (UIUC) www.cs.uiuc.edu has address 128.174.252.84
Class C network: 216.125.249.0 (Parkland) www.parkland.edu has address 216.125.249.97
CIDR
3-class model too inflexible CIDR: Classless InterDomain Routing
Arbitrary number of bits to specify network
Address format: a.b.c.d/x, where x is # bits in network portion
11001000 00010111 00010000 00000000
subnetpart
hostpart
200.23.16.0/23
Classless Domains
Internet Archive - 207.241.224.0/20 4K hosts 207.241.224.0 - 207.241.239.255
AT&T - 204.127.128.0/18 16K hosts 204.127.128.0 - 204.127.191.255
UUNET - 63.64.0.0/10 4M hosts 63.64.0.0 - 63.127.255.255
IP forwarding
Forwarding table has: Network number Interface
Avoid having to store 4 billion entries But there are still 2 million class C’s …and perhaps more CIDR networks
Hierarchical Networks
“Send me anythingwith addresses beginning 200.23.16.0/20”
200.23.16.0/23
200.23.18.0/23
200.23.30.0/23
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us “Send me anythingwith addresses beginning 199.31.0.0/16”
200.23.20.0/23Organization 2
...
...
Subnetting
UIUC - 130.126.0.0/16 130.126.0.0 - 130.126.255.255
CRHC - 130.126.136.0/21 130.126.136.0 - 130.126.143.255
EWS - 130.126.160.0/21 130.126.160.0 - 130.126.167.255
Forwarding Tables
130.126.136.0/21 if1130.126.160.0/21 if2130.126.0.0/16 if30.0.0.0/0 if4
Most specific rule is used Most hosts outside of the core have
default rules
CRHC
EWS
UIUC
Internet
if1
if2if4
if3
NAT: Network Address Translation
10.0.0.1
10.0.0.2
10.0.0.3
10.0.0.4
138.76.29.7
local network(e.g., home network)
10.0.0/24
rest ofInternet
Datagrams with source or destination in this network
have 10.0.0/24 address for source, destination (as usual)
All datagrams leaving localnetwork have same single source
NAT IP address: 138.76.29.7,different source port numbers
NAT: Network Address Translation
Motivation: local network uses just one IP address as far as outside world is concerned: range of addresses not needed from ISP: just one IP
address 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).
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
NAT: Network Address Translation
10.0.0.1
10.0.0.2
10.0.0.3
S: 10.0.0.1, 3345D: 128.119.40.186, 80
1
10.0.0.4
138.76.29.7
1: host 10.0.0.1 sends datagram to 128.119.40.186, 80
NAT translation tableWAN side addr LAN side addr
138.76.29.7, 5001 10.0.0.1, 3345…… ……
S: 128.119.40.186, 80 D: 10.0.0.1, 3345 4
S: 138.76.29.7, 5001D: 128.119.40.186, 802
2: NAT routerchanges datagramsource addr from10.0.0.1, 3345 to138.76.29.7, 5001,updates table
S: 128.119.40.186, 80 D: 138.76.29.7, 5001 3
3: Reply arrives dest. address: 138.76.29.7, 5001
4: NAT routerchanges datagramdest addr from138.76.29.7, 5001 to 10.0.0.1, 3345
NAT: Network Address Translation
16-bit port-number field: 60K 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
IPv4 Address Translation support
IP addresses to LAN physical addresses Problem
An IP route can pass through many physical networks
Data must be delivered to destination’s physical network
Hosts only listen for packets marked with physical interface names Each hop along route Destination host
IP to Physical Address Translation
Hard-coded Encode physical address in IP address Ex: Map Ethernet addresses to IP addresses
Makes it impossible to associate address with topology Fixed table
Maintain a central repository and distribute to hosts Bottleneck for queries and updates
Automatically generated table Use ARP to build table at each host Use timeouts to clean up table
ARP
Check table for physical address If address not present
Broadcast a query, include host’s translation Wait for a response
Upon receipt of ARP query/response Targeted host responds with address translation If address already present
Refresh entry and reset timeout If address not present
Add entry for requesting host Ignore for other hosts
Timeout and discard entries after O(10) minutes
ARP Packet
TargetHardwareAddr (bytes 2 – 5)
TargetProtocolAddr (bytes 0 – 3)
SourceProtocolAddr (bytes 2 – 3)
Hardware type = 1 ProtocolType = 0x0800
SourceHardwareAddr (bytes 4 – 5)
TargetHardwareAddr (bytes 0 – 1)
SourceProtocolAddr (bytes 0 – 1)
HLEN = 48 PLEN = 32 Operation
SourceHardwareAddr (bytes 0 – 3)
0 8 16 31
IP Packet Format
Version HLen TOS LengthIdent Flags Offset
TTL Protocol Checksum
SourceAddrDestinationAddr
Options (variable) Pad(variable)
0 4 8 16 19 31
Data
IP Packet Format
4-bit version IPv4 = 4, IPv6 = 6
4-bit header length Counted in words, minimum of 5
8-bit type of service field (TOS) Mostly unused
16-bit data length Counted in bytes
IP Packet Format
Fragmentation support 16-bit packet ID
All fragments from the same packet have the same ID 3-bit flags
1-bit to mark last fragment 13-bit fragment offset into packet
Counted in 8-byte words
8-bit time-to-live field (TTL) Hop count decremented at each router Packet is discard if TTL = 0
IP Packet Format
8-bit protocol field TCP = 6, UDP = 17
16-bit IP checksum on header 32-bit source IP address 32-bit destination IP address Options
Variable size Source-based routing Record route
Padding Fill to 32-bit boundaries
IP Packet Size
Problem Different physical layers provide different
limits on frame length Maximum transmission unit (MTU)
Source host does not know minimum value Especially along dynamic routes
IP Fragmentation and Reassembly
Solution When necessary, split IP packet into
acceptably sized packets prior to sending over physical link
Questions Where should reassembly occur? What happens when a fragment is
damaged/lost?
IP Fragmentation and Reassembly
Fragments are self-contained IP datagrams Reassemble at destination to minimize
refragmentation Drop all fragments in packet if one or more
fragments are lost Avoid fragmentation at source host
Transport layer should send packets small enough to fit into one MTU of local physical network Must consider IP header
Note: MTU in ATM is based on CS-PDU size
IP Fragmentation and Reassembly
ETH IP (1400)
FDDI IP (1400)
PPP IP (376)
PPP IP (512)
PPP IP (512)
ETH IP (376)
ETH IP (512)
ETH IP (512)
Start of headerIdent = x 0 Offset 0
Rest of header
1400 data bytes
Start of headerIdent = x 1 Offset 0
Rest of header
512 data bytes
Start of headerIdent = x 1 Offset 512
Rest of header
512 data bytes
Start of headerIdent = x 0 Offset 1024
Rest of header
376 data bytes
H1 R1 R2 R3 H2
ETH FDDI PPP ETH
Internet Control Message Protocol (ICMP)
IP companion protocol Handles error and control messages
ModemATMFDDIEthernet
FTP TFTPNVHTTP
TCP UDP
IP ICMP
ICMP
Error Messages Host unreachable Reassembly failed IP checksum failed TTL exceeded (packet dropped) Invalid header
Control Messages Echo/ping request and reply Echo/ping request and reply with timestamps Route redirect
Traceroute and ICMP
Source sends series of UDP segments to dest
First has TTL =1 Second has TTL=2, etc. Unlikely port number
When nth datagram arrives to nth router:
Router discards datagram And sends to source an
ICMP message (type 11, code 0)
Message includes name of router& IP address
When ICMP message arrives, source calculates RTT
Traceroute does this 3 times
Stopping criterion UDP segment eventually
arrives at destination host Destination returns ICMP
“host unreachable” packet (type 3, code 3)
When source gets this ICMP, stops.
Host Configuration
Plug new host into network How much information must be known? What new information must be assigned? How can process be automated?
Some answers Host needs an IP address (must know it) Host must also
Send packets out of physical (direct) network Thus needs physical address of router
Host Configuration
Reverse Address Resolution Protocol (RARP) Translate physical address to IP address Used to boot diskless hosts Host broadcasts request to boot RARP server tells host the host’s own IP address
Boot protocol (BOOTP) Use UDP packets for same purpose as RARP Allows boot requests to traverse routers IP address of BOOTP server must be known Also returns file server IP, subnet mask, and default router
for host
Dynamic Host Configuration Protocol (DHCP)
A simple way to automate configuration information Network administrator does not need to
enter host IP address by hand Good for large and/or dynamic networks
Dynamic Host Configuration Protocol (DHCP)
New machine sends request to DHCP server for assignment and information
Server receives Directly if new machine given server’s IP address Through broadcast if on same physical network Via DHCP relay nodes that forward requests onto the server’s
physical network Server assigns IP address and provides other info Can be made secure (present signed request or just a “valid”
physical address)
DHCP
DHCP Server
Host AHost A
broadcasts DHCPDISCOVER
messageHost A
broadcasts DHCP request
Host B
DHCP Server
DHCP Relay
Other Networks
Other Networks
Relay unicasts DHCP request
to serverServer
responds with host’s IP address