Sei sulla pagina 1di 14

NAME: NYASHA TECLA ASHTON T. CHIPO A. MOSES T.

MANDIZVIDZA MUTEMA SIBANDA CHIGOVERA CHIPANDA


REG M191832 M192063 M191861 M190488 M192246
NUMBER:

SEMESTER: 2.1

PROGRAMME: INFORMATION SYSTEMS

COURSE: DATA COMMUNICATIONS AND COMPUTER NETWORKING

COURSE CODE: IS 202

LECTURER: L. WINJI

YEAR: 2020
NETWORK LAYER- LOGICAL ADDRESSING

The network layer, found in the OSI model and the TCP\IP protocol, controls the operations of the
subnet. The main purpose of this layer is to deliver packets from the source to the destination across
multiple networks. It also divides outgoing messages into packets and to assemble incoming packets
into messages of higher languages.

Logical addressing, generated by the CPU while a program is running, is a virtual address used as a
reference to access the physical memory location by the CPU. The hardware device called the
Memory-Management Unit is used for mapping logical address to its corresponding physical
address. An IP address is used globally to refer to the logical address in the network layer of the
TCP\IP protocol.

IPv4

The Internet binary addresses are 32 bits in length, this gives us a maximum of 2 32 addresses and
these addresses are referred to as IPv4(IP version 4) addresses.

IPv4 address space

An address space is the total number of addresses used by a protocol. An IPv4 address that is used
to define the connection of a device, for example, a router to the internet. This addressing is used
for delivering packet to a device located in the same or different network. IPv4 address refers to
logical address which is a configurable address that identifies which network this host belongs to and
also a network specific number. In other words, an IPv4 address consists of two parts, a network part
and the host part.

The IPv4 addresses are stored internally as binary numbers but are represented in decimal numbers
because of simplicity. An example of an IPv4 address is 192.168.10.100, that actually represents
11000000.10101000.00001010.01100100.

In any given network, a single address is used to represent the network and one address is used for
broadcast. A network address is an IPv4 address where all hosts bits are 0 and a broadcast address is
an IPv4 address where all host bits are 1. If a protocol uses N bits to define an address, the address
space is 2n since each bit have two different values 0 or 1 and N bits have 2 n values.

 There is an equation that can be used to calculate the number of usable IPv4 addresses in a
network which is 2n -2 where “n” is the number of bits in host part.

 If IPv4 uses 32-bit address, then the address space is 2 32 or 4 294 967 296 meaning that more
than 4 billion devices can be connected to the internet.

IPV4 ADDRESS NOTATIONS

i. Binary notation-in this IPv4 is displayed as 32bits or 4 bytes. Example of a binary address is
11100000 01001100 00001010 01100111.

ii. Dotted decimal notation – used to make IPv4 more compact and easier to read and are
usually written in decimal form, e.g. 124.112.21.4

iii. Hexadecimal notation – where each hexadecimal digit is equivalent to four bits. This means
that 32-bit addresses have 8 hexadecimal digits.

CLASSFUL ADDRESSING
There are two main IPv4 address spaces the public address space and the private address space.

Public addressing

Public addressing space is divided into five classes namely

1. Class A IPv4 addresses - these are for very large networks where the first octet of a Class A IPv4
address is used to identify the network and the three remaining octets are used to identify the
host in that particular network. The leftmost bit in this address is reserved as binary 0 and dotted
decimal 0-27.

The 32 bits of a "Class A" IPv4 address can be represented as


0xxxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx

The minimum value of the leftmost octet in binaries is 00000000 (equivalent to 0 in decimal) and
the maximum possible value for the leftmost octet is 01111111 (decimal equivalent to 127) thus
a Class A IPv4 address leftmost value must range between 0-127.

2. Class B IPv4 addresses – these are for medium sized networks and the two leftmost bits are
reserved as binary 10 and dotted-decimal 1128-19111. The first two octets are used to identify
the network and the remaining two octets are used to identify the host in the current network.

