IPv4 Addressing and Datagram Forwarding, Study notes of Computer Science

An overview of ipv4 addressing, including how addresses are assigned, the different classes of addresses, and the organization of addresses into networks and hosts. It also covers datagram forwarding, including the role of routers and neighbors, packet forwarding algorithms, and forwarding tables.

Typology: Study notes

Pre 2010

Uploaded on 03/18/2009

koofers-user-vye
koofers-user-vye 🇺🇸

10 documents

1 / 9

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
CLASSFUL IPv4 ADDRESSES +
DATAGRAM FORWARDING
Internet Protocols
CSC / ECE 573
Fall, 2005
N. C. State University
copyright 2005 Douglas S. Reeves 2
Today’s Lecture
I. IPv4 Addresses
II. Address Classes
III. “Special Case” Addresses
IV. Forwarding Basics
V. Forwarding Decisions
VI. Next-Hop vs. Destination Addresses
IPv4 ADDRESSES
copyright 2005 Douglas S. Reeves 4
How Do Addresses Get Assigned?
1. ICANN (Internet Corp. for Assigned Numbers and
Names)
establishes policy for address and name allocation
Allocates top-level address space to regional registries
2. Regional registries allocate address space to
ISPs, companies, and other organizations
APNIC (Asia-Pacific)
ARIN (North America )
RIPE (Europe)
LACNIC (Latin America and Caribbean)
3. Sys admins assign individual host addresses
copyright 2005 Douglas S. Reeves 5
IP Allocation Goals (RFC 2050)
1. Conservation: fair distribution of globally unique
Internet address space, no stockpiling
2. Routability: distribution in a hierarchical manner,
makes routing easier
good? bad?
3. Public registries document address space
allocation and assignment
copyright 2005 Douglas S. Reeves 6
How Do I Get to www.ietf.org?
(…some hops
omitted…)
24.93.64.53
66.15.132.33
66.185.152.29
66.185.139.129
66.185.145.6
152.63.43.178
152.63.41.138
152.63.39.254
152.63.39.97
157.130.44.142
132.151.6.21
www.ietf.org
132.151.6.21
DNS translates this to…
User specifies
destination of …
Router forwarding
tables determine
the path is…
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download IPv4 Addressing and Datagram Forwarding and more Study notes Computer Science in PDF only on Docsity!

CLASSFUL IPv4 ADDRESSES +

DATAGRAM FORWARDING

Internet Protocols

CSC / ECE 573

Fall, 2005 N. C. State University copyright 2005 Douglas S. Reeves (^) 2

Today’s Lecture

I. IPv4 Addresses

II. Address Classes

III. “Special Case” Addresses

IV. Forwarding Basics

V. Forwarding Decisions

VI. Next-Hop vs. Destination Addresses

IPv4 ADDRESSES

copyright 2005 Douglas S. Reeves (^) 4

How Do Addresses Get Assigned?

1. ICANN (Internet Corp. for Assigned Numbers and

Names)

  • establishes policy for address and name allocation
  • Allocates top-level address space to regional registries

2. Regional registries allocate address space to

ISPs, companies, and other organizations

  • APNIC (Asia-Pacific)
  • ARIN (North America )
  • RIPE (Europe)
  • LACNIC (Latin America and Caribbean)

3. Sys admins assign individual host addresses

copyright 2005 Douglas S. Reeves (^) 5

IP Allocation Goals (RFC 2050)

1. Conservation: fair distribution of globally unique

Internet address space, no stockpiling

2. Routability: distribution in a hierarchical manner,

makes routing easier

  • good? bad?

3. Public registries document address space

allocation and assignment

copyright 2005 Douglas S. Reeves (^) 6

How Do I Get to www.ietf.org?

(…some hops omitted…) 24.93.64. 66.15.132. 66.185.152. 66.185.139. 66.185.145. 152.63.43. 152.63.41. 152.63.39. 152.63.39. 157.130.44.

www.ietf.org 132.151.6. DNS translates this to… User specifies destination of … Router forwarding tables determine the path is…

copyright 2005 Douglas S. Reeves (^) 7

IPv4 Addresses

  • 32-bits long, globally unique
  • Each interface has an IP address H IP IP Example: a router R IP1 …. IP Example: a multi-homed host network A network B copyright 2005 Douglas S. Reeves (^) 8

Dotted Decimal Notation

Dotted decimal representation 152. 1. 54. 48 32-bit address 10011000 00000001 00110110 00110000 8 bits 8 bits 8 bits 8 bits

  • A convenient way to describe (and remember)

