Classful IP Addresses

advertisement
IP Addressing
Internet Protocol: Which version?
There are currently two versions of the Internet Protocol in
use for the Internet
• IPv4
•
•
•
•
Specified in 1980/81 (RFC 760, 791)
Four byte addresses
Universally deployed
Problem: Address space almost exhausted
• IPv6
•
•
•
•
Specification from 1998 (RFC 2460)
Significant differences to IPv4, but not fundamental changes
16-byte addresses
Problem: Not widely used (yet?)
Google Study from Oct 2008: IPv6 available to 0.238% of users
IP Addresses
3 2 b its
v e r s io n
(4 b its )
header
le n g th
T y p e o f S e r v ic e /T O S
(8 b its )
fla g s
(3 b its )
Id e n tific a tio n (1 6 b its )
T T L T im e -to -L iv e
(8 b its )
T o ta l L e n g th (in b y te s )
(1 6 b its )
P r o to c o l
(8 b its )
F r a g m e n t O ffs e t (1 3 b its )
H e a d e r C h e c k s u m (1 6 b its )
S o u r c e IP a d d r e s s (3 2 b its )
D e s tin a tio n IP a d d r e s s (3 2 b its )
E th e rn e t H e a d e r
IP H e ad e r
TCP Header
E thernet fram e
A pplication data
E th e rn e t T ra ile r
IP Addresses
32 bits
0x4
0x5
0x00
9d08
12810
4410
0102
00000000000002
0x06
8bff
128.143.137.144
128.143.71.21
E th e rn e t H e a d e r
IP H e ad e r
TCP Header
E thernet fram e
A pplication data
E th e rn e t T ra ile r
What is an IP Address?
• IP address = Internet Protocol Version 4 address
• 32-bit label for a network interface
– Each interface has a separate IP address
• On the public Internet, IP address is unique global address
• The IP address is to used by hosts and routers for delivery of
IP datagram
• Important special cases:
– Dynamically assigned IP addresses ( DHCP)
– IP addresses in private networks
( NAT)
Dotted Decimal Notation
• IPv4 addresses are written using dotted decimal notation
• Each byte is identified by a decimal number in the range
[0..255]
• Example:
10000000
1st Byte
= 128
10001111
2nd Byte
= 143
10001001
3rd Byte
= 137
128.143.137.144
10010000
4th Byte
= 144
Structure of an IP address
• IP address consists of a network prefix and a host number
network prefix
host number
– Network prefix identifies a network
– Host number identifies an interface on the network
• How do we know how long the network prefix is?
– The length of the network prefix is indicated
1. by a netmask, or
2. by a suffix given the length as a number (CIDR notation)
– Netmask is often called subnetmask (there are subtle differences)
Notation of IP address
• Example:
128.143
137.144
• Network address is: 128.143.0.0
• Host number is:
137.144
• Netmask is:
255.255.0.0
(or 128.143)
(or ffff0000)
• Prefix or CIDR notation: 128.143.137.144/16
» Network prefix is 16 bits long
Network Prefix and Host Number
• Each IP network (often called subnetwork or subnet) has an
IP address:
IP address of a network = Host number is set to all zeros, e.g., 128.143.0.0
• IP routers are devices that forward IP datagrams between IP
networks
• Delivery of an IP datagram proceeds in 2 steps:
– Use network prefix to deliver datagram to the right network
– Once the network is found, use the host number to deliver
to the right interface
How does one get an IP network address?
• IP address allocation is managed by five Regional Internet
Registries (RIR)
• Each RIR manages ranges of addresses:
http://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.xml
Special IP Addresses
•
Special addresses:
Loopback interfaces
– all addresses 127.0.0.1-127.0.0.255 are reserved for loopback interfaces
– Most systems use 127.0.0.1 as loopback address
– loopback interface is associated with name “localhost”
IP address of a network
– Host number is set to all zeros, e.g., 128.143.0.0
Broadcast address
– Host number is all ones, e.g., 128.143.255.255
– Broadcast goes to all hosts on the network
– Often ignored due to security concerns
•
Test / Experimental addresses
•
Convention (but not a reserved address)
Certain address ranges are reserved for “experimental use”. Packets should get dropped if
they contain this destination address (see RFC 1918):
10.0.0.0
- 10.255.255.255
172.16.0.0
- 172.31.255.255
192.168.0.0
- 192.168.255.255
Default gateway has host number set to ‘1’, e.g., e.g., 192.0.1.1
Subnetting
• Scenario: Organization has
a large network prefix and
wants to delegate
management of
IP addresses
UofT Network
128.100.0.0/16
Faculty of
Engineering
Faculty of A&S
128.100.11.0/24
128.100.58.0/24
• Subnetting: Use a portion
of the host name to identify
a smaller network
( “subnetwork”, “subnet”).
• Each subnets is a separate IP network
Library
128.100.136.0/24
Basic Idea of Subnetting
• Split the host number portion of an IP address into a subnet
number and a (smaller) host number.
• Result is a 3-layer hierarchy
network prefix
network prefix
host number
subnet number
host number
extended network prefix
• The extended network prefix is also called subnetmask
• Then:
• Subnets can be freely assigned within the organization
• Internally, subnets are treated as separate networks
• Subnet structure is not visible outside the organization
Subnetmask
• Routers and hosts use an extended network prefix
(subnetmask) to identify the start of the host numbers
128.143
137.144
network prefix
host number
128.143
137
144
network prefix
subnet
number
host number
extended network prefix
1111111111111111 1111111100000000
subnetmask
Example: Subnetmask
• 128.143.0.0/16 is the IP address of the network
• 128.143.137.0/24 is the IP address of the subnet
• 128.143.137.144 is the IP address of the host
• 255.255.255.0 (or ffffff00) is the subnetmask of the host
• When subnetting is used, one generally speaks of a “subnetmask”
(instead of a netmask) and a “subnet” (instead of a network)
Advantages of Subnetting
• With subnetting, IP addresses use a 3-layer hierarchy:
» Network
» Subnet
» Host
• Reduces router complexity. Since external routers do not
need to know about subnetting, the complexity of routing
tables at external routers is reduced.
• Note: Length of the subnet mask need not be identical at all
subnetworks.
Creating and Managing Subnetting
• Use of subnetting or length of the subnetmask is decided by
the network administrator, who acts as owner of
• Subnets are created by setting the subnetmask of an IP
interface
• Important: Subnetmasks must be set consistently
No Subnetting
• All hosts think that the other hosts are on the same network
128.143.137.32/16
subnetmask: 255.255.0.0
128.143.137.144/16
subnetmask: 255.255.0.0
128.143.71.21/16
subnetmask: 255.255.0.0
128.143.0.0/16
128.143.71.201/16
subnetmask: 255.255.0.0
With Subnetting
• Hosts with same extended network prefix belong to the same
network
128.143.137.32/24
128.143.137.144/24
128.143.71.21/24
128.143.71.201/24
subnetmask: 255.255.255.0
subnetmask: 255.255.255.0
subnetmask: 255.255.255.0
subnetmask: 255.255.255.0
128.143.137.0/24
Subnet
128.143.71.0/24
Subnet
128.143.0.0/16
With Subnetting
• Different subnetmasks lead to different views of the scope of
the network
128.143.137.32/26
128.143.137.144/26
subnetmask: 255.255.255.192 subnetmask: 255.255.255.192
128.143.137.0/26
Subnet
128.143.71.21/24
128.143.71.201/16
subnetmask: 255.255.255.0
subnetmask: 255.255.0.0
128.143.137.128/26
Subnet
128.143.0.0/16
128.143.71.0/24
Subnet
Classful IP Addresses and CIDR
• In 1993, there was a major shift for interpreting and allocating
IP addresses:
until 1993:
after 1993:
Classful
Addresses
CIDR
= Classless
Interdomain
Routing
Classful IP Addresses
• When Internet addresses were standardized (early 1980s),
the Internet address space was divided up into classes:
– Class A: Network prefix is 8 bits long
– Class B: Network prefix is 16 bits long
– Class C: Network prefix is 24 bits long
– Class D:
– Class E:
Used (multicast) group addresses
Reserved
• Each IP address contained a key which identifies the class:
– Class A: IP address starts with “0”
– Class B: IP address starts with “10”
– Class C: IP address starts with “110”
• No need for netmasks (unless subnetting is used)
Classful IP Addresses
b it #
1
7 8
31
0
C la ss A
b it #
0
N e tw o rk P re fix
H o st N u m b e r
8 b its
2 4 b its
1
2
10
C la ss B
b it #
C la ss C
0
0
1
15 16
network id
2
110
31
host
N e tw o rk P re fix
H o st N u m b e r
1 6 b its
1 6 b its
3
23 24
network id
31
host
N e tw o rk P re fix
H o st N u m b e r
2 4 b its
8 b its
Classful IP Addresses
b it # 0
C la ss D
3
4
31
1110
b it # 0
C la ss E
1 2
1 2
3
mul tica st gr oup id
4
11110
5
31
(re serv ed fo r fu ture use)
• We will learn about multicast addresses later in this course.
IP Allocation with Classful IP Addresses
• Limited flexibility for obtaining a network address:
≤ 254
≤ 216-1 = 65534
≤ 224-1 = 16,772,214
IP addresses: Class C
IP addresses: Class B
IP addresses: Class A
• Too few network addresses for large networks
27 = 128
214 = 16,384
Class A networks
Class B networks
• Flat address space. Routing tables in the backbone Internet
need one entry for each network address.
Class C networks: up
to 221 = 2,097,152 entries
By 1993, the lookup time of routing tables had become a
Allocation of Classful Addresses
CIDR - Classless Interdomain Routing
• Goals:
– New interpretation of the IP address space
– Restructure IP address assignments to increase efficiency
– Enable routing table aggregation to minimize route table entries
• CIDR (Classless Interdomain Routing)
– Abandons the notion of classes
– Key Concept: The length of the network prefix in the IP addresses is
kept arbitrary
– Consequences:
• Size of the network prefix must be provided with an IP address (
CIDR notation of IP addresses)
• Hierarchical routing aggregation introduces dependency of IP
addresses to service provider
• Need for new lookup algorithms for routing tables
CIDR Notation
• CIDR notation of an IP address:
192.0.2.0/18
• "18" is the prefix length. It states that the first 18 bits are the network
prefix of the address (and 14 bits are available for specific host
addresses)
• CIDR notation can replace the use of subnetmasks (but is more general)
– IP address 128.143.137.144 and subnetmask 255.255.255.0 becomes
128.143.137.144/24
• CIDR notation allows to drop traling zeros of network addresses:
192.0.2.0/18 can be written as 192.0.2/18
CIDR address blocks
•
•
CIDR notation can nicely express blocks of addresses
Blocks are used when allocating IP addresses for a company and for routing tables
(route aggregation)
CIDR Block Prefix
/27
/26
/25
/24
/23
/22
/21
/20
/19
/18
/17
/16
/15
/14
/13
# of Host Addresses
32
64
128
256
512
1,024
2,048
4,096
8,192
16,384
32,768
65,536
131,072
262,144
524,288
Subnetting and Supernetting
• CIDR is compatible with subnetting:
– Subnets are created by extending the
prefix
128.143.137.32/26
128.143.137.144/26
subnetmask: 255.255.255.192 subnetmask: 255.255.255.192
• CIDR can do more:
– CIDR can refer to multiple
networks with a single prefix:
• 128.143.0.0/16 and
128.142.0.0/16 can be
summarized as 128.142.0.0/15
– This is called supernetting (In fact,
CIDR and supernetting are often used
as the same thing)
– If neighboring networks have similar
address blocks, supernetting reduces
the size of routing tables
128.143.137.0/26
Subnet
128.143.71.21/24
128.143.71.201/16
subnetmask: 255.255.255.0
subnetmask: 255.255.0.0
128.143.137.128/26
Subnet
128.143.0.0/16
128.143.71.0/24
Subnet
CIDR and Hierarchical IP address allocation
• Exploiting supernetting to reduce size of routing tables:
– Backbone ISPs obtain blocks of IP addresses and allocate
portions of their address blocks to their customers
– Customers can allocate a portion of their address block to
their own customers
Hierarchical Structure of IP Addresses
Company Y :
ISP X owns:
128.100/16
Rest of
Internet
ISP Z :
Organization A:
Organization B:
Hierarchical Structure of IP Addresses
Company Y :
ISP X owns:
128.100.2/24
128.100/16
Rest of
Internet
Obtained from ISP X
ISP Z :
128.100.11/24
Obtained from ARIN
Obtained from ISP Z
Organization A:
Organization B:
128.100.11.192/26
128.100.11.64/26
Hierarchical Structure of IP Addresses
Company Y :
128.100.2/24
ISP X owns:
128.100/16
Rest of
Internet
Only one routing entry
for 128.100/16
No entries needed for
network addresses of
Company Y, ISP Z, or
Organizations A, B.
Routing table entry for
128.100.2/24 and 128.100.11/24
(no entry for 128.100.11.192/26
and 128.100.11.64/26.
ISP Z :
128.100.11/24
Organization A:
Organization B:
128.100.11.192/26
128.100.11.64/26
Drawback of Hierarchical IP Addresses
• IP address assignment depends on service provider
Company Y :
ISP X owns:
128.100.2/24
128.100/16
Rest of
Internet
ISP Z :
128.100.11/24
Must change IP
addresses when
changing service
provider
Organization A:
Organization B:
128.100.11.192/26
128.100.2.64/26
128.100.11.64/26
CIDR and Routing Tables
• Aggregation of routing table entries:
– 128.100.0.0/16 and 128.101.0.0/16 can be represented as
128.100.0.0/15
• Longest prefix match: Routing table lookup finds the routing entry
that matches the the longest prefix
What is the outgoing interface for
128.143.137.0/24 ?
Prefix
Interface
128.0.0.0/4
interface #5
128.128.0.0/9
interface #2
128.143.128.0/17 interface #1
Route aggregation can be exploited
when IP address blocks are assigned
in an hierarchical fashion
Routing table
IPv6 - IP Version 6
• IP Version 6
– Is the successor to the currently used IPv4
– Specification completed in 1994
– Makes improvements to IPv4 (no revolutionary changes)
• One (not the only !) feature of IPv6 is a significant increase in
of the IP address to 128 bits (16 bytes)
• IPv6 will solve – for the foreseeable future – the
problems with IP addressing
• 1024 addresses per square inch on the surface of the
Earth.
IPv6 Header
3 2 b its
v e rs io n
(4 b its )
T ra ffic C la s s
(8 b its )
F lo w L a b e l
(2 4 b its )
P a y lo a d L e n g th (1 6 b its )
N ext Header
(8 b its )
H o p L im its (8 b its )
S o u rc e IP a d d re s s (1 2 8 b its )
D e s tin a tio n IP a d d re s s (1 2 8 b its )
E th e rn e t H e a d e r
IP v 6 H e a d e r
TC P H eader
E th e rn e t fra m e
A p p lica tio n d a ta
E th e rn e t T ra ile r
IPv6 vs. IPv4: Address Comparison
• IPv4 has a maximum of
232  4 billion addresses
• IPv6 has a maximum of
2128 = (232)4  4 billion x 4 billion x 4 billion x 4 billion
addresses
Notation of IPv6 addresses
• Convention: The 128-bit IPv6 address is written as eight 16bit integers (using hexadecimal digits for each integer)
CEDF:BP76:3245:4464:FACE:2E50:3025:DF12
• Short notation:
• Abbreviations of leading zeroes:
CEDF:BP76:0000:0000:009E:0000:3025:DF12
 CEDF:BP76:0:0:9E :0:3025:DF12
• “:0000:0000:0000” can be written as “::”
CEDF:BP76:0:0:FACE:0:3025:DF12
 CEDF:BP76::FACE:0:3025:DF12
• IPv6 addresses derived from IPv4 addresses have 96 leading zero bits.
Convention allows to use IPv4 notation for the last 32 bits.
::80:8F:89:90  ::128.143.137.144
Download