You are on page 1of 23

GOVERNMENT ENGINEERING

COLLEGE, RAIPUR C.G.

A Report of Vocational Training on (ROLE)


at
(Advanced educational Institute)

Submitted by
Guided by
Harsh kumar kandra
Prof. Anjum Khan, Asst. Prof Roll no. 301602219019
Department of Computer
Science
ACKNOWLEDGEMENT
 
The beatitude, bliss and euphoria that accompany the successful competition of any task
would not be completed without the expression of appreciation of simple virtues to the
people who made it possible. So with reverence, veneration and honor. I acknowledge all
those whose guidance and encouragement has helped me to complete this project.

First I would like to express my gratitude to Prof. Anjum Khan. For her valuable
guidance encouragement during the completion of training. He was a major support to me
throughout my training, being available with his ideas, inspiration and encouragement.
It is through their masterful guidance that I have been able to complete my practical
training. This section is a vote of thanks and gratitude all those persons who have directly
or indirectly contributed in their own special way towards the completion of this
dissertation.
index
 

1. Introduction

2. IP addresses
• IPv4
• IP address classes
• Unicast addressing mode
• Broadcast addressing mode
• Multicast addressing mode

3. Subnetting and subnet masks


• Subnet mask table of-
Class a
Class b
Class c
• How subnet works?

4. Training task
5. Methodology
6. Code for the task
7. Result
8. Conclusion
9. Future scope
10. Certificates
introduction
The internet as we see today is a network of networks, a virtual world where any computer on
internet appears to be connected to every other computer present on Internet.

The glue that holds the internet together is the IP (Internet Protocol). It was designed from
beginning with internetworking in mind. Its job is to provide is to provide best-efforts way to
transport datagrams from source to destination, without regard to whether these machines are on
the same network or whether there are other networks in between them.

The Internet Protocol also has the task of routing data packets between networks, and IP
Addresses specify the locations of the source and destination nodes in the topology of the routing
system.

The above window is used to manually configure the IP Address of any PC running Microsoft
Windows. In this the first half is used to configure IP Address and the second half is used to
configure the DNS server.

When the Obtain an IP address automatically is checked the computer itself finds a DHCP server
in the network and obtains an IP address dynamically from it.

When the Use the following IP address is checked we can manually assign an IP address to
the current Network Interface. It has 3 entries:
• IP address: The IP address to be assigned to current Network Interface.

• Subnet Mask: This entry is done automatically by the computer seeing the IP address
assigned. It can also be assigned manually.

• Default Gateway: This entry is the IP address of the Gateway through which the
computer can connect to other networks.
IP Address
An Internet Protocol (IP) address is a numerical identification and logical address that is
assigned to devices participating in a computer network utilizing the Internet Protocol for
communication between its nodes. Although IP addresses are stored as binary numbers, they are
usually displayed in human-readable notations, such as 208.77.188.166 (for IPv4), and
2001:db8:0:1234:0:567:1:1 (for IPv6).

IPv4:

IP version 4 (IPv4) addresses, which uniquely identify a device on an IP network, are 32 bits in
length and are typically communicated in a format known as dotted decimal. The 32 binary bits
are:

• Divided into a network portion and host portion

• Broken into four octets (1 octet = 8 bits). Each octet can be converted to binary. Consider
this IP address, which is presented in dotted decimal: 10.10.16.1.

The address breaks down into the following octets:


• 10
• 10
• 16
•1

The value in each octet ranges from 0 to 255 decimal, or 00000000– 11111111 binary.

In binary, the address 10.10.16.1 is represented as: 0000101 0.00001010.00010000.00000001

Network address: 
First address of a network is network address. It is obtained by ANDing the mask with the IP
address (Both in binary form). Another method is to set last 32-n bits of the IP address to 0.

Broadcast address: 
Last address of a network is broadcast address. It is obtained by ORing the complement mask
with the IP address (Both in binary form). Another method is to set last 32-n bits of the IP
address to 1.

Default Mask:
An address mask determines which portion of an IP address represents network number and
which part represents host number, e.g., IP address, the mask has four octets. If a given bit of
the mask is 1, the corresponding bit of the IP address is in network portion and if given bit of
mask 0, the corresponding bit of IP address is in host portion.
 

IP Address Classes
IP addresses are split up into several different categories, including Class A, B, C, D (Multicast),
and E (Reserved). Address classes are defined, in part, based on the number of bits that make up
the network portion of the address, and in turn, on how many are left for the definition of
individual host addresses.

