network layer sc
TRANSCRIPT
-
8/3/2019 Network Layer Sc
1/37
Network Layer:(Internet Protocol v.4,Addressing,subnetting)
Lecture No. 5.2
By: Engr. Mark Ryan S. ToECE and Cpe Department
-
8/3/2019 Network Layer Sc
2/37
Responsible for host-to-host delivery
Main Network Protocol is the InternetProtocol (IP) Ex: IPv4, IPv6
How does a host get an IP address? DHCP: Dynamic Host Configuration Protocol
DHCP dynamically gets address from a server
-
8/3/2019 Network Layer Sc
3/37
Internet as a Connectionless Network
The reason for this decision is that the
Internet is made of so manyheterogeneous networks that it is almostimpossible to create a connection fromthe source to the destination without
knowing the nature of the networks inadvance.
-
8/3/2019 Network Layer Sc
4/37
The IPv4 addresses are 32 bits in length.
Newer versions like the IPv6 use 128 bitsaddresses.
-
8/3/2019 Network Layer Sc
5/37
IPv4 Format
-
8/3/2019 Network Layer Sc
6/37
A Computer is:
Version (VER)
A 4-bit field defines the version of the IPprotocol version. Currently the version is 4.
Header Length (HLEN)A 4-bit field defines the total length of the
datagram header in 4-byte words.
Services
Previously called service type but waslater changed by the Internet EngineeringTask Force (IETF) and now calleddifferentiated services.
-
8/3/2019 Network Layer Sc
7/37
A Computer is:
Service Type
The first 3 bits are called precedence bits. The next4 bits are called type of service (TOS) bits, and thelast bit is not used.
Used by the host to specify a preference for howthe datagram would be handled as it makes itsway through the internet.
Precedence
A 3-bit field from 0 (000) to 7 (111) Used for priority
Datagrams with lowest precedence are discardedfirst
-
8/3/2019 Network Layer Sc
8/37
A Computer is:
TOS Bits Similar to routing metric as
discussed in routingalgorithms.
One and only one of thebits can be set at a time.
Each router has a TOSvalue for each route in itsrouting table. TOS is used
to choose a destinationfor the packet. The routerchooses the route with thebest metric that matchesthe TOS.
-
8/3/2019 Network Layer Sc
9/37
A Computer is: Differentiated Services The first 6 bits make up the codepoint subfield and
the last 2 bits are not used.
Used in two different ways
1.) When the 3 rightmost bits of the codepointsubfield are 0s, the 3 leftmost bits are interpretedthe same as the precedence bits
2.) When the 3 rightmost bits are not all 0s, the 6 bitsdefine 64 services based on the priority assignmentby the Internet or local authorities
-
8/3/2019 Network Layer Sc
10/37
A Computer is:
Total Length 16-bit field that defines the total length of the datagram in bytes.
NOTE: HLEN together with the total length can be used to find thelength of the data. i.e. (Total lengthHLEN*4)
Identification, Flags, Fragmentation offset
A datagram can travel through different networks. Eachrouter decapsulates the datagram at the receiver,processes it, and then encapsulates it. The format and sizeof the received and transmitted frame depend on theprotocol used by the physical network through which theframe has just traveled and the frame is going to travel.
Identification is used helps in reassembly. Flags1st bit, reserved, 2nd bit, when set to 1, do not
fragment (0 fragment necessary), 3rd bit If its value is 1, itmeans the datagram is not the last fragment (0 = lastfragment)
Fragmentation offset shows the relative position of this
fragment with respect to the whole datagram
-
8/3/2019 Network Layer Sc
11/37
A Computer is:
Time to Live
A datagram has a limited lifetime in its travelthrough the internet.
Formerly used a timestamp. Today, this field is usedmostly to control the maximum number of hops(routers) visited by the datagram.
The datagram is discarded when the valuebecomes zero.
Protocol An 8-bit field defines the higher-level protocol that
uses the services of the IPv4 layer.
Example: TCP (value =6), UDP (value =17),
-
8/3/2019 Network Layer Sc
12/37
A Computer is:
IPv4 uses 32-bit addresses, which means thatthe address space is 2^32 or 4,294,967,296(more than 4 billion).
Addressing Notations
Binary notation
01110101 10010101 00011101 00000010
Dotted decimal 117.149.29.2
-
8/3/2019 Network Layer Sc
13/37
A Computer is:
Example:
Change the following IPv4 addresses from binary
notation to dotted-decimal notation. a. 10000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
-
8/3/2019 Network Layer Sc
14/37
A Computer is:
Example:
Find the error, if any, in the following IPv4 addresses
a. 111.56.045.78 b. 221.34.7.8.20
c. 75.45.301.14
d. 11100010.23.14.67
-
8/3/2019 Network Layer Sc
15/37
A Computer is:
Hierarchy
IP addresses, like telephone network addresseshave levels of hierarchy (area code, exchangecode, subscriber number)Others can have a
similar telephone number that you have, thedifference lies on the area code.
Two-Level Hierarchy (no subnetting)
Without subnetting, the address can be dividedinto two parts, the leftmost part defining thenetwork and the rightmost part the host (computeror router) to the network.
-
8/3/2019 Network Layer Sc
16/37
A Computer is:
Classful Addressing
Uses the concept of classes
the address space is divided into five
classes: A, B, C, D, and E.
-
8/3/2019 Network Layer Sc
17/37
A Computer is:
Example:
Find the class of each address
a. 00000001 00001011 00001011 11101111 b. 11000001 10000011 00011011 11111111
c. 14.23.120.8
d. 252.5.15.1l1
-
8/3/2019 Network Layer Sc
18/37
A Computer is:
IP Address
Class Format
High-Order
Bit(s)
Address
Range
No. Bits
Network/
Host Max. Hosts
A N.H.H.H 0 1.0.0.0 to126.0.0.0
7/24 16777214
(224 - 2)
B N.N.H.H 1, 0 128.1.0.0 to191.254.0.0
14/16 65534 (216 -
2)
C N.N.N.H 1, 1, 0 192.0.1.0 to223.255.254.0
21/8 254 (28 - 2)
D N/A 1, 1, 1, 0 224.0.0.0 to239.255.255.255
N/A (not forcommercial
use)
N/A
E N/A 1, 1, 1, 1 240.0.0.0 to254.255.255.25
5
N/A N/A
-
8/3/2019 Network Layer Sc
19/37
Exactly where the network part ends and thehost part begins is calculated by routers, using amask, a a 32-bit number in which the n leftmostbits are 1s and the 32- n rightmost bits are 0s.
In IPv4 addressing, a block of addresses can bedefined as w.x.y.z /n in which w.x.y.z defines oneof the addresses and the /n defines the mask.
Default masks for the following Classfuladdressing are:
A /8 B /16 C /24
-
8/3/2019 Network Layer Sc
20/37
Problem with Classful addressing
Class A and B are rarely used because only afew requires as much as 65534 hosts. If a userneeds a little over 254 hosts, instead of beinggiven a Class C address, he would be given thenext class, class B which has 65,534 addresses.
-
8/3/2019 Network Layer Sc
21/37
If an organization was granted a large block in classA or B, it cou1d divide the addresses into several
contiguous groups and assign each group to smaller
networks (called subnets)
Subnets are under local administration. As such, theoutside world sees an organization as a single
network and has no detailed knowledge of the
organization's internal structure.
Subnetting supports a three-level hierarchy.
-
8/3/2019 Network Layer Sc
22/37
Subnet Mask A 32-bit subnet mask is used as a deciphering key
to determine how an IP address is to be divided
into extended network prefix (network+subnet)
and host part.
Internet routers use only the network number of the
destination address to route traffic to a subnetted
environment. It is the job of the local networkrouters to divide the communication out into
individual subnets and to the individual hosts on
these subnets.
-
8/3/2019 Network Layer Sc
23/37
Example:
Suppose you are given a network number usingClassful addressing of 200.133.175.0
1.) Determine the class:
2.) Determine the subnet mask:
-
8/3/2019 Network Layer Sc
24/37
Continuation
3.) Determine the addresses if you are to utilize thisnetwork to have 16 subnets with 14 hosts each.
In reality, 2 must be subtracted from all the numbers of hosts aboveto get the actual number of IP addresses available to use for hosts,because two addresses, namely the address which has all-0s in thehost bits (this network) and the address which has all 1s in the hostbits (broadcast), can not be assigned to hosts.
-
8/3/2019 Network Layer Sc
25/37
Broadcast Address
The address where all the bits in the host
portion are set to 1. The broadcastaddress is used when you want to
communicate data to all the hosts on a
network.
-
8/3/2019 Network Layer Sc
26/37
Classless AddressingCIDR: Classless Inter-Domain Routing
In this scheme, there are no classes, but theaddresses are still granted in blocks.
Restrictions:
1. The addresses in a block must be contiguous,one after another.
2. The number of addresses in a block must be apower of 2 (1, 2, 4, 8, ... ).
3. The first address must be evenly divisible bythe number of addresses.
-
8/3/2019 Network Layer Sc
27/37
The addresses are contiguous. (32,33,34, 47)
The number of addresses is a power of 2 (16 = 2^4)
The first address is divisible by 16. The first address, when converted to a decimal number, is
3,440,387,360, which when divided by 16 results in215,024,210. 205.16.37.32
-
8/3/2019 Network Layer Sc
28/37
Derivation for restriction 3 in previous problem
IPv4 addresses use base-256 to represent an address indotted decimal notation. The designers of the IPv4 addressdecided to use decimal numbers 0 to 255 as symbols and todistinguish between the symbols, a dot is used. The dot is used
to separate the symbols
205.16.37.32
205 * (256^3)= 3439329280
16* (256^2)= 104857637* (256^1)= 9472
32* (256^0)= 32
3,440,387,360
-
8/3/2019 Network Layer Sc
29/37
The first address in the block can be found bysetting the 32- n rightmost bits in the binarynotation of the address to 0s.
Example:
A block of addresses is granted to a small organization. We
know that one of the addresses is 205.16.37.39/28. What isthe first address in the block?
-
8/3/2019 Network Layer Sc
30/37
The last address in the block can be found by setting the 32 - nrightmost bits in the binary notation of the address to 1s.
Example:
A block of addresses is granted to a small organization. Weknow that one of the addresses is 205.16.37.39/28. What is thelast address in the block?
The number of addresses in the block is the difference
between the last and first address. It can easily be found usingthe formula2^(32-n)
Example: Find the # of addresses in the previous problem.
-
8/3/2019 Network Layer Sc
31/37
The IP address 13.2.101.18/21 belongs to which network?
a.) 131.2.101.0
b.) 13.2.0.0
c.) 13.2.96.0d.) 13.2.128.0
e.) nota
-
8/3/2019 Network Layer Sc
32/37
Alternative:
Another way to find the first address, the lastaddress, and the number of addresses is to representthe mask as a 32-bit binary (or 8-digit hexadecimal)
number.
11111111 11111111 11111111 11110000
Find:
a. The first address
b. The last address
c. The number of addresses.
-
8/3/2019 Network Layer Sc
33/37
The first address can be found by AND-ing the givenaddresses with the mask.
The last address can be found by OR-ing the given
addresses with the complement of the mask.
The number of addresses can be found bycomplementing the mask, interpreting it as a decimal
number, and adding 1 to it.
-
8/3/2019 Network Layer Sc
34/37
An ISP is assigned the network number193.1.1.0/24 and it needs to define at
least six subnets. The largest subnet is
required to support 25 hosts. Determine
the Broadcast Address for subnets 2 and
6.
-
8/3/2019 Network Layer Sc
35/37
ABC Company is assigned the network
number 140.25.0.0/16 and it must create a
set of subnets that supports up to 60 hostswith more room for future expansion on
each subnet. Determine the broadcast
address for Subnet #3
-
8/3/2019 Network Layer Sc
36/37
A corporation that has been assigned the
Class C network 165.214.32.0. The
corporation has to split this address range
into five separate networks each with thefollowing number of hosts:
Subnet 1: 50 hosts
Subnet 2: 50 hosts
Subnet 3: 50 hosts Subnet 4: 30 hosts
Subnet 5: 30 hosts
-
8/3/2019 Network Layer Sc
37/37