Network Layer Addressing
Instructor: Anirban Mahanti
Office: ICT 745
Email:
[email protected]Class Location: ICT 121
Lectures: MWF 12:00 – 12:50
Notes derived from “Computer Networking: A Top
Down Approach Featuring the Internet”, 2005, 3rd
edition, Jim Kurose, Keith Ross, Addison-Wesley.
Slides are adapted from the companion web site of the book,
as modified by Anirban Mahanti (and Carey Williamson).
N/W Layer Addressing 1
Network layer
transport segment from
sending to receiving host application
transport
on sending side
network
data link network
physical
encapsulates segments
network data link network
data link physical data link
physical physical
into datagrams network
data link
on rcving side, delivers physical network
data link
segments to transport network
physical
layer network
data link
data link
physical
physical
network layer protocols network
data link application
in every host, router physical transport
network
data link
Router examines header physical
fields in all IP datagrams
passing through it
N/W Layer Addressing 2
Key Network-Layer Functions
forwarding: move packets from router’s input
to appropriate router output
routing: determine the path taken by packets
as they flow from a sender to a receiver
Routing algorithms – run at routers to determine
“paths”;
Routers have a forwarding table
• Destination address-based in Datagram networks
• Virtual circuit number-based in VC Networks
N/W Layer Addressing 3
1
Interplay between routing and forwarding
routing algorithm
local forwarding table
header value output link
0100 3
0101 2
0111 2
1001 1
value in arriving
packet’s header
0111 1
3 2
N/W Layer Addressing 4
The Internet Protocol (IP)
N/W Layer Addressing 5
What does the Network layer consist of?
Host, router network layer functions:
Transport layer: TCP, UDP
Routing protocols IP protocol
•path selection •addressing conventions
•RIP, OSPF, BGP •datagram format
Network •packet handling conventions
layer forwarding
ICMP protocol
table
•error reporting
•router “signaling”
Link layer
physical layer
N/W Layer Addressing 6
2
IP datagram format
IP protocol version 32 bits
number total datagram
header length length (bytes)
ver head. type of length
(bytes) len service for
“type” of data fragment fragmentation/
16-bit identifier flgs
offset reassembly
max number time to upper Internet
remaining hops live layer checksum
(decremented at
32 bit source IP address
each router)
32 bit destination IP address
upper layer protocol
to deliver payload to Options (if any) E.g. timestamp,
record route
how much overhead data taken, specify
with TCP? (variable length, list of routers
20 bytes of TCP typically a TCP to visit.
or UDP segment)
20 bytes of IP
= 40 bytes + app
layer overhead
N/W Layer Addressing 7
IP Fragmentation & Reassembly
network links have MTU
(max.transfer size) - largest
possible link-level frame.
different link types, fragmentation:
different MTUs in: one large datagram
large IP datagram divided out: 3 smaller datagrams
(“fragmented”) within net
one datagram becomes
several datagrams
reassembly
“reassembled” only at final
destination
IP header bits used to
identify, order related
fragments
N/W Layer Addressing 8
IP Fragmentation and Reassembly
length ID fragflag offset
Example =4000 =x =0 =0
4000 byte
One large datagram becomes
datagram several smaller datagrams
MTU = 1500 bytes
length ID fragflag offset
=1500 =x =1 =0
1480 bytes in
data field length ID fragflag offset
=1500 =x =1 =185
offset =
1480/8 length ID fragflag offset
=1040 =x =0 =370
N/W Layer Addressing 9
3
IPv4 Addressing
IP address: 32-bit 223.1.1.1
identifier for host, 223.1.2.1
router interface
223.1.1.2
223.1.1.4 223.1.2.9
interface: connection
223.1.2.2
between host/router 223.1.1.3 223.1.3.27
and physical link
router’s typically have
multiple interfaces 223.1.3.1 223.1.3.2
host may have multiple
interfaces
IP addresses
associated with each 223.1.1.1 = 11011111 00000001 00000001 00000001
interface
223 1 1 1
N/W Layer Addressing 10
Classful Addressing
Network
Addresses consists of: 0 (7 bits) Host (24 bits)
Network part
Class A
Host part
IP addresses divided into five
classes: A, B, C, D, and E. 1 0
Network Host
(14 bits) (16bits)
Problems ??
Class B
Network Host
110 1110 Multicast address
(21 bits) (8bits)
Class C Class D
1111 Future use addresses
Class E
N/W Layer Addressing 11
Subnets: Motivation
The “classful” addressing scheme proposes
that the network portion of a IP address
uniquely identifies one physical network.
Any network with more than 255 hosts needs a
class B address. Class B addresses can get
exhausted before we have 4 billion hosts!
Take bits from the host number part to
create a “subnet” number.
N/W Layer Addressing 12
4
Subnets
IP address: 223.1.1.1
subnet part (high 223.1.2.1
223.1.1.2
order bits) 223.1.1.4 223.1.2.9
host part (low order
bits) 223.1.1.3
223.1.2.2
223.1.3.27
What’s a subnet ?
LAN
device interfaces with
same subnet part of IP 223.1.3.1 223.1.3.2
address
can physically reach
each other without
intervening router network consisting of 3 subnets
N/W Layer Addressing 13
Subnets 223.1.1.0/24
223.1.2.0/24
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.3.0/24
Subnet mask: /24
N/W Layer Addressing 14
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.3.27
223.1.2.1 223.1.2.2 223.1.3.1 223.1.3.2
N/W Layer Addressing 15
5
Addressing in the Internet
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
Before CIDR, Internet used a class-based
addressing scheme where x could be 8, 16, or 24
bits. These corrsp to classes A, B, and C resp.
subnet host
part part
11001000 00010111 00010000 00000000
200.23.16.0/23
N/W Layer Addressing 16
IP addresses: how to get one?
Q: How does host get IP address?
hard-coded by system admin in a file
Wintel: control-panel->network->configuration-
>tcp/ip->properties
UNIX: /etc/rc.config
DHCP: Dynamic Host Configuration Protocol:
dynamically get address from a server
this is becoming very popular
N/W Layer Addressing 17
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 11001000 00010111 00010000 00000000 200.23.16.0/23
Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23
Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23
... ….. …. ….
Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23
N/W Layer Addressing 18
6
Hierarchical addressing: route aggregation
ISP has an address block; it can further divide this block into sub blocks
and assign them to subscriber organizations.
Organization 0
200.23.16.0/23
Organization 1
“Send me anything
200.23.18.0/23 with addresses
Organization 2 beginning
200.23.20.0/23 . Fly-By-Night-ISP 200.23.16.0/20”
.
. . Internet
.
Organization 7 .
200.23.30.0/23
“Send me anything
ISPs-R-Us
with addresses
beginning
199.31.0.0/16”
N/W Layer Addressing 19
Forwarding: Longest prefix matching
Prefix Match Link Interface
11001000 00010111 00010 0
11001000 00010111 00011000 1
11001000 00010111 00011 2
otherwise 3
Examples
DA: 11001000 00010111 00010110 10100001 Which interface?
DA: 11001000 00010111 00011000 10101010 Which interface?
N/W Layer Addressing 20
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
N/W Layer Addressing 21
7
NAT: Network Address Translation
rest of local network
Internet (e.g., home network)
10.0.0/24 10.0.0.1
10.0.0.4
10.0.0.2
138.76.29.7
10.0.0.3
All datagrams leaving local Datagrams with source or
network have same single source destination in this network
NAT IP address: 138.76.29.7, have 10.0.0/24 address for
different source port numbers source, destination (as usual)
N/W Layer Addressing 22
NAT: Network Address Translation
Motivation: local network uses just one IP address as
far as outside word 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).
N/W Layer Addressing 23
NAT: Network Address Translation
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
N/W Layer Addressing 24
8
ICMP: Internet Control Message Protocol
used by hosts & routers to
communicate network-level Type Code description
information 0 0 echo reply (ping)
3 0 dest. network unreachable
error reporting:
3 1 dest host unreachable
unreachable host, network, 3 2 dest protocol unreachable
port, protocol 3 3 dest port unreachable
echo request/reply (used 3 6 dest network unknown
by ping) 3 7 dest host unknown
network-layer “above” IP: 4 0 source quench (congestion
ICMP msgs carried in IP control - not used)
datagrams 8 0 echo request (ping)
ICMP message: type, code plus
9 0 route advertisement
first 8 bytes of IP datagram 10 0 router discovery
causing error 11 0 TTL expired
12 0 bad IP header
N/W Layer Addressing 25
IPv6
Initial motivation: 32-bit address space soon
to be completely allocated.
Additional motivation:
header format helps speed processing/forwarding
header changes to facilitate QoS
IPv6 datagram format:
fixed-length 40 byte header
no fragmentation allowed
N/W Layer Addressing 26
IPv6 Header (Cont)
Priority: identify priority among datagrams in flow
Flow Label: identify datagrams in same “flow.”
(concept of“flow” not well defined).
Next header: identify upper layer protocol for data
N/W Layer Addressing 27
9
Other Changes from IPv4
Checksum: removed entirely to reduce
processing time at each hop
Options: allowed, but outside of header,
indicated by “Next Header” field
ICMPv6: new version of ICMP
additional message types, e.g. “Packet Too Big”
multicast group management functions
N/W Layer Addressing 28
Transition From IPv4 To IPv6
Not all routers can be upgraded simultaneous
no “flag days”
How will the network operate with mixed IPv4 and
IPv6 routers?
Tunneling: IPv6 carried as payload in IPv4
datagram among IPv4 routers
N/W Layer Addressing 29
Tunneling
A B E F
Logical view: tunnel
IPv6 IPv6 IPv6 IPv6
A B C D E F
Physical view:
IPv6 IPv6 IPv4 IPv4 IPv6 IPv6
Flow: X Src:B Src:B Flow: X
Src: A Dest: E Dest: E Src: A
Dest: F Dest: F
Flow: X Flow: X
Src: A Src: A
data Dest: F Dest: F data
data data
A-to-B: E-to-F:
B-to-C: B-to-C:
IPv6 IPv6
IPv6 inside IPv6 inside
IPv4 IPv4
N/W Layer Addressing 30
10