• In Class A addresses, the first octet is the network portion.

• In Class B, the first two octets are the network portion.

• In Class C, the first 3 octets are the network portion.

Figure shows how the network and host IDs are different for each class of IP addresses

.
Class A has 3 octets for the host portion of the address. Deployed as is, a Class A address
represents a very inefficient use of address space, since available Layer 2 technologies cannot
easily support this many hosts on a single subnet. Subnetting uses this address space efficiently.

IPv4 supports three different types of addressing modes. –

Unicast Addressing Mode


In this mode, data is sent only to one destined host. The Destination Address field contains
32- bit IP address of the destination host. Here the client sends data to the targeted server −

Broadcast Addressing Mode


In this mode, the packet is addressed to all the hosts in a network segment. The Destination
Address field contains a special broadcast address, i.e. 255.255.255.255. When a host sees
this packet on the network, it is bound to process it. Here the client sends a packet, which is
entertained by all the Servers −

Multicast Addressing Mode


This mode is a mix of the previous two modes, i.e. the packet sent is neither destined to a
single host nor all the hosts on the segment. In this packet, the Destination Address contains
a special address which starts with 224.x.x.x and can be entertained by more than one host.
Here a server sends packets which are entertained by more than one servers. Every network
has one IP address reserved for the Network Number which represents the network and one
IP address reserved for the Broadcast Address, which represents all the hosts in that network.
SUBNETTING
Subnetting allows you to create multiple logical networks that exist within a single Class A, B,
or C network. If you do not subnet, you can only use one network from your Class A, B, or C
network, which is simply unrealistic. Each data link on a network must have a unique network
address, with every host on that link being a member of the same network. If you break a major
network (Class A, B, or C) into smaller subnetworks, you can create a network of interconnected
subnetworks. Each data link on this network would then have a unique network/subnetwork ID.
To subnet a network, extend the mask using some of the bits from the host ID portion of the
address to create a subnetwork ID. For example: Given a network of 192.168.5.0/24, which has
a mask of 255.255.255.0, you can create subnets in this manner:

192.168.5.0 - 11000000.10101000.00000101.00000000
255.255.255.224 - 11111111.11111111.11111111.11100000
------------------------------------------[sub]-------------------------------

The address on the left is in dotted decimal notation, and the binary representation is on the
right. When planning IP subnetting, sometimes it is easier to visualize the different portions of
the network address when looking at the binary format. The subnet mask is also represented in
dotted decimal and binary. Any address bits that have corresponding mask bits set to 1 represent
the network ID. Any address bits that have corresponding mask bits set to 0 represent the host
ID. By extending the mask to be 255.255.255.224, you’ve taken three bits (indicated by sub)
from the original host portion of the address and used them to make subnets. With these three
bits, you can create eight subnets. With the remaining five host ID bits, each subnet can have up
to 32 host addresses. A single subnet can be split up into eight 32-host subnets. Eight 32-host
subnets, however, may not be flexible enough. For example:

192.168.5.0 255.255.255.224 address range 0 to 31


192.168.5.32 255.255.255.224 address range 32 to 63

192.168.5.224 255.255.255.224 address range 224 to 255

There are two ways to denote subnet masks:

• Since you are using three bits more than the originally specified 255.255.255.0 mask, the mask
is now 255.255.255.224.

• The mask can also be denoted as /27 as there are 27 bits that are set in the mask. The mask is
denoted with the notation prefix/length. For example: 192.168.5.32/27 denotes the network
192.168.5.32 with a mask of 255.255.255.224.
Subnet Mask Number of Supported Hosts per
Network
Class A 255.0.0.0 Over 16 million
Class B 255.255.0.0 Over 16 thousand
Class C 255.255.255.0 254

• Class A subnet table:


• Class B subnet table

• Class C subnet table


The figure explains the working of the subnet: -
Task
To find out the class, network address, broadcast address and total number
of addresses in the block of class provided in a CIDR format by the user.

Process
Step 1: User needs to enter IP address of form (x.y.z.t/n) that is in CIDR format.

Step 2: Separate IP address and n

Step 3: Split IP address into 4 subparts x, y, z, t

Step 4: Converts IP address to the binary form

• Separate each number of the IP address


• Convert first number to binary
• Obtain First octet
• Convert second number to binary
• Obtain Second octet
• Convert Third number to binary
• Obtain Third octet
• Convert fourth number to binary
• Obtain Fourth octet

Step 5: Obtaining network address (first address)

