Transcript lectures3-4
CS 372 – introduction to computer networks*
Friday July 23, 2010
Announcements:
Midterms are graded.
Lab 4 is posted.
* Based in part on slides by Bechir Hamdaoui and Paul D. Paulson.
Acknowledgement: slides drawn heavily from Kurose & Ross
Chapter 4, slide: 1
Internet addresses
A key aspect of a virtual network is a single,
uniform address format
Can't use hardware addresses because
different technologies have different
address formats
Can't use addresses that are local to a
network because multiple networks might use
the same addresses internally
Address format must be independent of any
particular hardware address format
Chapter 4, slide: 2
IP address notation
IP address is just a 32-bit number
It’s the same internally, regardless of its external
representation
In decimal form, the range is [0 … 4294967296]
Some are reserved
In hexadecimal form, the range is [00000000 … FFFFFFFF]
•
•
•
•
divides naturally into 4 2-hexdigit groups
e.g.: 80 FD 28 1C
each group represents one byte (octet)
Binary form is 10000000 11111101 00101000 00011100
For convenience, use dotted decimal notation
e.g.:
128.253.40.28 (= 80.FD.28.1C)
range is [0.0.0.0 … 255.255.255.255]
Chapter 4, slide: 3
IP Addressing: introduction
IP address: 32-bit
identifier for
223.1.1.1 = 11011111 00000001 00000001 00000001
host,
router interface
223
1
1
1
223.1.1.1
interface: connection
between host/router and
physical link
multiple interfaces per
router
one interface per host
one IP address per
interface
223.1.2.1
223.1.1.2
223.1.1.4
223.1.1.3
223.1.3.1
223.1.2.9
223.1.3.27
223.1.2.2
223.1.3.2
Chapter 4, slide: 4
Subnets
IP address:
subnet part (higher bits)
host part (lower bits)
subnet
part
host
part
223.1.1.1
223.1.2.1
223.1.1.2
223.1.1.4
223.1.1.3
11001000 00010111 00010000 00000000
223.1.3.27
223.1.2.2
subnet
200.23.16.0/23
223.1.3.1
What’s a subnet ?
device interfaces with same
subnet part of IP address
can physically reach each
other without intervening
router
223.1.2.9
223.1.3.2
network consisting of 3 subnets
Chapter 4, slide: 5
Subnets
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.1.0/24
223.1.2.0/24
223.1.3.0/24
Subnet mask: /24
Chapter 4, slide: 6
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.2.1
223.1.3.27
223.1.2.2
223.1.3.1
223.1.3.2
Chapter 4, slide: 7
IP addresses: how to get one?
Q: How does host get IP address?
hard-coded by system admin in a file
DHCP: Dynamic Host Configuration Protocol:
dynamically get IP address from as server when joining
the network
IP address can be reused by other hosts if released
Can renew IP addresses if stayed connected
Chapter 4, slide: 8
DHCP client-server scenario
A
B
223.1.2.1
DHCP
server
223.1.1.1
223.1.1.2
223.1.1.4
223.1.2.9
223.1.2.2
223.1.1.3
223.1.3.1
223.1.3.27
223.1.3.2
E
arriving DHCP
client needs
address in this
network
Chapter 4, slide: 9
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
Organization 1
Organization 2
...
11001000 00010111 00010000 00000000
11001000 00010111 00010010 00000000
11001000 00010111 00010100 00000000
…..
….
200.23.16.0/23
200.23.18.0/23
200.23.20.0/23
….
Organization 7
11001000 00010111 00011110 00000000
200.23.30.0/23
Chapter 4, slide: 10
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
Chapter 4, slide: 11
IP address format
Each IP address is divided into a prefix and a
suffix
Prefix identifies the network and the type of
network to which a host computer is attached
Suffix identifies a host computer within that
network
Usually includes indicator for number of bits
used for prefix
Address format enables efficient routing
Chapter 4, slide: 12
IP address hierarchy
Every network in a TCP/IP internet is
assigned a unique network number
Each host on a specific network is assigned a
host number or host address that is unique
within that network
Host's IP address is the combination of the
network number (prefix) and host address
(suffix)
Chapter 4, slide: 13
IP address assignment
Network numbers (prefixes) are unique
Host addresses (suffixes) may be duplicated
on different networks
The combination of network number prefix
and host address suffix is unique in the entire
internet
Chapter 4, slide: 14
IP address assignment
Assignment of network numbers must be
coordinated globally
Assignment of host addresses can be
managed locally
Chapter 4, slide: 15
IP address design
IP-v4 designers chose 32-bit addresses
Allocate some bits for prefix, some for
suffix
Large prefix, small suffix - many networks, few
hosts per network
Small prefix, large suffix - few networks, many
hosts per network
Because of the wide variety of
technologies, need to allow for both large
and small networks
Chapter 4, slide: 16
IP addressing (two types):
Classful addressing: A, B, C
A: /8 (only 28 networks, but 224 hosts per network)
B: /16 (216 networks, and 216 hosts per network)
C: /24 (224 networks, but only 28 hosts per network)
CIDR: Classless InterDomain Routing
network portion of address of arbitrary length
address format: a.b.c.d/x, where x is # bits in network
portion of address
network
part
host
part
11001000 00010111 000100 00 00000000
200.23.16.0/22
Chapter 4, slide: 17
IP address classes:
Classful addressing
Multiple address formats that allow both
large and small prefixes
Each format is called an address class
The class of an address is identified by
first four bits
The number of bits allocated for the
prefix is determined by the class
Chapter 4, slide: 18
IP address classes:
Classful addressing
Chapter 4, slide: 19
Chapter 4, slide: 20
IP address classes:
Classful addressing
Class A, B and C are primary classes
Used for ordinary host addressing
Class D is used for multicast, a limited form of
broadcast
Internet hosts join a multicast group
Packets are delivered to all members of group
Routers manage delivery of single packet from source to all
members of multicast group
Used for multicast backbone
Class E is reserved
Chapter 4, slide: 21
Determining IP class
Dotted decimal makes separating network
address from host address easier
Look at first dotted decimal number, and use
this table:
Chapter 4, slide: 22
How many networks?
Classful scheme does not yield equal number of
networks in each class
class A:
First bit must be 0
7 remaining bits identify Class A net
27 (= 128) possible class A nets
• Minus a few that are reserved
class B:
First 2 bits must be 10
14 remaining bits identify Class B net
214 (= 16384) possible class B nets
• Minus a few that are reserved
class C:
First 3 bits must be 110
21 remaining bits identify Class C net
221 (= 2097152) possible class C nets
• Minus a few that are reserved
Chapter 4, slide: 23
Networks and hosts in each class
8
16
24
Chapter 4, slide: 24
What if the form doesn't fit?
Large organizations may not be able to get as
many addresses in the Internet as they need
Example - UPS needs addresses for millions of
computers
Example – School needs 6000 hosts
Too big for class C, too many wasted addresses for
class B
Chapter 4, slide: 25
Possible solutions
Classless addressing
allow division between prefix and suffix at any bit
boundary
Sharing an IP address
Use one IP address for multiple hosts
Chapter 4, slide: 26
Classless Addressing Example
128.193.47.25
dotted decimal
80 C1 2F 19
hexadecimal
1000 0000 1100 0001 0010 1111 0001 1001 binary
This can be “re-aligned” to use variable-size prefixes and
suffixes.
Example: Suppose we want a 22-bit prefix and a 10-bit
suffix
Chapter 4, slide: 27
Example:
1000 0000 1100 0001 0010 1111 0001 1001
Logical AND with a "mask" using 22 bits for
prefix (netmask), 10 bits for suffix:
1111 1111 1111 1111 1111 1100 0000 0000
… gives a prefix:
1000 0000 1100 0001 0010 1100 0000 0000
The complement mask (hostmask)
0000 0000 0000 0000 0000 0011 1111 1111
… gives a suffix:
0000 0000 0000 0000 0000 0011 0001 1001
Chapter 4, slide: 28
Example:
1000 0000 1100 0001 0010 1100 0000 0000
0000 0000 0000 0000 0000 0011 0001 1001
i.e., the “network number” is 80C12C00h, and the “host
number” within the network is 319h
With 10 bits for suffix, 1024 host addresses are
available within the subnet (but 2 of these are
reserved)
Address still looks almost the same in dotted
decimal
128.193.47.25 / 22
Additional information is provided so addressing can be
handled by routers
Chapter 4, slide: 29
CIDR
CIDR (Classless Inter-Domain Routing) address
includes specification for number of bits to use
for the netmask
Example: host address 128.193.47.25/22
What is the netmask?
• 255.255.252.0
What is the network address?
• 128.193.44.0
What is the hostmask?
• 0.0.3.255
What is the host number?
• 0.0.3.25 = 319h = 793 (decimal)
Chapter 4, slide: 30
CIDR
What is the netmask for /20 ?
255.255.240.0
What is the netmask for /24 ?
255.255.255.0
What is the netmask for /27 ?
255.255.255.224
How many hosts can be supported in /28 ?
24 - 2 = 14
Chapter 4, slide: 31
Example
Three subnets
All interfaces in all these
Subnet 1
Subnet 2
subnets are required to have
prefix: 223.1.13/24
Subnet 1 is required to
support 125 interfaces
Subnet 2 & 3 are each
required to support 60
interfaces
Question:
Provide 3 network addresses
in the form: a.b.c.d/x
Subnet 3
Chapter 4, slide: 32
IP address assignment
Select an address class for each network depending
on expected number of hosts
Assign network numbers from appropriate classes
Assign host suffixes to form internet addresses for
all hosts
The lowest host number (0) is not used because that
complete address is the network address
e.g., 192.168.5.0
The highest host number (depends on network type)
is not used because that complete address is the
“broadcast address” for the network
e.g., 192.168.5.255
Chapter 4, slide: 33
OSU IP addresses
Oregon State has a single Class B network:
128.193.0.0
All hosts at OSU have 128.193 prefix
E.G.:
ns1.oregonstate.edu 128.193.0.10
ns2.oregonstate.edu 128.193.4.20
Suffix bytes are used to determine local
network and host through subnetting
Individual host addresses assigned by system
administrators
may be static or dynamic assignment
Chapter 4, slide: 34
IP address allocation
Addresses in the Internet are not used
efficiently
Less than 10% of possible addresses are actually
assigned
Concerns about address space being
exhausted
OSU is like most organizations, using 5,0006,000 out of possible 216 (= 65,536) available
addresses
Chapter 4, slide: 35
Routing table information
In the routing table
Destination stored as network address
Next hop stored as IP address of router
Address mask defines how many bits of
address are in prefix
Prefix defines how much of address used to
identify network
e.g., class B mask is 255.255.0.0
• In binary: 11111111111111110000000000000000
Chapter 4, slide: 36
Example:
Routing table
for
Chapter 4, slide: 37
Consider 192.4.10.26:
Routing table
for
doesn’t care what
does with the packets
Chapter 4, slide: 38
Address masks
To identify destination network, apply address
mask to destination address and compare to
network address in routing table
Use Boolean and
if ((Mask[i] & D) == Dest[i])
forward to NextHop[i]
Chapter 4, slide: 39