Sei sulla pagina 1di 37

Lecture No. 5.

Network Layer:
(Internet Protocol v.4, Addressing, subnetting)

By: Engr. Mark Ryan S. To ECE and Cpe Department

Responsible
Main

for host-to-host delivery

Network Protocol is the Internet Protocol (IP)


Ex: IPv4, IPv6

How

does a host get an IP address?

DHCP: Dynamic Host Configuration Protocol DHCP dynamically gets address from a server

Internet
The

as a Connectionless Network

reason for this decision is that the Internet is made of so many heterogeneous networks that it is almost impossible to create a connection from the source to the destination without knowing the nature of the networks in advance.

The

IPv4 addresses are 32 bits in length. Newer versions like the IPv6 use 128 bits addresses.

IPv4

Format

Version

(VER) A 4-bit field defines the version of the IP A Computer is: protocol 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 was later changed by the Internet Engineering Task Force (IETF) and now called differentiated services.

Service

Type

AThe first 3 bits are called precedence bits. The next Computer is:
4 bits are called type of service (TOS) bits, and the last bit is not used. Used by the host to specify a preference for how the datagram would be handled as it makes its way through the internet.

Precedence

A 3-bit field from 0 (000) to 7 (111) Used for priority Datagrams with lowest precedence are discarded first

TOS

Bits

Similar to routing metric as Adiscussed in routing Computer is: algorithms. One and only one of the bits can be set at a time. Each router has a TOS value for each route in its routing table. TOS is used to choose a destination for the packet. The router chooses the route with the best metric that matches the TOS.

Differentiated Services A Computer is:

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 codepoint subfield are 0s, the 3 leftmost bits are interpreted the same as the precedence bits 2.) When the 3 rightmost bits are not all 0s, the 6 bits define 64 services based on the priority assignment by the Internet or local authorities

Total Length

Identification, Flags, Fragmentation offset A datagram can travel through different networks. Each router decapsulates the datagram at the receiver, processes it, and then encapsulates it. The format and size of the received and transmitted frame depend on the protocol used by the physical network through which the frame has just traveled and the frame is going to travel. Identification is used helps in reassembly. Flags 1st bit, reserved, 2nd bit, when set to 1, do not fragment (0 fragment necessary), 3rd bit If its value is 1, it means the datagram is not the last fragment (0 = last fragment) Fragmentation offset shows the relative position of this fragment with respect to the whole datagram

A Computer is:

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 the length of the data. i.e. (Total length HLEN*4)

Time

to Live

datagram has a AAComputer is: limited lifetime in its travel

through the internet. Formerly used a timestamp. Today, this field is used mostly to control the maximum number of hops (routers) visited by the datagram. The datagram is discarded when the value becomes 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),

IPv4

uses 32-bit addresses, which means that theComputer is: is 2^32 or 4,294,967,296 A address space (more than 4 billion). Notations Binary notation
01110101

Addressing

10010101

00011101 00000010

Dotted

decimal

117.149.29.2

Example:

A Computer is:

Change the following IPv4 addresses from binary notation to dotted-decimal notation.

a. 10000001 00001011 00001011 11101111 b. 11000001 10000011 00011011 11111111

Example:

A Computer is:

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

Hierarchy

IP addresses, like telephone network addresses Ahave levels of hierarchy (area code, exchange Computer is: code, subscriber number) Others can have a similar telephone number that you have, the difference lies on the area code.

Two-Level

Hierarchy (no subnetting)

Without subnetting, the address can be divided into two parts, the leftmost part defining the network and the rightmost part the host (computer or router) to the network.

Classful

Addressing Uses the concept of classes A Computer is: the address space is divided into five classes: A, B, C, D, and E.

Example: Find

A Computerof each address is: the class


a. 00000001 00001011 00001011 b. 11000001 10000011 00011011 c. 14.23.120.8 d. 252.5.15.1l1 11101111 11111111