Step 6: Set 32-n bits to 0

Step 7: Obtain Broadcast address (broadcast address) by setting 32-n bits to 1

Step 8: Obtain class of Address

Step 9: Prints IP address and value of n

Step 10: Convert network address to decimal

Step 11: Convert broadcast address to decimal

Step 12: Prints the class of the Ip address

Step 13: Print network address in dotted decimal format

Step 14: Print broadcast address in dotted decimal format


Step 15: Print Number of Addresses in Block

Cpp code for following task:


#include <iostream>
#include <string.h>
#include <stack>
#include <vector>
#include <math.h>

using namespace std;


// Converts IP address to the binary form
vector<int> bina(vector<string> str)
{
vector<int> re(32,0);
int a, b, c, d, i, rem;
a = b = c = d = 1;
stack<int> st;

// Separate each number of the IP address

a = stoi(str[0]);
b = stoi(str[1]);
c = stoi(str[2]);
d = stoi(str[3]);

// convert first number to binary


for (i = 0; i <= 7; i++)
{
rem = a % 2;
st.push(rem);
a = a / 2;
}

// Obtain First octet


for (i = 0; i <= 7; i++) {
re[i] = st.top();
st.pop();
}

// convert second number to binary


for (i = 8; i <= 15; i++) {
rem = b % 2;
st.push(rem);
b = b / 2;
}
// Obtain Second octet
for (i = 8; i <= 15; i++) {
re[i] = st.top();
st.pop();
}

// convert Third number to binary


for (i = 16; i <= 23; i++) {
rem = c % 2;
st.push(rem);
c = c / 2;
}

// Obtain Third octet


for (i = 16; i <= 23; i++) {
re[i] = st.top();
st.pop();
}

// convert fourth number to binary


for (i = 24; i <= 31; i++) {
rem = d % 2;
st.push(rem);
d = d / 2;
}

// Obtain Fourth octet


for (i = 24; i <= 31; i++) {
re[i] = st.top();
st.pop();
}

return (re);
}

// cls returns class of given IP address


char cls(vector<string> str)
{
int a = stoi(str[0]);
if (a >= 0 && a <= 127)
return ('A');
else if (a >= 128 && a <= 191)
return ('B');
else if (a >= 192 && a <= 223)
return ('C');
else if (a >= 224 && a <= 239)
return ('D');
else
return ('E');
}
// Converts IP address
// from binary to decimal form
vector<int> deci(vector<int> bi)
{

vector<int> arr(4,0);
int a, b, c, d, i, j;
a = b = c = d = 0;
j = 7;

for (i = 0; i < 8; i++) {

a = a + (int)(pow(2, j)) * bi[i];


j--;
}

j = 7;
for (i = 8; i < 16; i++) {

b = b + bi[i] * (int)(pow(2, j));


j--;
}

j = 7;
for (i = 16; i < 24; i++) {

c = c + bi[i] * (int)(pow(2, j));


j--;
}

j = 7;
for (i = 24; i < 32; i++) {

d = d + bi[i] * (int)(pow(2, j));


j--;
}

arr[0] = a;
arr[1] = b;
arr[2] = c;
arr[3] = d;
return arr;
}

int main()
{

string ipr ;
cout<<"Please enter address in CIDR formate ";
cin>>ipr;

// You can take user input here


// instead of using default address
// Ask user to enter IP address of form(x.y.z.t/n)
cout<<"IP address CIDR format is:"<< ipr;

// Separate IP address and n


string str1 = "";
int idx = 0;
int len = ipr.size();
len -= 3;
while(len--){
str1 += ipr[idx];
idx++;
}
cout<<endl;
cout<<"IP Address : " <<str1<<endl;

string str2 = "";


idx++;
str2 += ipr[idx];
idx++;
str2 += ipr[idx];
cout<<"Value of n : "<< str2<<endl;
// IP address
string tr = str1;

// Split IP address into 4 subparts x, y, z, t


//str = tr.split("\\.");
vector<string> str;

string temp;
int n = tr.size();
for(int i = 0; i < n; i++){
if(tr[i] >= 48 && tr[i] <= 57)
temp +=tr[i];
else{
str.push_back(temp);
temp = "";
}
}
str.push_back(temp);
//cout<<str[0]<<endl<<str[1]<<endl<<str[2]<<endl<<str[3]<<endl;

vector<int> b;

cout<<endl;
// Convert IP address to binary form
b = bina(str);

n = stoi(str2);
vector<int> ntwk(32,0);
vector<int> brd(32,0);
int t = 32 - n;

// Obtanining network address


for (int i = 0; i <= (31 - t); i++) {

ntwk[i] = b[i];
brd[i] = b[i];
}

// Set 32-n bits to 0


for (int i = 31; i > (31 - t); i--) {

ntwk[i] = 0;
}

// Obtaining Broadcast address


// by setting 32-n bits to 1
for (int i = 31; i > (31 - t); i--) {

brd[i] = 1;
}

// Obtaining class of Address


char c = cls(str);
cout<<"Class : " << c << endl;

// Converting network address to decimal


vector<int> nt = deci(ntwk);

// Converting broadcast address to decimal


vector<int> br = deci(brd);

// Printing in dotted decimal format


cout<<"First Address : " << nt[0] << "." <<nt[1] <<"." << nt[2] <<"." <<
nt[3]<<endl;

// Printing in dotted decimal format


cout<<"Last Address : " <<br[0] << "." <<br[1] << "." << br[2] <<"." << br[3]
<< endl;

//Printing Number of Addresses in Block


cout<<"Total Number of Addresses :" <<br[3]-nt[3]+1<<endl;
return 0;
}

