Routing and road trips

Download Report

Transcript Routing and road trips

Chapter 4
Network Layer
With special emphasis on Internet
Protocol (IP)
Contents
•
•
•
•
Functions of network layer
Internet protocol (IP)
IP Header
IP Addresses
• CIDR notation
• Obtaining IP addresses
• IP version 6
2
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Functions of the Network layer
• Transfer variable length data packets from a
source network to a destination network via
one or more networks
• This task is called Routing
3
PC
user
Router 1
(R1)
Router 2
(R2)
DL destination = Web
server’s DL address
IP destination =
Web server’s IP
address
IP data
DL destination = R3's
DL address
IP destination =
Web server’s IP
address
IP data
DL destination = R2's
DL address
IP destination =
Web server’s IP
address
IP data
DL destination = R1's
DL address
IP destination =
Web server’s IP
address
IP data
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Functions of the Network layer
Router 3
(R3)
Web
server
4
Functions IP
Routing and road trips
• Consider a long distance road trip
• The source and final destination are like
network layer addresses
• Each interstate exit is like a data link layer
address
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Internet protocol (IP) overview
• Most common protocol at the Network Layer
• Specified in RFC 791 (Sep 1981)
• First used on a large scale in BSD UNIX
– http://www.isoc.org/internet/history/brief.shtml
– Now used by default in all operating systems
6
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
IP
Header
Data passed to IP from Transport
layer
Data
from IP
layer to
data link
layer
Data-Link
layer FCS
Data-Link
layer Header
IP packet within data link frame
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
IP capabilities
• Highly adaptable
– Most current uses of the Internet (http, IM, bittorrent, movie downloads) did not exist at the
time of creation of IP
– Even email was only specified a year later in Aug
1982 in RFC 821
– But IP can serve all these applications
– IP does not provide end-to-end reliability,
sequencing etc
8
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
IP Header
0
1
2
Version
3
4
5
6
Header
length
7
8
9
10
11
12
13
15
16
17
18
Type of service
Identification
Time to live
14
19
20
21
22
23
24
25
26
27
28
29
30
Total length
Flags
Protocol
Fragment offset
Header checksum
Source address
Destination address
Options
Padding
Note: Each tick mark represents a bit position
9
31
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
IP Header fields
• Like other layers, IP header fields enable IP
functionality
– Used primarily by routers to find addresses
• Version
• Header length
– Length of header in multiples of 32 bits
– minimum value = 5
10
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
IP Header fields
• Type of service
– Packets with higher value should get higher
priority
– But generally not currently implemented
• Total length
– Size of packet, including header and data
• ID
– Used to re-assemble packet if it is fragmented by
intermediate routers
11
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
IP Header fields
• Flags
– Indicates whether packet may be further
fragmented, and whether it has in fact, been
fragmented
• Fragment offset
– Location of packet with respect to TCP datagram
• Time to live
12
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
IP Header fields
• Protocol
– Indicates protocol of IP user technology
– Specified in RFC 790
– E.g. TCP = 6, UDP = 21, ICMP = 1
• Checksum
• Options
– Can be used to indicate source routing
13
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
IP Addresses
• An address is a unique label that helps locate
an entity on a network
• 32-bit values in source and destination
address fields
• Every computer on the Internet has an IP
address
• Unlike MAC (Ethernet) addresses, IP addresses
are assigned by network administrators
14
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Binary numbers overview
• Binary numbers are extremely important in
data communications
– IP addresses use binary numbers
• Maximum computer network sizes depend
upon sizes of binary numbers
• You should be able to convert from 8-bit
binary numbers to decimal and vice-versa
15
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Using binary numbers
• The most important use of binary numbers in
this class is to assign computer addresses
– In this chapter, we focus on assigning computers
with a unique label
– You should be able to determine the maximum
number of addresses possible given the number
of binary digits (bits) available for labeling/
addressing
16
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Binary numbers as labels
Bits Labels
Number of
labels
2
Formula for
label count
21
4
22
000, 001, 010, 011, 8
100, 101, 110, 111
23
1
0, 1
2
00, 01, 10, 11
ID: 0
ID: 00 ID: 01 ID: 10
3
n
ID: 1
ID: 11
2n
17
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Converting from decimal to binary
• Used to compute subnet sizes, broadcast
addresses etc.
– You should be comfortable with binary numbers with
up to 8 digits
• One technique is to fill-in-the-blanks
– Start with template below
– Place 1 in the leftmost-possible position
– Subtract place-value and repeat until subtraction
yields 0
128
64
32
16
8
4
2
1
18
Functions IP
Place values
3
5
8
Digit
100
10
1
(102)
(101)
(100)
Decimal (Base 10)
Place value
1
0
1
Digit
4
2
1
(22)
(21)
(20)
Binary (Base 2)
Place value
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Converting from decimal to binary
• e.g.: 133
– 128 is less than 133
– Hence place 1 over 128, remainder is 133 – 128 = 5
1
128
64
32
16
8
4
2
1
2
1
• Largest number less than 5 is 4
– Hence place 1 over 4
– Remainder is 5 - 4 = 1
1
0
0
0
0
1
128
64
32
16
8
4
• Largest number less than or equal to 1 is 1
– Hence place 1 over 1
– You get: 10000101
20
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Converting from decimal to binary
• Try converting the following numbers to
binary
– 134
– 200
– 240
– 250
• Hint: When numbers become large,
subtraction from 255 may be easier
21
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Converting from binary to decimal
• Use the same template as before
• Add the place values corresponding to the
locations that have 1 in the number
• E.g.: 11100011
1
128
1
64
1
32
0
16
0
8
0
4
1
2
1
1
• In decimal, this number is:
1*128 + 1*64 + 1*32 + 1*2 + 1*1
= 227
22
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Converting from binary to decimal
• You should be comfortable working with
binary numbers with up to 8 bits
– e.g.: 10011011
1
128
0
64
0
32
1
16
1
8
0
4
1
2
1
1
• This number is equal to:
1*128 + 0*64 + 0*32 + 1*16 + 1*8 + 0*4 + 1*2 + 1*1
= 155
• Largest possible number with 8 digits?
23
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Converting from binary to decimal
• Try converting the following numbers to
decimal
– 10000110
– 11001000
– 11110000
– 11111010
24
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Dotted decimal notation
• IP addresses are written in dotted decimal
notation
– E.g.. 192.168.1.5
25
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
IP Addresses (dotted decimal notation)
• Examples
11000000 10101000 00000001 00000101
192 .
168 .
1
5
26
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
IP addresses – structure
• IP addresses are not assigned at random like
MAC addresses
– Or even on first-come-first-serve basis
• The first few address bits define the
organization to which the address belongs
– Remaining bits are unique to the computer (host)
within the organization
27
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
IP addresses – structure
• This is similar to phone numbers
– (813)
– Tampa
974
USF
-
6716
Office
• Or credit card numbers
–4
– Visa
31412
Bank
34 5678 4321
Account number
28
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
IP addresses – structure
• Or zip codes
–3
36
– State group
47
Region
Delivery address (PO)
• Visualization at http://benfry.com/zipdecode
29
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
IP Addresses - structure
• IP addresses are split into network part and host part
• Network part identifies the network (autonomous
system) to which the address belongs
– Most commonly associated with telecom carriers
– Also, with large organizations such as state universities
• Host part identifies the host within the network
• Host part is generally broken further into subnets
30
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
IP Address classes
• Network parts of IP addresses were initially
classified into 3 address classes
• An organization could request an address
block best suited to its needs
– Class A for the largest organizations
– Class B for organizations like Universities such as
USF
– Class C for small businesses
31
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Class A networks
•
•
•
•
•
First octet in the range 0 – 127
24 bits for host address in each network
7 bits for network ID
27 = 128 possible Class A networks
Each network has 224 = 16,777,216 IP
addresses
32
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Class B and C networks
• Class B networks
– First octet in the range 128-191
– 16 bits for host address in each network
• Each network has 216 = 65,536 IP addresses
– 14 bits for network ID
• 214 = 16,384 possible Class B networks
• Class C networks
– First octet in the range 192-223
– 8 bits for host address in each network
• Each network has 28 = 256 IP addresses
– 21 bits for network ID
• 221 = 2,097,152 possible Class C networks
33
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Address classes
0
1
2
0
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Network ID
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
23
24
25
26
27
28
29
30
31
27
28
29
30
31
Host address within network
Class A addresses
0
1
1
0
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Network ID
21
22
Host address within network
Class B addresses
0
1
2
1
1
0
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Network ID
19
20
21
22
23
24
25
26
Host address within network
Class C addresses
34
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Address classes and network
addresses
• The class of an address is uniquely identifiable
from the address itself
• Examples
– 66.3.5.2:
– 131.247.16.8:
– 221.45.67.198:
Class ?
Class ?
Class ?
• We will see in later chapters that network part
of address is very important for routing
35
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Addresses by class
Class B addresses
Total number of hosts that can have class B
addresses
Class A addresses
= 214 * 216 = 230
Total number of hosts that can have class A
addresses
= 1,073,741,824
= 27 * 224 = 231
= 2,147,483,648
Class C addresses
Total number of hosts that
can have class C
addresses
Other addresses and
unallocated addresses
= 221 * 28 = 229
= 536,870,912
= 536,870,912
36
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
CIDR
• Stands for Classless Inter-Domain Routing
– Eliminates address classes
• Defined in RFC 1519
– Focus here on addressing component of RFC
• Aims to solve two problems with classed
addresses
37
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
CIDR
• Address blocks can be of arbitrary length
– Block sizes of any power of 2 are available
• Primary beneficiaries of CIDR addressing are
medium-sized organizations
– Too big for Class C (~250 hosts), too small for Class
B (~65,000 hosts)
38
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
CIDR notation
• Address class is no longer uniquely identifiable
from the address
– We must find a way of telling routers the size of
the network part of the address
– Done by including a number along with the
network address
– E.g. 73.5.0.0/ 17
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
CIDR notation
• In the above example, the first 17 bits of the
address are the network part
• You can search for more example CIDR
address blocks at http://www.arin.net
40
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Obtaining IP addresses
• Regional registries
– IP addresses distributed around the globe
• American Registry for Internet Numbers
• RIPE Network Coordination Centre (RIPE NCC)
– Europe, the Middle East and Central Asia
• Asia-Pacific Network Information Centre (APNIC)
– Asia and the Pacific region
• Latin American and Caribbean Internet Address Registry
(LACNIC)
• African Network Information Centre (AfriNIC)
41
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Obtaining IP addresses
• Registries prefer allocating large address pools to
large carriers
• RFC 2050
– Sec 2.1: ISPs who exchange routing information with
other ISPs at multiple locations and operate without
default routing may request space directly from the
regional registry in its geographical area
• Most organizations will obtain IP addresses from
these carriers (ISPs)
42
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
Obtaining IP addresses
• Requesting initial allocation from ARIN
– http://www.arin.net/registration/guidelines/ipv4_
initial_alloc.html
• ARIN allocation pre-requisites
– http://www.arin.net/policy/nrpm.html#four
• Assigned network addresses
– RFC 790 (1981)
– http://www.iana.org/assignments/ipv4-addressspace (current)
43
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
IP version 6
• Current version of IP is 4
– IPv4 has one major limitation
– Total IPv4 address pool
• 232 = 4,294,967,296 (about 4 billion)
• Approx 1 IP address per person
• But allocation is not very efficient
44
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
IP version 6 overview
• IPv6 defined in RFC 2460
• Primarily expands source and destination
address fields
• Also simplifies packet processing at routers
– Eliminates header checksum
• And adds some telecom carrier-friendly
features such as flow labels
45
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
IP version 6 address pool
• IP version 6 is mainly intended to eliminate
shortage of IP addresses
– Total address pool = 2128 addresses =
• 340,282,366,920,938,463,463,374,607,431,768,211,45
6 addresses (340 * 1036)
• Surface area of earth = 510,007,200,000,000
m2 (510*1012 m2)
– 600 billion trillion IP addresses per square meter
of the Earth’s surface (including oceans, deserts
etc)
46
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
IP version 6 header
0
1
2
Version
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Traffic class
Payload length
19
20
21
22
23
24
25
26
27
28
29
Flow label
Next header
Hop limit
Source address
Destination address
Note: Each tick mark represents a bit position
47
30
31
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
IP version 6 header fields
• Version
–6
• Traffic class
– Similar to IPv4 TOS field
– Allows sender to specify service priority for data
• Flow label
– Allows sender to label a few packets for special
handling
48
Functions IP
IP
IP
Obtaining IP
CIDR addresses IPv6
Header addresses
IP version 6 header fields
• Payload length
– Length of data in packet
– Similar to total length field in IPv4
• Next header
– Transport layer user of IP
• Same as protocol field in IPv4
• Specified in RFC 1700
• Hop limit
– Same as TTL field of IPv4
49
Summary
•
•
•
•
•
Functions of IP
Why different parts of IP addresses
Why CIDR
Obtaining IP addresses
IP version 6
Case study – networks in the retail
sector
• Both Wal-Mart and K-Mart started in 1962
• K-Mart grew rapidly at first
– 250 stores in 1967, compared to 18 Wal-Marts
– Each K-Mart store had 6 times the revenue of a
Wal-Mart store
• 2002
– K-Mart filed for bankruptcy
– For the first time, Wal-Mart was the largest
company in America by revenue
Among other factors
• Wal-Mart relied on IT
– First computer network using phone lines in 1977
• To improve inventory refills
– Satellite network in 1987
• Cut credit card processing time by half
– EDI, RetailLink
• K-Mart relied on managerial expertise
– Used spreadsheets to track supply and demand
Hands-on exercise
• ipconfig for IP addresses
• ARIN for address block ownership
• ping
– Round trip times
– Pinging to check network connectivity
Network design
• Estimate of IP address requirements
• Address block requirement