IPv4 addresses

  • Example IPv4 ADDRESS CLASSES copyright 2005 Douglas S. Reeves (^) 10

Classful Addresses

  • Addresses are organized in a two-level hierarchy 1.the network part (leftmost, most significant) 2.the host part (rightmost, least significant) 32- x bits Network ID Host ID
  • More networks (= larger network part) means

fewer hosts per network (= smaller host part), and

vice versa

x bits copyright 2005 Douglas S. Reeves (^) 11

Classful Address Formats

1 0 Network ID Host ID 7 24 E

D

C

B

A

Class 2 10 Network ID Host ID 14 16 3 110 Network ID Host ID 2 1 8 4 1110 Multicast Address 2 8 5 11110 reserved 2 7 copyright 2005 Douglas S. Reeves (^) 12

Classful Address Ranges

  • The size (number of bits) in the network part is not

fixed

  • the first few bits of the address indicate this size
  • Classes
  • A = addresses 0.0.0.0—127.255.255.
  • B = addresses 128.0.0.0—191.255.255.
  • C = addresses 192.0.0.0—223.255.225.
  • D = addresses 224.0.0.0—239.255.255.
  • E = addresses 240.0.0.0—255.255.

copyright 2005 Douglas S. Reeves (^) 19

Directed Broadcast Addresses

  • An IP destination address with

Host ID part = all 1’s

means “all hosts attached to the specified network”

  • Ex.: Packet sent to address 128.10.255.255 from

host H5 will reach H1…H

H

128.10.2. network 128.10.0. H 128.10.2. H 128.10.2. H 128.10.2. 192.5.48.3 (^) network 192.5.48. H 192.5.48. copyright 2005 Douglas S. Reeves (^) 20

Limited Broadcast Addresses

  • An IP destination address

== all 1’s

means “all hosts part of the same network as me”

  • Ex.: Packet sent to 255.255.255.255 from host H

reaches H1—H

H

128.10.2. network 128.10.0. H 128.10.2. H 128.10.2. H 128.10.2. 192.5.48. network 192.5.48. H 192.5.48. copyright 2005 Douglas S. Reeves (^) 21

Another Special Case

  • An IP source address with

network ID part = all 0’s

means “from this network”

  • Only allowed at startup (during bootstrapping)
    • allows a machine to communicate temporarily before it learns its own IP address
    • thereafter it must not use network 0 copyright 2005 Douglas S. Reeves (^) 22

The Loopback Address

  • An IP destination address with

network ID part = all 1’s

means “this computer” (i.e., the one sending the

packet)

  • Used in testing network applications without

sending data over a network

  • ex.: “ping 127.0.0.1” should always get a reply!
  • a datagram with destination address 127.x.x.x should never appear on any network copyright 2005 Douglas S. Reeves (^) 23

Summary of Special Addresses

Destination Destination -- For Address of Type… Broadcast address for same network as originating host All 1’s All 1’s Broadcast address for All 1’s the specified network Anything other than all 0’s or all 1 ’s The address of the All 0’s whole network Anything other than all 0’s or all 1 ’s Then this means … And Host part is … If Network part is… “This computer” Anything (source of the packet) 127 (Class A, all Destination 1 ’s) (host which doesn’t yet know what network it is attached to) Anything other than all 0’s or all 1’s Source All 0’s copyright 2005 Douglas S. Reeves (^) 24

RFC 3330: Special-Use IPv4 Addresses

  • 0.0.0.0—0.255.255.255 "This" Network [RFC1700]
  • 10.0.0.0—10.255.255.255 Private-Use Networks [RFC1918]
  • 24.0.0.0—24.255.255.255 Cable Television Networks
  • 169.254.0.0—169.254.255.255 Link Local
  • 172.16.0.0—172.23.255.255 Private-Use Networks [RFC1918]
  • 192.168.0.0--192.168.255.255 Private-Use Networks [RFC1918]
  • 224.0.0.0—239.255.255.255 Multicast [RFC3171]
  • 240.0.0.0—255.255.255.255 Reserved for Future Use [RFC1700]

FORWARDING BASICS copyright 2005 Douglas S. Reeves (^) 26

Routers and Neighbors

  • Routers (also called Gateways )
    • receive packets on one network, send out on another
  • Neighbors (or directly-connected computers)
    • are attached to the same physical network
    • can communicate directly with each other (i.e., no router needed) network 192.5.48.

R

152.14.51. 192.5.48. network 152.14.0. H 192.5.48.

H