result
conclusion
Computer Networking is a very fast project in the present developing era of electronics and
communication. Now days, computers are used in a wider range. All the organization are using
multiple computers within their departments to perform their day to day work . Computer
network allows the user to share data, share folders and files with others users connected in a
network. Computers Networking has bound the world in a very small area with it wide
networking processes like LAN, MAN, WAN. Networking inside your organization is valuable
also, In larger companies, many people never meet others in the organization that can facilitate
solving problems or getting resources. This project is forward compatible as we can add more
branches at low cost and high efficiency with effective communication between head office and
various branches of an organization

Here are five subnetting benefits one should consider:

1. Improve network performance and speed


A single broadcast packet sends out information that reaches every device connected to that
network because each device has an entry point into the network. A large number of entry
points, however, can negatively impact internetwork switching device performance, as well
as your network’s overall performance. But subnetting enables you to ensure that information
remains in the subnetted network or broadcast domain, which allows other subnets to
maximize their speed and effectiveness. Subnetting also divides your network’s broadcast
domains, enabling you to better control traffic flow, thus increasing network performance.

2. Reduce network congestion


Subnetting ensures that traffic destined for a device within a subnet stays in that subnet,
which reduces congestion. Through strategic placement of subnets, you can help reduce your
network’s load and more efficiently route traffic. using a router to move traffic between
subnets results in no broadcast traffic or any information that doesn’t need to be routed being
moved to other subnets. Because the amount of traffic within each subnet is reduced, the
speed of each subnet is increased, which eases network congestion.

3. Boost network security


You might be thinking, “What if a device in my network is comprised?” By splitting your
network into subnets, you can control the flow of traffic using ACLs, QoS, or route-maps,
enabling you to identify threats, close points of entry, and target your responses more easily.
You also can split your network using routers to connect subnets though the configuration of
ACLs on the routers and switches. As a result, devices in a subnet are unable to access the
entire network.

4. Control network growth


When you're planning and designing a network, size is something that needs to be taken into
consideration. One of the key benefits of subnetting is that it enables you to control the
growth of your network.

5. Ease administration
Are you a network admin? Then subnetting is a no-brainer because it can make your job a lot
easier. By subnetting, you can create networks that have more logical host limits, as opposed
to the limitations of IP addressing classes: Eight bits for Class A, 16 bits for Class B, and 24
bits for Class C. Think about it this way, if the internet was limited to only those three
classes, every network would have only 254, 64,000, or 16 million IP addresses for host
devices. Subnetting also is an effective way to keep tabs on the machines on your network,
which in turn can help you determine which machines need attention should problems arise.
So while they take careful planning and implementation, subnetted networks generally are
easier to manage and troubleshoot.

Future scope
Computer Networking is a huge domain. Scope for research in Computer Networking is quite
large. Networking is the backbone of Digital world. Network Security, Network
Performance, Network Model are some of the areas which are still evolving and have lot of
opportunities for research. I have did a small research work on Intrusion Detection, which is a
part of N/W security for Cloud. Computer networking is the backbone of the most important
thing known as 'Internet'. IT- infrastructure and IT- Software go hand in hand. both are
equally important for making our lives easy. As far as future scope is concerned what I feel is
we need to get ready to handle huge amount of data flowing over the internet
certificate

P a g e 23 | 23

You might also like