The 32 bits of a "Class B" IPv4 address can be represented as


10xxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx

The minimum possible value of the leftmost octet in binary is 10000000 (decimal equivalent to
128) and the maximum possible value of the leftmost octet is 10111111 (decimal equivalent to
191) thus a Class B IPv4 address leftmost octet must range between 128-191.

3. Class C IPv4 addresses – are commonly used in small to medium sized businesses and the three
leftmost bits of the left most octet of a Class C IPv4 network is reserved as 110. The first three
octets are used to identify the network and the remaining one octet is used to identify the host
in that particular network.

The 32 bits of a Class C IPv4 address is represented as 110xxxxx.xxxxxxxx.xxxxxxxx.xxxxxx.

The minimum possible value of the leftmost octet in binary is 11000000 (decimal equivalent to
192) and the maximum possible value for the leftmost octet is 101111 (decimal equivalent to
223) thus Class C IPv4 address leftmost value must range between 192-223.

4. Class D IPv4 addresses – are known as multicast IPv4 addresses. It is a technique developed to
send packets from a single device to multiple devices without packet duplication. Four leftmost
bits of leftmost octets in a Class D IPv4 network is reserved to 1110 and the other 28 bits
identifies the group of computers the message is intended for. A single packet is sent from a
source and it is split and duplicated as needed in the network. The minimum possible value for
the leftmost octet in binary is 11100000 (decimal equivalent is 224) and the maximum possible
value for the leftmost octet in binary is 110111 (decimal equivalent to239) thus Class D IPv4
leftmost value ranges between 224-239.

5. Class E IPv4 addresses – it is used for experimental purposes only and it cannot be assigned to
IPv4 devices. Four leftmost bits of a Class E IPv4 network is reserved as 1111. The minimum
possible value for the leftmost octet in binaries is 11110000 (decimal equivalent to 240) and the
maximum possible value of the leftmost octet is 11111111 (decimal value equivalent to 225)
thus Class E IPv4 address, leftmost octet ranges between 240-255.
Private addressing

There are several blocks of private addresses that are:

Class A IPv4 address 10.0.0.0 10.255.255.255

Class B IPv4 address 172.16.0.0 172.31.255.255


Class C IPv4 address 192.168.0.0 192.168.255.255

Loopback address 120.0.0.0 127.255.255.255

1) Class A IPv4 address - provides up to 16 777 214 hosts on a single network. Widely used in most
organisations and these organisations usually subnet this range of networks into smaller sets of
hosts called subnetworks.

2) Class B IPv4 address – IP addresses fall into 16 subnets, with the ability to support up to 64 534
hosts on a network and can have up to 16 networks.

3) Class C IPv4 address - IP address fall into 254 networks and can support up to 65 534 hosts.

CLASSLESS ADDRESSING

Classless addressing uses a variable number of bits for the network and host portions of the address.
Classless addressing treats the IP address as a 32-bit stream of ones and zeroes, where the boundary
between network and host portions can fall anywhere between bit 0 and bit 31. The network
portion of an IP address is determined by how many 1's are in the subnet mask. Again, this can be a
variable number of bits, and although it can fall on an octet boundary, it does not necessarily need
to. A subnet mask is used locally on each host connected to a network, and masks are never carried
in IPv4 datagrams. All hosts on the same network are configured with the same mask, and share the
same pattern of network bits. The host portion of each host's IP address will be unique.

Subnetting

Subnetting is the process of taking bits from the host part of an IP address in order to divide the
larger network into smaller sub-networks called subnets. It is used to free up more public IPv4
addresses and segment networks for security and easier management. After subnetting, we end up
with Network Subnet Host fields. We always reserve an IP address to identify the subnet and
another one to identify the broadcast subnet address. 

Reasons for Subnetting

1. Conservation of IP addresses: Imagine having a network of 20 hosts. Using a Class C network


