1 Network Layer IPv4 Addresses Types of IPv4 Addresses IPv4

1 Network Layer IPv4 Addresses Types of IPv4 Addresses IPv4
IPv4 Addresses
q  32 bits long
q  Identifier for host, router
Network Layer
interface
q  Notation:
v 
v 
Each byte is written in decimal in MSB order,
separated by dots
Example: 128.195.1.80
2
Types of IPv4 Addresses
IPv4 Address Classes (old)
q  Unicast Address
v  Destination is a single host
Class
q  Multicast address
v  Destination is a group of hosts
q  Broadcast address
v  255.255.255.255
v  Destination is all hosts
3
32 bits
A
0
B
10
C
110
D
1110
E
11110
Net
Type of Serv.
Host
Net
Host
Net
Host
Multicast address
Reserved
4
1
IP Address Classes
IP Address Hierarchy
q  Class A, B, C addresses support two levels
q  Class A:
v 
v 
For very large organizations
16 million hosts allowed
of hierarchy
q  However, the host portion can be further
q  Class B:
v 
v 
For large organizations
65 thousand hosts allowed
split into “subnets” by the address class
owner
q  Class C
v 
v 
For small organizations
255 hosts allowed
v 
more than 2 levels of hierarchy
q  Class D
v 
v 
Multicast addresses
No network/host hierarchy
5
Subnetting
Subnet Masks
Example: Class B address with 8-bit subnetting
Example
Address:
6
16 bits
Network id
8 bits
Subnet id
165.230
.24
Subnet masks allow hosts to determine if another
IP address is on the same subnet or the same
network
8 bits
Host id
16 bits
Network id
.8
Mask:
7
1111111111111111
255.255
8 bits
Subnet id
11111111
.255
8 bits
Host id
00000000
.0
8
2
Subnet Masks (cont’d)
IP Addressing in network
Assume IP addresses A and B share subnet mask M.
223.1.1.1
Are IP addresses A and B on the same subnet?
223.1.1.2
223.1.1.4
1. Compute (A and M).
2. Compute (B and M).
3. If (A and M) = (B and M) then A and B are
on the same subnet.
223.1.1.3
Example: A and B are class B addresses
A = 165.230.82.52
Same network?
B = 165.230.24.93
Same subnet?
M = 255.255.255.0
223.1.2.1
223.1.2.9
223.1.3.27
223.1.3.1
223.1.2.2
223.1.3.2
9
Problems with Class-based
Routing
10
IP addressing: CIDR
CIDR: Classless InterDomain Routing
q  Too many small networks requiring multiple class C
v 
addresses
q  Running out of class B addresses, not enough nets in
class A
q  Addressing strategy must allow for greater diversity
of network sizes
v 
subnet portion of address of arbitrary length
address format: a.b.c.d/x, where x is # bits in
subnet portion of address
subnet
part
host
part
11001000 00010111 00010000 00000000
200.23.16.0/23
11
12
3
CIDR
Reducing Routing Table Size
Without CIDR:
q  An ISP can obtain a block of addresses and partition
this further to its customers
v  Say an ISP has 200.8.4.24/24 address (256
addresses). He has another customer who needs only
4 addresses from 200.8.4.24 then that block can be
specified as 200.8.4.24/30
200.71.0.0
200.71.1.0
200.71.2.0
…..
200.71.255.0
200.71.0.0
200.71.1.0
200.71.2.0
…..
200.71.255.0
service
provider
Routing
table
With CIDR:
200.71.0.0
200.71.1.0
200.71.2.0
…..
200.71.255.0
service
provider
200.71.0.0/16
Routing
table
13
Hierarchical addressing: route aggregation
Hierarchical addressing allows efficient advertisement of routing
information:
14
Hierarchical addressing: more specific
routes
ISPs-R-Us has a more specific route to Organization 1
Longest prefix match will be used to route IP packets
Organization 0
Organization 0
200.23.16.0/23
200.23.16.0/23
Organization 1
200.23.18.0/23
Organization 2
200.23.20.0/23
Organization 7
.
.
.
.
.
.
Fly-By-Night-ISP
“Send me anything
with addresses
beginning
200.23.16.0/20”
Organization 2
200.23.20.0/23
Organization 7
Internet
.
.
.
Fly-By-Night-ISP
Internet
200.23.30.0/23
200.23.30.0/23
ISPs-R-Us
.
.
.
“Send me anything
with addresses
beginning
200.23.16.0/20”
ISPs-R-Us
“Send me anything
with addresses
beginning
199.31.0.0/16”
Organization 1
200.23.18.0/23
15
“Send me anything
with addresses
beginning 199.31.0.0/16
or 200.23.18.0/23”
16
4
What do routers look like?
What’s inside a router
Access routers
e.g. ISDN, ADSL
Core router
e.g. OC48c POS
Core ATM switch
18
Basic Components
Forwarding Engine
Packet
Routing
Protocols
Routing
Table
payload
Router
Control Plane
Destination
Address
Datapath”
Forwarding
Switching
Table
header
Routing Lookup
Data Structure
Outgoing
Port
Forwarding Table
per-packet
processing
19
Dest-network
Port
65.0.0.0/8
3
128.9.0.0/16
1
149.12.0.0/19
7
20
5
Router Architecture Overview
Input Port Functions
Physical layer:
bit-level reception
Data link layer:
e.g., Ethernet
see chapter 5
Decentralized switching:
q  queuing: if datagrams arrive
faster than forwarding rate
into switch fabric
21
Three types of switching fabrics
22
Output Ports
q  Buffering required when datagrams arrive from
fabric faster than the transmission rate
discipline chooses among queued
datagrams for transmission
q  Scheduling
23
24
6
Example Forwarding Table
Destination IP Prefix
Prefix length
65.0.0.0/8
Outgoing Port
q  With CIDR, route entries are prefixes <prefix, CIDR mask>
3
q  We need to find the longest matching prefix that matches
128.9.0.0/16
1
65.0.0.128/25
4
142.12.0.0/19
7
IP prefix: 0-32 bits
Longest prefix match
128.9.0.0/16
65.0.0.0/8
Longest prefix match
q  Can be aggregated
the destination address
q  Need to search all prefixes of all length (in order) and
among prefixes of the same length
128.8.2/24
128.8.0/16
142.12.0.0/19
128.8.0.24
0
65.0.0.0
128.9.16.14
224
65.255.255.255
192.2.0/16
128.8.2.128
192.2.2.128
232-1
26
25
Prefixes can Overlap
Longest matching
prefix
Key Network-Layer Functions
q  forwarding: move
128.9.176.0/24
packets from router’s
input to appropriate
router output
128.9.16.0/21 128.9.172.0/21
65.0.0.0/8
0
128.9.0.0/16
128.9.16.14
142.12.0.0/19
q  routing: determine
232-1
route taken by
packets from source
to dest.
Routing lookup: Find the longest matching
prefix (the most specific route) among all
prefixes that match the destination address.
v 
27
analogy:
q  routing: process of
planning trip from
source to destination
q  forwarding: process
of getting through
single interchange
Routing algorithms
28
7
Interplay between routing and forwarding
The Internet Network layer
Host, router network layer functions:
routing algorithm
Transport layer: TCP, UDP
local forwarding table
header value output link
0100
0101
0111
1001
3
2
2
1
Network
layer
value in arriving
packet’s header
0111
IP protocol
• addressing conventions
• datagram format
• packet handling conventions
Routing protocols
• path selection
• RIP, OSPF, BGP
forwarding
table
1
3 2
ICMP protocol
• error reporting
• router “signaling”
Link layer
physical layer
29
IP datagram format
The Internet Protocol (IP)
IP protocol version
number
header length
(bytes)
“type” of data
q  Provides delivery of packets from one host to any
other host in the Internet
q  Internet packets are called “datagrams” and may
be up to 64 kilobytes in length
v 
30
max number
remaining hops
(decremented at
each router)
although they are typically much smaller
upper layer protocol
to deliver payload to
31
how much overhead
with TCP?
q  20 bytes of TCP
q  20 bytes of IP
q  = 40 bytes + app
layer overhead
32 bits
type of
ver head.
len service
length
fragment
16-bit identifier flgs
offset
time to upper
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.
32
8
IP Fragmentation & Reassembly
IP Fragmentation and Reassembly
q  network links have MTU
(max.transfer size) - largest
possible link-level frame.
v  different link types,
different MTUs
q  large IP datagram divided
(“fragmented”) within net
v  one datagram becomes
several datagrams
v  “reassembled” only at final
destination
v  IP header bits used to
identify, order related
fragments
fragmentation:
in: one large datagram
out: 3 smaller datagrams
length ID fragflag offset
=4000 =x
=0
=0
Example
q  4000 byte
datagram
q  MTU = 1500 bytes
One large datagram becomes
several smaller datagrams
length ID fragflag offset
=1500 =x
=1
=0
1480 bytes in
data field
reassembly
length ID fragflag offset
=1500 =x
=1
=185
offset =
1480/8
length ID fragflag offset
=1040 =x
=0
=370
33
IP Support Protocols
34
ARP
q  ARP
q  Address Resolution Protocol
q  RARP
q  Returns a MAC sublayer address or link
layer address when given an Internet
address
q  After a packet reaches a router, the link
layer header needs to be added to reflect
the destination host on that link
q  Need IP à MAC address translation
q  ICMP
Type
Preamble
35
S
D
0x0806
ARP PACKET
36
9
ARP packet format
Proto=IPv4
0x0800
ARP (cont’d)
Oper=1
Sender H/W address
Sender IP address
ARP packet
containing “128.195.1.38?”
Target H/W address
target IP address
ARP
Source MAC address
Source IP address
Destination MAC address
Destination IP address
Protocol Type : IPv4 0x0800
Opcode ARP request:0
Opcode ARP reply:1
Ethernet Address:
05:23:f4:3d:e1:04
IP Address:
128.195.1.20
Wants to transmit
to 128.195.1.38
Ethernet Address:
12:04:2c:6e:11:9c
IP Address:
128.195.1.122
Ignored
Ethernet Address:
98:22:ee:f1:90:1a
IP Address:
128.195.1.38
Answered
37
38
ICMP
RARP
q  Protocol for error detection and reporting
q  Reverse Address Resolution Protocol
•  tightly coupled with IP, unreliable
q  RARP performs the inverse action of ARP
q  ICMP messages delivered in IP packets
q  RARP returns an IP address for a given
q  ICMP functions:
v  Announce network errors
v  Announce network congestion
v  Assist trouble shooting
v  Announce timeouts
MAC sublayer address
q  Need MAC address à IP address
q  Host have no permanent storage
q  On reboot? Need to figure IP address
q  Operationally, RARP is the same as ARP
39
40
10
IPV4 Header for ICMP
ICMP MSG
1
IP header
Source, Destination Address, TTL, ...
ICMP MSG
Message type, Code, Checksum,
Data
41
ICMP header Protocol Field
value=1
42
ICMP: Internet Control Message Protocol
43
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
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
44
11
Specific uses of ICMP
Ping
q  Echo request reply
v  Can be used to check if a host is alive
q  Destination unreachable
v  Invalid address and/or port
q  Uses ICMP echo request/reply
q  Source sends ICMP echo request message to the destination
address
q  Destination replies with an ICMP echo reply message
containing the data in the original echo request message
q  Source can calculate round trip time (RTT) of packets
q  TTL expired
v  Routing loops, or too far away
q  If no echo reply comes back then the destination is
unreachable
45
Ping (cont’d)
46
Traceroute
q  Traceroute records the route that packets take
q  A clever use of the TTL field
A
R1
R2
R3
q  When a router receives a packet, it decrements TTL
B
q  If TTL=0, it sends an ICMP time exceeded message back to
the sender
Echo request
q  To determine the route, progressively increase TTL
Time
v 
v 
Echo reply
47
Every time an ICMP time exceeded message is received, record
the sender’s (router’s) address
Repeat until the destination host is reached or an error
message occurs
48
12
Traceroute (cont’d)
Traceroute Examle
Te = Time exceeded
Pu = Port unreachable
A
R1
R2
B
R3
TTL=1, Dest = B,
port = invalid
Te (R1)
TTL=2, Dest = B
Time
Te (R2)
TTL=3, Dest = B
Te (R3)
1 lcsr-gw (128.6.13.21) 1.206 ms 0.973 ms 0.782 ms
2 rucs-gw (165.230.212.129) 0.697 ms 0.569 ms 0.571 ms
3 transition2-gw (165.230.12.145) 2.786 ms 0.994 ms 0.769 ms
4 rutgers-gw.Rutgers.EDU (198.151.130.209) 1.726 ms 2.048 ms Vl1000-sr02-hil
l012-svcs.Rutgers.EDU (198.151.130.14) 1.278 ms
5 rutgers-gw.Rutgers.EDU (198.151.130.209) 1.755 ms 1.241 ms 1.828 ms
6 198.151.130.226 (198.151.130.226) 2.748 ms 3.070 ms 2.640 ms
7 clev-nycm.abilene.ucaid.edu (198.32.8.29) 15.162 ms 14.619 ms 14.663 ms
8 ipls-clev.abilene.ucaid.edu (198.32.8.25) 21.220 ms 22.497 ms 21.450 ms
9 kscy-ipls.abilene.ucaid.edu (198.32.8.5) 30.257 ms 30.604 ms 30.969 ms
10 dnvr-kscy.abilene.ucaid.edu (198.32.8.13) 40.823 ms 41.181 ms 41.076 ms
11 snva-dnvr.abilene.ucaid.edu (198.32.8.1) 65.436 ms 66.068 ms 65.569 ms
12 198.32.249.161 (198.32.249.161) 65.673 ms 65.771 ms 66.006 ms
13 BERK--SUNV.POS.calren2.net (198.32.249.13) 67.183 ms 67.131 ms 66.858 ms
14 pos1-0.inr-000-eva.Berkeley.EDU (128.32.0.89) 67.192 ms 66.749 ms 67.720
ms
15 vlan198.inr-201-eva.Berkeley.EDU (128.32.0.194) 67.373 ms 67.067 ms 67.82
1 ms
16 fast8-0-0.inr-210-cory.Berkeley.EDU (128.32.255.122) 67.634 ms 68.735 ms
68.413 ms
17 GE.cory-gw.EECS.Berkeley.EDU (169.229.1.46) 67.575 ms 68.222 ms 67.772 ms
18 gig8-1.snr1.CS.Berkeley.EDU (169.229.3.66) 67.454 ms 67.988 ms 67.177 ms
19
TTL=4, Dest = B
now.CS.Berkeley.EDU (128.32.44.96)
67.892 ms *
67.818 ms
Pu (B)
49
50
IP addresses: bootStrap?
Q: How does host get IP address?
IP bootstrap & NAT
q  hard-coded by system admin in a file
v  Wintel:
control-panel->network->configuration>tcp/ip->properties
v  UNIX: /etc/rc.config
q  DHCP: Dynamic Host Configuration Protocol:
dynamically get address from as server
v  “plug-and-play”
52
13
DHCP (Ch 4.4)
q  DHCP stands for dynamic host configuration protocol
q  DHCP is client-server
More Internet
Protocols
DHCP, NAT, IPv6
q  DHCP offers a number of more features
v 
v 
v 
v 
Dynamic IP address allocation
IP addresses can be leased for a certain time
Useful where there are a limited number of IP addresses
Useful for temporary connections (testing, laptops, mobile
networks)
54
DHCP
Address Allocation Modes
(cont’d)
q  DHCP has two components:
v  A protocol for delivering bootstrap information
from the server to the clients
v  An algorithm for dynamically assigning
addresses to clients
q  DHCP supports three modes of allocation
v  Automatic allocation: Server assigns a permanent address
to a host
v  Dynamic allocation: Server assigns a host an IP address
with a finite “lease”
v  Manual allocation: Server assigns host an IP address
chosen by the network administrator
55
56
14
IPV4 Header for DHCP
DHCP Packets
Request=1
Reply=2
0
7 8
Request/Reply
17
(cont’d)
15 16
Hardware type
23 24
Hardware address
length in bytes
31
Hop count
Transaction ID
Number of seconds
Flags
Client IP address
Your IP address
Server IP address
Source Port
Gateway IP address
Destination port=67
Client hardware address (16 bytes)
DHCP PACKET
Server hostname (64 bytes)
Boot filename (128 bytes)
Options (312+ bytes)
57
Definitions of address fields
DHCP Packet Fields
q  ciaddr Client IP address; only filled in if client is in
BOUND, RENEW or REBINDING state and can respond to
ARP requests.
q  All fields are same as BOOTP except:
v 
Flags: One flag currently defined
v 
Options:
58
•  Broadcast (bit 0): Clients can request that all DHCP server
messages be broadcast to it
q  yiaddr 'your' (client) IP address. The IP address, server is
assigning to client
•  All DHCP packets must use the “DHCP message type” option, which
defines the “type” of DHCP message being sent:
–  1= DHCPDISCOVER
–  2= DHCPOFFER
–  3= DHCPREQUEST
–  4= DHCPDECLINE
–  5=DHCPACK
–  6=DHCPNACK
–  7=DHCP RELEASE
–  8=DHCP INFORM
q  siaddr IP address of server to use in the netx step of the
bootstrap process; returned in DHCPOFFER, DHCPACK by
server.
q  giaddr Relay agent IP address, used in booting via a relay
agent.
q  chaddr Client hardware address used for identification.
59
60
15
DHCP Message types
DHCP Protocol
q  DHCP message types
v 
v 
v 
v 
v 
v 
v 
Server 1
DHCP Discover: Client broadcasts to locate a server
DHCP Offer: Server responds with proposal of parameters
DHCP Request: Client broadcasts its choice of server. All other
servers are implicitly declined.
DHCP ACK: Selected server responds to client with address
DHCP NAK: Selected server rejects the client’s request
DHCP Decline: Client declines server’s parameters
DHCP Release: Client releases its assigned address
Client
Server 2
DHCPD
OVER
DHCPDISC
ISCOVE
R
OFFER
DHCP
DHCPO
FFER
Collects replies
Selects server 2
UEST
DHCPREQ
DHCPR
EQUES
T
CK
DHCPA
61
DHCP Protocol
DHCP Relay Agents
(cont’d)
q  Similar to BOOTP Relay Agents
q  DHCP client broadcasts a DHCP Discover message
v  Client may specify preference of a lease and/or IP address
q  DHCP relay agents allow DHCP servers to handle requests
q  Many servers may respond with offers
v 
62
from other subnets
Client chooses one server from them
q  Client broadcasts DHCP request with id of chosen server
q  Selected server sends DHCP ACK or NAK
q  Client begins using offered IP address once it receives ACK
q  If the client finds a problem, it sends a DHCP Decline message to
the server and starts over again
q  Client may choose to release the address before lease expires by
Client
sending a DHCP Release message to the server
63
DHCP
Relay
Agent
IP
Gateway
Router
IP
Gateway
Router
DHCP
Server
64
16
Summary
NAT: Network Address Translation
q  DHCP allow “ignorant” hosts to receive IP
rest of
Internet
addresses (and more) at start-up time
q  IP addresses don’t have to be manually configured
into hosts
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
65
NAT: Network Address Translation
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.186, 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
3
1
10.0.0.4
S: 128.119.40.186, 80
D: 10.0.0.1, 3345
66
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
67
q  Features: local network uses just one IP address as far
as outside world is concerned:
v  range of addresses not needed from ISP: just one IP
address for all devices
v  can change addresses of devices in local network
without notifying outside world
v  can change ISP without changing addresses of
devices in local network
v  devices inside local net not explicitly addressable,
visible by outside world (a security plus).
68
17
NAT: Network Address Translation
Recent Developments: IPv6
q  16-bit port-number field:
v  60,000 simultaneous connections with a single
LAN-side address!
q  IPv4 (the standard IP protocol) has limited
address space
q  Most importantly, IP is running out of addresses.
q  NAT is controversial:
32 bits are not enough.
v  routers
should only process up to layer 3
v  violates end-to-end argument
q  Real-time traffic and mobile users are also
becoming more common
•  NAT possibility must be taken into account by app
designers, eg, P2P applications
v  address
IPv6
shortage should instead be solved by
IP version 6
(Also called IPng, or IP next generation)
70
69
IPv6: The Changes
IPv6 header
Version (4) Traffic Class (8) Flow Label (20)
l  Large address space:
l  128-bit addresses (16 bytes)
l  Allows up to
PayloadLen (16) Next Header (8) Hop Limit (8)
340,282,366,920,938,463,463,374,607,431,768,211,456
unique addresses (3.4 x 10 38 )
l  Fixed length headers (40 bytes)
l  Improves the speed of packet processing in routers
4 bytes
4
Source Address
16
Destination Address
16
l  40 bytes header
l  Version field set to 6
l  PayloadLen field gives the length in bytes of the packet
excluding the header
l  Next Header value specifies the type of next header (if
any ) that follows the IPv6 header 6 Is TCP , 17 is UDP
71
72
18
IPv6: The Changes
(cont’d)
IPv6 Addresses
q  Support for “flows”
v  Flows help support real-time service in the Internet
v  A “flow” is a number in the IPv6 header that can be
used by routers to see which packets belong to the
same stream
v  Guarantees can then be assigned to certain flows
v  Example:
•  Packets from flow 10 should receive rapid delivery
•  Packets from flow 12 should receive reliable
delivery
l  Classless addressing/routing (similar to CIDR)
l  Notation: x:x:x:x:x:x:x:x (x = 16-bit hex
number)
l 
l 
contiguous 0s are compressed: 47CD::A456:0124
IPv6 compatible IPv4 address: ::128.64.18.87
l First 96 bits are 0
Global unicast addresses start with 001….
l  2000::/3 prefix
l 
73
19
Was this manual useful for you? yes no
Thank you for your participation!

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

Download PDF

advertising