Network-Addressing

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

CS 352

Network Layer: Intro


CS 352, Lecture 14.1
http://www.cs.rutgers.edu/~sn624/352

Srinivas Narayana

1
Transport

Application HTTPS FT HTTP SMTP DNS


P

Transport TC UD
P P

IP
Network

802.1 X.25 … ATM


Host-to-Net 1
Endpoint

The network layer


• Main function: Move data from sending to receiving
endpoint Process

• on sending endpoint: encapsulate transport segments into


datagrams
• on receiving endpoint: deliver datagrams to transport
layer Network Layer
• The network layer also runs in every router
• The router examines header fields in all network-layer
datagrams passing through it
Process

Endpoint
Two key network-layer functions
• Forwarding: move packets from Analogy: taking a road trip
router’s input to appropriate
router output ▪ Forwarding: process of
getting through single
interchange
• Routing: determine route taken
by packets from source to
destination
• routing algorithms ▪ Routing: process of
planning trip from
• The network layer solves the source to destination
routing problem.
4
Data plane and Control Plane
Data plane = Forwarding Control plane = Routing
• local, per-router function • network-wide logic
• determines how datagram arriving • determines how datagram is routed
on router input port is forwarded to along end-to-end path from source to
router output port destination endpoint
• two control-plane approaches:
• Distributed routing algorithm
values in arriving running on each router
packet header
• Centralized routing algorithm
011 1 running on a (logically) centralized
1
3
2 server
CS 352
Internet Addressing
CS 352, Lecture 14.2
http://www.cs.rutgers.edu/~sn624/352

Srinivas Narayana

7
The Internet needs addresses
• Addresses allow endpoints to identify, and hence talk to each other
• E.g., like people have names

• Addresses allow routers to determine how to move a packet


• E.g., like the postal system

• Network layer addresses are designed to help routers perform the


forwarding and routing functions efficiently
• Specifically, we’ll look at Internet Protocol (IP) addresses.
• Most popular: IP version 4 or IPv4. (Coming up later: IPv6)
IPv4 Addresses
• 32 bits long
• Identifier for a network interface
• An IP address corresponds to the point of attachment of an endpoint to
the network.
• An IP address is NOT an identifier for the endpoint
• Dotted quad notation: each byte is written in decimal in MSB order,
separated by dots. Example:
10000000 11000011 00000001 01010000
128 . 95 . 1 . 80
Grouping IP addresses by prefixes
• IP addresses can be grouped based on a shared prefix of a specified
length

• Example: consider two IP addresses:


• 128.95.1.80 and 128.95.1.4
• The addresses share a prefix of (bit) length 24: 128.95.1
• The addresses have different suffixes of (bit) length 8

• IP addresses: prefix corresponds to the network component and the


suffix to an endpoint/host component of the address
IP addresses use hierarchy to scale routing
NJ
• IP addresses of endpoint interfaces in a network (e.g.,
Rutgers Busch campus) share a prefix of some length
• Each interface/endpoint has a different suffix, and hence
a different 32-bit IP address
• Using prefixes reduces the amount of information needed
to forward packets over the Internet
• IP prefixes are like zip codes: routers don’t need to store
info for each endpoint, just each prefix
• Prefixes also allow IP addresses to be delegated from one
network to another (more on this later)
IP addresses use hierarchy to scale routing
NJ
• Postal envelopes should show clearly delineated zip
codes.

• Q: How to identify the prefix from a 32-bit IP


address?

• Two methods:
• Old: Classful addressing
• New: Classless addressing (also called classless
inter-domain routing, or CIDR)
Classful IPv4 addressing
Classful IPv4 addressing
Class 32 bits

A 0 Net Host 0.x.x.x – 127.x.x.x


Unicast: single endpoint dest
1
B
0
Net Host 128.x.x.x – 191.x.x.x
Unicast: single endpoint dest
11
C
0
Net Host 192.x.x.x – 223.x.x.x
Unicast: single endpoint dest
D 111 224.x.x.x – 239.x.x.x
Multicast address
0
Destination is a group of hosts
111
E Reserved 240.x.x.x – 255.x.x.x
1
8 bit 16 bit 24 bit First octet of IP address gives you
prefix prefix prefix the prefix length.
Classful IPv4 addressing
• Class A:
• For very large organizations
• 224 = 16 million hosts allowed
• Class B:
• For large organizations
• 216 = 65 thousand hosts allowed
• Class C
• For small organizations
• 28 = 255 hosts allowed
• Class D
• Multicast addresses
• No network/host hierarchy
Problems with classful addressing
• IP prefixes are allocated to organizations (e.g., Rutgers) by Internet
Registry organizations (e.g., ARIN, in North America)
• Many organizations required something bigger than class C address, but
smaller than a class A (or even B) address
• However, the Internet was running out of class B addresses
• Too many networks required multiple class C addresses
• Not enough nets in class A for large + medium organizations
• Key issue: Classful addressing is too coarse-grained: The addressing
strategy must allow for greater diversity of network sizes
Classless IPv4 addressing
(CIDR)
Classless IPv4 addressing
• Also called classless inter-domain routing (CIDR)
• Key idea: Network component of the address (ie: prefix) can have any
length (usually from 8—32)
• Address format: a.b.c.d/x, where x is the prefix length
• Customary to use 0s for all suffix bits

network host
part part
11001000 00010111 00010000 00000000
200.23.16.0/23
CIDR
•An ISP can obtain a block of addresses and 200.8.0.0/16
partition this further to its customers
•Say an ISP has 200.8.0.0/16 address (65K
addresses).
200.8.0.0
•The ISP has customer who needs only 64 200.8.0.1
addresses starting from 200.8.4.128 200.8.4.128/26

•Then that block can be specified as 200.8.1.0
200.8.4.128/26 200.8.1.1

•200.8.4.128/26 is “inside” 200.8.0.0/16
200.8.255.255
Netmask (or subnet mask)
• An alternative to denote the IP prefix length of an organization
• 32 bits: a 1-bit denotes a prefix bit position. 0 is the host part.

network host
part part
11001000 00010111 00010000 00000000
200.23.16.0/23
network part Host part of
of mask mask
11111111 11111111 11111110
00000000
Netmask: 255.255.254.0
Detecting addresses from same network
• Given IP addresses A and B, and netmask M.
1. Compute logical AND (A & M).
2. Compute logical AND (B & M).
3. If (A & M) == (B & M) then A and B are
on the same subnet.

• Ex: A = 165.230.82.52, B = 165.230.24.93, M = 255.255.128.0

• A and B are in the same network according to the netmask


• A & M == B & M == 165.230.0.0

You might also like