will waste a lot of IP addresses (254-20=234). Breaking up large networks into smaller parts
would be more efficient and would conserve a great amount of addresses.

2. Reduced network traffic: The smaller networks that created the smaller broadcast domains
are formed, hence less broadcast traffic on network boundaries.

3. Simplification: Breaking large networks into smaller ones could simplify fault troubleshooting
by isolating network problems down to their specific existence.
Subnet mask

An IP subnet mask is a number used for defining a range of IP addresses that are available within a
network.

Each IP class is equipped with its own default subnet mask which bounds that IP class to have
prefixed number of Networks and prefixed number of Hosts per network. Classful IP addressing does
not provide any flexibility of having a smaller number of Hosts per Network or more Networks per IP
Class.

Classless Inter Domain Routing (CIDR) provides the flexibility of borrowing bits of Host part of the IP
address and using them as Network in Network, called Subnet. By using subnetting, one single Class
A IP address can be used to have smaller sub-networks which provides better network management
capabilities.

Class A Subnets

In Class A, only the first octet is used as Network identifier and rest of three octets are used to be
assigned to Hosts (i.e. 16777214 Hosts per Network). To make more subnet in Class A, bits from Host
part are borrowed and the subnet mask is changed accordingly.

For example, if one MSB (Most Significant Bit) is borrowed from host bits of second octet and added
to Network address, it creates two Subnets (2 1=2) with (223-2) 8388606 Hosts per Subnet.

The Subnet mask is changed accordingly to reflect subnetting. Given below is a list of all possible
combination of Class A subnets −
In case of subnetting too, the very first and last IP address of every subnet is used for Subnet
Number and Subnet Broadcast IP address respectively. Because these two IP addresses cannot be
assigned to hosts, sub-netting cannot be implemented by using more than 30 bits as Network Bits,
which provides less than two hosts per subnet.

Class B Subnets

By default, using Classful Networking, 14 bits are used as Network bits providing (2 14) 16384
Networks and (216-2) 65534 Hosts. Class B IP Addresses can be sub-netted the same way as Class A
addresses, by borrowing bits from Host bits. Below is given all possible combination of Class B
subnetting −
Class C Subnets

Class C IP addresses are normally assigned to a very small size network because it can only have 254
hosts in a network. Given below is a list of all possible combination of subnetted Class B IP address −

Methods to Subnet

Subnet a Class C Address Using the Binary Method

It can be helpful to know how to be your own subnet mask calculator. Subnet a Class C address with
the binary method by following these four steps (which will be explained in more detail below):

1. Convert to binary.

2. Calculate the subnet address.

3. Find host range.

4. Calculate the total number of subnets and the hosts per subnet.
We will use a Class C address, which takes 5 bits from the Host field for subnetting and leaves 3 bits
for defining hosts. Having 5 bits available for defining subnets means that we can have up to 32 (2^5)
different subnets.

It should be noted that in the past using subnet zero (00000---) and all-ones subnet (11111---) was
not allowed. This is not true nowadays.

Let's use IP address 192.168.10.44 with subnet mask 255.255.255.248 or /29.

 STEP 1: Convert to Binary

 STEP 2: Calculate the Subnet Address

To calculate the IP Address Subnet you need to perform a bit-wise AND operation (1+1=1, 1+0 or 0+1
=0, 0+0=0) on the host IP address and subnet mask. The result is the subnet address in which the
host is situated.

 STEP 3: Find Host Range

We know already that for subnetting this Class C address we have borrowed 5 bits from the Host
field. These 5 bits are used to identify the subnets. The remaining 3 bits are used for defining hosts
within a particular subnet.

The Subnet address is identified by all 0 bits in the Host part of the address. The first host within the
subnet is identified by all 0s and a 1. The last host is identified by all 1s and a 0. The broadcast
address is the all 1s. Now, we move to the next subnet and the process is repeated the same way. 

