Date post: | 26-Dec-2015 |
Category: |
Documents |
Upload: | neil-patrick |
View: | 220 times |
Download: | 2 times |
Chapter 4
Network LayerWith 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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
Functions of the Network layer
Router 3(R3)
Router 2(R2)
Router 1 (R1)
Web server
PC user
DL
dest
inat
ion
= R
1's
DL
addr
ess
IP d
estin
atio
n =
W
eb s
erve
r’s IP
ad
dres
s
IP d
ata
DL
dest
inat
ion
= R
2's
DL
addr
ess
IP d
estin
atio
n =
W
eb s
erve
r’s IP
ad
dres
s
IP d
ata
DL
dest
inat
ion
= R
3's
DL
addr
ess
IP d
estin
atio
n =
W
eb s
erve
r’s IP
ad
dres
s
IP d
ata
DL
dest
inat
ion
= W
eb
serv
er’s
DL
add
ress
IP d
estin
atio
n =
W
eb s
erve
r’s IP
ad
dres
s
IP d
ata
4
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
IP packet within data link frameD
ata-
Link
la
yer
Hea
der
IP Header
Data passed to IP from Transport layer
Dat
a-Li
nk
laye
r F
CS
Data from IP layer to data link
layer
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
IP capabilities
• Highly adaptable– Most current uses of the Internet (http, IM, bit-
torrent, 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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
IP Header
VersionHeader length
Type of service Total length
Identification Flags Fragment offset
Time to live Protocol Header checksum
Source address
Destination address
PaddingOptions
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Note: Each tick mark represents a bit position
9
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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 routers11
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
Binary numbers as labels
Bits Labels Number of labels
Formula for label count
1 0, 1 2 21
2 00, 01, 10, 11 4 22
3 000, 001, 010, 011, 100, 101, 110, 111
8 23
n 2n
ID: 0 ID: 1
ID: 00 ID: 01 ID: 10 ID: 11
17
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
Converting from decimal to binary
128 64 32 16 8 4 2 1
• 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
18
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
Place values
3 5 8 Digit
100 10 1 Decimal (Base 10) Place value
(102) (101) (100)
1 0 1 Digit
4 2 1 Binary (Base 2) Place value
(22) (21) (20)
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
Converting from decimal to binary
1
128 64 32 16 8 4 2 1
• e.g.: 133– 128 is less than 133– Hence place 1 over 128, remainder is 133 – 128 = 5
1 0 0 0 0 1
128 64 32 16 8 4 2 1
• Largest number less than 5 is 4– Hence place 1 over 4– Remainder is 5 - 4 = 1
• Largest number less than or equal to 1 is 1– Hence place 1 over 1– You get: 10000101
20
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
Converting from binary to decimal
1 1 1 0 0 0 1 1128 64 32 16 8 4 2 1
• In decimal, this number is:1*128 + 1*64 + 1*32 + 1*2 + 1*1
= 227
• Use the same template as before• Add the place values corresponding to the
locations that have 1 in the number• E.g.: 11100011
22
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
Converting from binary to decimal
1 0 0 1 1 0 1 1128 64 32 16 8 4 2 1
• You should be comfortable working with binary numbers with up to 8 bits– e.g.: 10011011
• 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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
Converting from binary to decimal
• Try converting the following numbers to decimal– 10000110– 11001000– 11110000– 11111010
24
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
Dotted decimal notation
• IP addresses are written in dotted decimal notation
– E.g.. 192.168.1.5
25
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
IP Addresses (dotted decimal notation)
• Examples
26
11000000 10101000 00000001 00000101
192 . 168 . 1 5
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
IP addresses – structure
• This is similar to phone numbers– (813) 974 - 6716– Tampa USF Office
• Or credit card numbers– 4 31412 34 5678 4321– Visa Bank Account number
28
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
IP addresses – structure
• Or zip codes– 3 36 47– State group Region Delivery address (PO)
• Visualization at http://benfry.com/zipdecode
29
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
Address classes0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
0 Network ID Host address within network
Class A addresses
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
1 Network ID Host address within network
Class B addresses
0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
1 Network ID Host address within network
Class C addresses
1 0
34
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
Address classes and network addresses
• The class of an address is uniquely identifiable from the address itself
• Examples– 66.3.5.2: Class ?– 131.247.16.8: Class ?– 221.45.67.198: Class ?
• We will see in later chapters that network part of address is very important for routing
35
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
Addresses by class
Class A addresses
Total number of hosts that can have class A addresses
= 27 * 224 = 231
= 2,147,483,648 Other addresses and unallocated addresses
= 536,870,912
Class C addresses
Total number of hosts that can have class C
addresses
= 221 * 28 = 229
= 536,870,912
Class B addresses
Total number of hosts that can have class B addresses
= 214 * 216 = 230
= 1,073,741,824
36
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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-address-sp
ace (current)
43
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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,456 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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
IP version 6 header
Version Traffic class Flow label
Payload length Next header Hop limit
Source address
Destination address
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Note: Each tick mark represents a bit position47
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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
IPIP
addressesObtaining IP addressesCIDR
IP Header
Functions IPv6
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