IP Address Class

A Computer0is: N.H.H.H
N.N.H.H
N.N.N.H N/A

Format

High-Order Bit(s)

Address Range
1.0.0.0 to 126.0.0.0 128.1.0.0 to 191.254.0.0 192.0.1.0 to 223.255.254.0 224.0.0.0 to 239.255.255.25 5 240.0.0.0 to 254.255.255.25 5

No. Bits Network/ Host 7/24

Max. Hosts 16777214 (224 - 2)

B
C D E

1, 0
1, 1, 0 1, 1, 1, 0

14/16
21/8 N/A (not for commercial use) N/A

65534 (216 2)
254 (28 - 2) N/A

N/A

1, 1, 1, 1

N/A

Exactly

where the network part ends and the host part begins is calculated by routers, using a mask, a a 32-bit number in which the n leftmost bits are 1s and the 32- n rightmost bits are 0s. In IPv4 addressing, a block of addresses can be defined as w.x.y.z /n in which w.x.y.z defines one of the addresses and the /n defines the mask.
Default

masks for the following Classful addressing are: A /8 B /16

C /24

Problem
Class

with Classful addressing

A and B are rarely used because only a few requires as much as 65534 hosts. If a user needs a little over 254 hosts, instead of being given a Class C address, he would be given the next class, class B which has 65,534 addresses.

If an organization was granted a large block in class A 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, the outside 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.

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 network routers to divide the communication out into individual subnets and to the individual hosts on these subnets.

Example:
Suppose you are given a network number using Classful addressing of 200.133.175.0 1.) Determine the class:

2.) Determine the subnet mask:

Continuation 3.) Determine the addresses if you are to utilize this network to have 16 subnets with 14 hosts each.

In reality, 2 must be subtracted from all the numbers of hosts above to get the actual number of IP addresses available to use for hosts, because two addresses, namely the address which has all-0s in the host bits (this network) and the address which has all 1s in the host bits (broadcast), can not be assigned to hosts.

Broadcast

Address The address where all the bits in the host portion are set to 1. The broadcast address is used when you want to communicate data to all the hosts on a network.

Classless

Addressing CIDR: Classless Inter-Domain Routing In this scheme, there are no classes, but the addresses 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 a power of 2 (1, 2, 4, 8, ... ). 3. The first address must be evenly divisible by the number of addresses.

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 in 215,024,210. 205.16.37.32

Derivation

for restriction 3 in previous problem

IPv4 addresses use base-256 to represent an address in dotted decimal notation. The designers of the IPv4 address decided to use decimal numbers 0 to 255 as symbols and to distinguish between the symbols, a dot is used. The dot is used to separate the symbols
205.16.37.32 205 * (256^3)= 16* (256^2)= 37* (256^1)= 32* (256^0)= 3439329280 1048576 9472 32 3,440,387,360

The

first address in the block can be found by setting the 32- n rightmost bits in the binary notation 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 is the first address in the block?

The last address in the block can be found by setting the 32 - n rightmost bits in the binary notation of the address to 1s. 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 is the last 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 using the formula 2^(32-n) Example: Find the # of addresses in the previous problem.

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.0 d.) 13.2.128.0 e.) nota

Alternative:
Another

way to find the first address, the last address, and the number of addresses is to represent the 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.

The

first address can be found by AND-ing the given addresses with the mask. last address can be found by OR-ing the given addresses with the complement of the mask. number of addresses can be found by complementing the mask, interpreting it as a decimal number, and adding 1 to it.

The

The

An ISP is assigned the network number 193.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.

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 hosts with more room for future expansion on each subnet. Determine the broadcast address for Subnet #3

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 the following number of hosts:
Subnet

1: 50 hosts Subnet 2: 50 hosts Subnet 3: 50 hosts Subnet 4: 30 hosts Subnet 5: 30 hosts

Potrebbero piacerti anche