The following diagram clearly illustrates this process:


 STEP 4: Calculate the Total Number of Subnets and Hosts Per Subnet

Knowing the number of Subnet and Host bits we can now calculate the total number of possible
subnets and the total number of hosts per subnet. We assume in our calculations that all-zeros and
all-ones subnets can be used. The following diagram illustrates the calculation steps.
 

Subnet a Class C Address Using the Fast Way

Now let's see how to subnet the same Class C address using a faster method. Let's again use the IP
address 192.168.10.44 with subnet mask 255.255.255.248 (/29). 

The steps to perform this task are the following:

1. Total number of subnets: Using the subnet mask 255.255.255.248, number value 248
(11111000) indicates that 5 bits are used to identify the subnet. To find the total number of
subnets available simply raise 2 to the power of 5 (2^5) and you will find that the result is 32
subnets. Note that if subnet all-zeros is not used then we are left with 31 subnets and if also
all-ones subnet is not used then we finally have 30 subnets.

2. Hosts per subnet: 3 bits are left to identify the host therefore the total number of hosts per
subnet is 2 to the power of 3 minus 2 (1 address for subnet address and another one for the
broadcast address) (2^3-2) which equals to 6 hosts per subnet.

3. Subnets, hosts and broadcast addresses per subnet: To find the valid subnets for this specific
subnet mask you have to subtract 248 from the value 256 (256-248=8), which is the first
available subnet address. Actually, the first available one is the subnet-zero which we
explicitly note. Next subnet address is 8+8=16, next one is 16+8=24 and this goes on until we
reach value 248. 

The following table provides all the subnet call information. Note that our IP address (192.168.10.44)
lies in subnet 192.168.10.40.
Network Address Translation (NAT)

It is a process in which one or more local IP address is translated into one or more Global IP address
and vice versa in order to provide Internet access to the local hosts. Also, it does the translation of
port numbers this is masks the port number of the host with another port number, in the packet
that will be routed to the destination. It then makes the corresponding entries of IP address and port
number in the NAT table. NAT generally operates on router or firewall. To access the Internet, one
public IP address is needed, but we can use a private IP address in our private network. The idea of
NAT is to allow multiple devices to access the Internet through a single public address. To achieve
this, the translation of private IP address to a public IP address is required.

Network Address Translation (NAT) working


Generally, the border router is configured for NAT this is the router which has one interface in local
(inside) network and one interface in the global (outside) network. When a packet traverse outside
the local (inside) network, then NAT converts that local (private) IP address to a global (public) IP
address. When a packet enters the local network, the global (public) IP address is converted to a
local (private) IP address.

If NAT run out of addresses this is no address is left in the pool configured then the packets will be
dropped and an Internet Control Message Protocol (ICMP) host unreachable packet to the
destination is sent.

Why mask port numbers?


Suppose, in a network, two hosts A and B are connected. Now, both of them request for the same
destination, on the same port number, say 1000, on the host side, at the same time. If NAT does an
only translation of IP addresses, then when their packets will arrive at the NAT, both of their IP
addresses would be masked by the public IP address of the network and sent to the destination.
Destination will send replies on the public IP address of the router. Thus, on receiving a reply, it will
be unclear to NAT as to which reply belongs to which host (because source port numbers for both A
and B are same). Hence, to avoid such a problem, NAT masks the source port number as well and
makes an entry in the NAT table.

NAT inside and outside addresses


Inside refers to the addresses which must be translated. Outside refers to the addresses which are
not in control of an organisation. These are the network Addresses in which the translation of the
addresses will be done.
 Inside local address – An IP address that is assigned to a host on the Inside (local) network.
The address is probably not a IP address assigned by the service provider i.e., these are
private IP address. This is the inside host seen from the inside network.

 Inside global address – IP address that represents one or more inside local IP addresses to
the outside world. This is the inside host as seen from the outside network.

 Outside local address – This is the actual IP address of the destination host in the local