192.5.48.

H

152.14.51. R 152.14.51. 192.5.48. copyright 2005 Douglas S. Reeves (^) 27

Packet Forwarding

  • Deciding what neighbor to send a packet to is a

forwarding decision

  • Ex.: for H1 to send a packet to H2, should it

forward the packet to…

  • 192.5.48.12 (router R1)
  • or 192.5.48.3 (router R2)? R 152.14.51. 192.5.48. network 152.14.0. network 192.5.48.

H

192.5.48.

H

192.5.48.

H

152.14.51. R 152.14.51. 192.5.48. copyright 2005 Douglas S. Reeves (^) 28

Direct Packet Delivery

  • Host H x wishes to send packet to a neighboring

host H y

  • how does H x know they are on the same network?
  • H x frames (encapsulates) the datagram according

to the requirements of the network connecting H x

and H y

  • H x sends this frame directly to H y
    • there are no intervening routers involved copyright 2005 Douglas S. Reeves (^) 29

Indirect Datagram Delivery

  • Needed if hosts Hx and Hy are not neighbors
    • Q: how does Hx figure this out?
  • Hx picks a neighboring router R1 to forward the

datagram to

  • Hx frames the packet, sends directly to R copyright 2005 Douglas S. Reeves (^) 30

Indirect Datagram Delivery (cont’d)

  • R1 extracts the packet, picks a neighboring router

R2 to forward to, frames the packet, sends to R

  • ...
  • Rn extracts packet, determines Hy is a neighbor

(how does Rn know this?), frames the packet,

sends directly to Hy

copyright 2005 Douglas S. Reeves (^) 37

Other Consequences

  • Forwarding (generally) does not consider…
    • application type
    • quality of service requirements
    • bandwidth available
    • congestion
    • reliability
    • …! copyright 2005 Douglas S. Reeves (^) 38

“Default” Routes

  • Frequently, a single router R is used for most

outgoing traffic

  • may need to specify a few destination-specific network routes
  • “everything else” goes through R copyright 2005 Douglas S. Reeves (^) 39

“Default” Routes (cont’d)

  • In the forwarding table, there will be an entry with

key = "all other (non-specified) destination

networks“

  • normal meaning: “the rest of the Internet”
  • simplifies forwarding tables copyright 2005 Douglas S. Reeves (^) 40

“Host-Specific” Routes

  • The key may be a single destination host address
    • allows specifying a route to a single computer
  • Useful for
    • testing and debugging purposes
    • security purposes
    • what else? copyright 2005 Douglas S. Reeves (^) 41

The “Datagram Forwarding” Algorithm

/* M is a machine (router or host) making / / a forwarding decision about a packet */ Extract destination address Hd, compute network part N if (N matches any directly connected networks) deliver to Hd directly else if (there is a host-specific route for Hd) forward datagram to specified next hop else if (there is a route for network N) forward datagram to specified next hop … copyright 2005 Douglas S. Reeves (^) 42

The “Datagram Forwarding” Algorithm

(cont’d)

… else if (there is a default route) forward datagram to default router else /* Hd is not directly connected and we / / don’t know how to get to it… */ discard the datagram and declare routing error

copyright 2005 Douglas S. Reeves (^) 43

Host Forwarding Tables

  • Hosts also need forwarding tables to pick the

appropriate "first hop" router

R

40.0.0. 30.0.0. network 40.0.0. network 30.0.0.

H

30.0.0. R 30.0.0. 20.0.0.6 (^) network 20.0.0.

  • Frequently there is only one directly-connected

router, and the only entry in the table is the default

route

copyright 2005 Douglas S. Reeves (^) 44

Example

copyright 2005 Douglas S. Reeves (^) 45

The “Datagram Receiving” Algorithm

if (Hd is one of M’s IP addresses) receive the datagram else if (Hd is a limited or directed broadcast address for the network on which it was sent) receive the datagram else if (M is a router) forward the datagram if possible else /* M is a host and this packet is not intended for it */ discard the datagram copyright 2005 Douglas S. Reeves (^) 46

Should Multi-Homed Hosts Forward?

  • Since they don’t participate in routing protocols…

probably not!

  • inefficient routes
  • can create loops
  • leads to broadcast "storms“
  • etc. DESTINATION vs. NEXT-HOP ADDRESSES copyright 2005 Douglas S. Reeves (^) 48

Destination vs. Next Hop IP Addresses

  • The destination IP address in a IP datagram never

changes

  • At router R, the datagram is framed and a physical

address is added to get it to the "next hop router"