network after translation.

 Outside global address – This is the outside host as seen form the outside network. It is the
IP address of the outside destination host before translation.

Types of Network Address Translation (NAT)


There are 3 ways to configure NAT:

1. Static NAT

In this, a single unregistered (Private) IP address is mapped with a legally registered (Public)
IP address this is one-to-one mapping between local and global address. This is generally
used for Web hosting. These are not used in organisations as there are many devices who
will need Internet access and to provide Internet access, the public IP address is needed.
Suppose, if there are 3000 devices who need access to the Internet, the organisation has to
buy 3000 public addresses that will be very costly.

2. Dynamic NAT

In this type of NAT, an unregistered IP address is translated into a registered (Public) IP


address from a pool of public IP address. If the IP address of pool is not free, then the packet
will be dropped as an only a fixed number of private IP address can be translated to public
addresses.
Suppose, if there is a pool of 2 public IP addresses then only 2 private IP addresses can be
translated at a given time. If 3rd private IP address wants to access Internet then the packet
will be dropped therefore many private IP addresses are mapped to a pool of public IP
addresses. NAT is used when the number of users who wants to access the Internet is fixed.
This is also very costly as the organisation have to buy many global IP addresses to make a
pool.
3. Port Address Translation (PAT)

This is also known as NAT overload. In this, many local (private) IP addresses can be
translated to a single registered IP address. Port numbers are used to distinguish the traffic
this is, which traffic belongs to which IP address. This is most frequently used as it is cost-
effective as thousands of users can be connected to the Internet by using only one real
global (public) IP address.

Advantages of NAT

 NAT conserves legally registered IP addresses.

 It provides privacy as the device IP address, sending and receiving the traffic, will be hidden.

 Eliminates address renumbering when a network evolves.

Disadvantage of NAT

 Translation results in switching path delays.

 Certain applications will not function while NAT is enabled.

 Complicates tunnelling protocols such as IPsec.

 Also, router being a network layer device, should not tamper with port numbers (transport
layer) but it has to do so because of NAT.

IPv6

An IPv6 address is a 128-bit alphanumeric string that identifies an endpoint device in the Internet
Protocol Version 6 (IPv6) addressing scheme. It offers virtually an unlimited number of IP address
that can be assigned to devices and services.

Address Structure

An IPv6 address is made of 128 bits divided into eight 16-bits blocks. Each block is then converted
into 4-digit Hexadecimal numbers separated by colon symbols.

For example, given below is a 128-bit IPv6 address represented in binary format and divided into
eight 16-bits blocks:

0010000000000001 0000000000000000 0011001000111000 1101111111100001


0000000001100011 0000000000000000 0000000000000000 1111111011111011

Each block is then converted into Hexadecimal and separated by ‘:’ symbol:

2001:0000:3238:DFE1:0063:0000:0000:FEFB

Even after converting into Hexadecimal format, IPv6 address remains long. IPv6 provides some rules
to shorten the address. The rules are as follows:

Rule 1: Discard leading Zero(es)

In Block 5, 0063, the leading two 0s can be omitted, such as (5th block)

2001:0000:3238:DFE1:63:0000:0000:FEFB

Rule.2:
If two of more blocks contain consecutive zeroes, omit them all and replace with double colon
sign ::, such as (6th and 7th block):

2001:0000:3238:DFE1:63::FEFB

Consecutive blocks of zeroes can be replaced only once by :: so if there are still blocks of zeroes in
the address, they can be shrunk down to a single zero, such as (2nd block):

2001:0:3238:DFE1:63::FEFB

Address Space

The length of an IPv6 address is 128 bits, compared with 32 bits in IPv4. The address space therefore
has 2128 = 340,282,366,920,938,463,463,374,607,431,768,211,456 addresses (approximately
3.4×1038 or 340 billion billion billion billion).

Potrebbero piacerti anche