PR 1 - Merged
PR 1 - Merged
Satwase Roll No : 12
PRACTICAL NO. 1
Aim:
Study of various LAN topologies and their creation using network devices, cables and computers.
Theory:
Geometric representation of how the computers are connected to each other is known as
topology. There are five types of topologies – Mesh, Star, Bus, Ring and Hybrid.
Network topology
A network topology is the arrangement of a network, including its nodes and connecting lines.
There are two ways of defining network geometry: the physical topology and the logical (or signal)
topology. The physical topology of a network is the actual geometric layout of work-stations.
There are several common physical topologies, as described below and as shown in the illustration.
Types of Topology
1. Bus Topology
2. Star Topology
3. Ring Topology
4. Mesh Topology
5. Tree Topology
6. Hybrid Topology
A) Bus topology:
In the bus network topology, every workstation is connected to a main cable called the bus.
Name : Ayush.J.Satwase Roll No : 12
Therefore, in effect, each workstation is directly connected to every other workstation in the
network.
Conclusion:
In this experiment, I have study different LAN topologies and their creation using network
devices, cables and computers.
Name : Ayush.J.Satwase Roll No : 12
PRACTICAL NO. 2
Aim:
Study of following network devices in details
a) Repeater b) Hubs c) Switches d) Bridge e) Router f) Gateway
Theory:
Network Device
Network devices are components used to connect computers or other electronic devices together so that
they can share files or resources like printers or fax machines, etc. Devices used to setup a local area network
(LAN) are the most common types of network devices used by the public. A LAN requires a Hub, Switch,
router. Network Devices are called Communicating Devices.
Identify the purpose, features, and functions of the following network Components:
a. Repeater
b. Hubs
c. Switches
d. Bridges
e. Routers
f. Gateways
a. Repeater
A repeater operates at the physical layer. Its job is to regenerate the signal over the same network before
the signal becomes too weak or corrupted so as to extend the length to which the signal can be transmitted
over the same network. An important point to be noted about repeaters is that they do not amplify the signal.
When the signal becomes weak, they copy the signal bit by bit and regenerate it at the original strength. It
is a 2-port device.
b. Hubs
A hub is basically a multiport repeater. A hub connects multiple wires coming from different branches, for
example, the connector in star topology which connects different stations. Hubs cannot filter data, so data
packets are sent to all connected devices. Also, they do not have the intelligence to find out best path for
data packets which leads to inefficiencies and wastage.
Name : Ayush.J.Satwase Roll No : 12
Types of Hubs
Active Hub: - These are the hubs which have their own power supply and can clean, boost, and relay the
signal along with the network. It serves both as a repeater as well as wiring centre. These are used to extend
the maximum distance between nodes.
Passive Hub: - These are the hubs which collect wiring from nodes and power supply from active hub.
These hubs relay signals onto the network without cleaning and boosting them and can’t be used to extend
the distance between nodes.
Intelligent Hub: - It work like active hubs and include remote management capabilities. They also provide
flexible data rates to network devices. It also enables an administrator to monitor the traffic passing through
the hub and to configure each port in the hub.
Advantages of Hub:
1) Hub is less expensive product.
2) Hubs can extend a network total distance.
3) Hubs do not seriously affect network performance.
Disadvantages of Hub:
1) It will broadcast to all the ports
2) It runs half duplex
3) If 10 Ports in a hub it will share bandwidth of 100 Mb Ps. So each port share 10 Mbps c.
Switches
A switch is a multiport bridge with a buffer and a design that can boost its efficiency (a large number of
ports imply less traffic) and performance. A switch is a data link layer device. The switch can perform error
checking before forwarding data, that makes it very efficient as it does
not forward packets that have errors and forward good packets selectively to correct port only. In other
words, switch divides collision domain of hosts, but broadcast domain remains same.
Name : Ayush.J.Satwase Roll No : 12
Advantages of Switches:
1) Reduces the number of Broadcast Domains.
2) Intellegent device [compared to Hub's] which can make use of CAM table for Port to MAC mapping
3) Compared to Bridge, Switches are more H/w oriented therefore operations are less CPU intense [Basic
operations].
4) The cost to number of ports ratio is best for a cheaper cost you get switches with more number of ports
available than Routers.
Disadvantages of Switches:
1) Not as good as a router in limiting Broadcasts
2) Communication b/w VLAN's need inter VLAN routing [Router],but these days there are a number of
Multilayer switches available in the market.
3) Handling Multicast packets needs quite a bit of configuration & proper designing. d.
Bridges
A bridge operates at data link layer. A bridge is a repeater, with add on the functionality of filtering content
by reading the MAC addresses of source and destination. It is also used for interconnecting two LANs
working on the same protocol. It has a single input and single output port, thus making it a 2-port device.
How Network Bridges Work
Bridge devices inspect incoming network traffic and determine whether to forward or discard it according
to its intended destination. An Ethernet bridge, for example, inspects each incoming
Ethernet frame - including the source and destination MAC addresses, and sometimes the frame size - in
making individual forwarding decisions. Bridge devices operate at the data link layer (Layer 2) of the OSI
model.
Name : Ayush.J.Satwase Roll No : 12
Advantages of Bridges
1. Network Extend
Sometimes bridges act as repeaters to extend a network. Networks with different architectures can be
connected together using bridges.
2. Increased Bandwidth
Few of the nodes present on a network share a separate collision domain. For these individual nodes,
bridges increase bandwidth.
3. High Reliability
Overall, the network reliability is basically high in a bridge which makes it easier to maintain the
network. And also, network congestion can be reduced by dividing LAN into small segments.
4. Frame Buffering
Different segments use different MAC protocols. As a result, it creates frame buffers. Therefore, bridges
work to interconnect different segments.
Disadvantages of Bridges
1. Cost
On average a bridge costs more than the hub and repeaters. That is the reason why it is only preferred when
there is LAN network traffic load. In other situations of variable data load, it is advisable to use either a
hub or a repeater.
2. Speed
A bridge does more buffering of frames and introduce more relays. This makes them slower compare to a
repeater.
3. Network Performance
Since bridges make extra processing by viewing all of the MAC addresses, they can potentially
downgrade network performance.
d. Routers
Name : Ayush.J.Satwase Roll No : 12
A router is a device like a switch that routes data packets based on their IP addresses. Router is mainly a
Network Layer device. Routers normally connect LANs and WANs together and have a dynamically
updating routing table based on which they make decisions on routing the data packets. Router divide
broadcast domains of hosts connected through it.
How does a router work?
A router may create or maintain a table of the available routes and their conditions and use this information
along with distance and cost algorithms to determine the best route for a given packet. Typically, a packet
may travel through a number of network points with routers before arriving at its destination. Routing is a
function associated with the network layer (Layer 3) in the standard model of network programming, the
Open Systems Interconnection (OSI) model.
Advantage of Routers -
1) Router limits the collision domain.
2) Router can function on LAN & WAN.
3) Router can connect different media & architectures.
4) Router can determine best path/route for data to reach the destination.
5) Router can filter the broadcasts.
Disadvantage of Routers -
1) Router is more expensive than Hub, Bridge & Switch.
2) Router only works with routable protocol.
3) Routing updates consume bandwidth.
4) Increase latency due to greater degree of packet filtering.
Name : Ayush.J.Satwase Roll No : 12
e. Gateways
A gateway, as the name suggests, is a passage to connect two networks together that may work upon
different networking models. They basically work as the messenger agents that take data from one system,
interpret it, and transfer it to another system. Gateways are also called protocol converters and can operate
at any network layer. Gateways are generally more complex than switch or router.
• It can connect the devices of two different networks having dissimilar structures. • It is an
intelligent device with filtering capabilities.
• It has control over both collisions as well as a broadcast domain.
• It has the fastest data transmission speed amongst all network connecting devices. • It can
encapsulate and decapsulate the data packets.
• It has improved security than any other network connecting device.
Conclusion:
In this experiment, I have study different network devices Repeater, Hub, Switch, Bridge,
Router, Gateway with advantages and disadvantages in details.
Name : Ayush.J.Satwase Roll No : 12
EXPERIMENT NO. 3
Aim:
Familiarization with Transmission media and Tools: Co-axial, Twisted Pair and Fiber Optic
cable, Crimping Tool, Connectors etc.
Theory:
1) Transmission Mediums
Data is represented by computers and other telecommunication devices using signals. Signals are
transmitted in the form of electromagnetic energy from one device to another. Electromagnetic
signals travel through vacuum, air or other transmission mediums to travel between one point to
another (from source to receiver).
Electromagnetic energy (includes electrical and magnetic fields) includes power, voice, visible
light, radio waves, ultraviolet light, gamma rays etc.
Transmission medium is the means through which we send our data from one place to another. The
first layer (physical layer) of Communication Networks OSI Seven layer model is dedicated to the
transmission media, we will study the OSI Model later.
It is the transmission media in which signals are confined to a specific path using wire or cable.
The types of Bounded/ Guided are discussed below.
a) Coaxial Cable
Coaxial cables, commonly called coax, are copper cables with metal shielding designed to
provide immunity against noise and greater bandwidth. Coax can transmit signals over larger
distances at a higher speed as compared to twisted pair cables.
• They can span to longer distance at higher speeds as they have better shielding when
compared to twisted pair cable
Disadvantages:
• Single cable failure can fail the entire network.
• In cable TV networks
• In MANs
4. If portion of a twisted pair cable is damaged it does not affect the entire network.
(4) Local area networks such as 10 Base-T and 100 Base-T. Use the twisted pair
In fibre optics, semiconductor lasers transmit data in the form of light along with hair-thin glass
(optical) fibres at the speed of light (186,000 miles second) with no significant loss of intensity
over very long distances. The system includes fibre optic cables that are made of tiny threads of
glass or plastic.
Name : Ayush.J.Satwase Roll No : 12
• Small Size and lightweight − The size (diameter) of the optical fibers is minimal
(comparable to the diameter of a human hair).
• Easily available and low cost − The material used for producing the optical fibers is
silica glass. This material is readily applicable. Therefore, the optical fibers cost lower than the
cables with metallic conductors.
• Large Bandwidth − As the light arrays have a very high frequency in the GHz range, the
optical fiber bandwidth is vast. This allows the transmission of more numbers of channels.
Therefore, the information-carrying capacity of an optical fiber is much higher than that of a
Co-axial cable.
• High Cost − The cable and the interfaces are associatively more expensive than those of
other guided media.
Features:
• Less Secure
(ii) Microwaves –
It is a line-of-sight transmission i.e., the sending and receiving antennas need to be properly aligned
with each other. The distance covered by the signal is directly proportional to the height of the
antenna. Frequency Range:1GHz – 300GHz. These are majorly used for mobile phone
communication and television distribution.
(iii) Infrared –
Infrared waves are used for very short distance communication. They cannot penetrate through
obstacles. This prevents interference between systems. Frequency Range:300GHz – 400THz. It is
used in TV remotes, wireless mouse, keyboard, printer, etc.
Name : Ayush.J.Satwase Roll No : 12
2) Crimping tool
A crimping tool is a device used to conjoin two pieces of metal by deforming one or both of them
in a way that causes them to hold each other. The result of the tool's work is called a crimp. A good
example of crimping is the process of affixing a connector to the end of a cable. For instance,
network cables and phone cables are created using a crimping tool (shown below) to join the RJ
45 and RJ-11 connectors to the both ends of either phone or CAT5 cable.
Crimp tool: - This tool is used to attach the connectors to the cable. Typically, this tool also
includes a wire-cutter and wire-stripper. So, if you buy a crimp tool, you don't have to buy a wire
cutter and wire-striper separately.
The following image shows a crimping device equipped with a wire-stripper and wire-cutter.
3) Connector
A device that terminates a segment of cabling or provides a point of entry for networking devices
such as computers, hubs, and routers. Connectors can be distinguished according to their physical
appearance and mating properties, such as jacks and plugs (male connectors) or sockets and ports
(female connectors).
Connectors: RJ-11, RJ-45
Name : Ayush.J.Satwase Roll No : 12
Conclusion:
In this experiment, I have study different transmission media with advantages and disadvantages
also Crimping tool and Connector in details.
Name : Ayush.J.Satwase Roll No : 12
PRACTICAL NO. 4
Aim:
Study of Cisco Packet Tracer (CPT) 8.0 - Networking Simulation Tool.
Theory:
Overview of Packet Tracer
Cisco Packet Tracer is an innovative network simulation and visualization tool. This free software
helps you to practice your network configuration and troubleshooting skills via your desktop
computer or an Android or iOS based mobile device. Packet Tracer is available for both the Linux
and Windows desktop environments.
With Packet Tracer you can choose to build a network from scratch, use a pre-built sample
network, or complete classroom lab assignments. Packet Tracer allows you to easily explore how
data traverses your network. Packet Tracer provides an easy way to design and build networks of
varying sizes without expensive lab equipment.
Menu bar – This is a common menu found in all software applications; it is used to open, save, print,
change preferences, and so on.
Main toolbar – This bar provides shortcut icons to menu options that are commonly accessed,
such as open, save, zoom, undo, and redo, and on the right-hand side is an icon for entering network
information for the current network.
Logical/Physical workspace tabs – These tabs allow you to toggle between the Logical and Physical
work areas.
Workspace – This is the area where topologies are created and simulations are displayed.
Interface:
If you open the Cisco Packet Tracer you will see a blank workspace. On the bottom left corner, you
can see a lot of devices and cables. Different series of routers and switches are available to work with.
If you click on any module, you can see exactly how many types of devices are available. Just drag
Name : Ayush.J.Satwase Roll No : 12
and drop a device to workspace if you want to configure it. Different types of cables are also available
to connect those devices. With the help of cables and devices, you can create a topology and configure
it.
The top row of icons represents the category list consisting of: [Networking Devices], [End
Devices], [Components], [Connections], [Miscellaneous], and [Multiuser]. Each category contains
at least one sub-category group.
Workspace
Name : Ayush.J.Satwase Roll No : 12
a) Routers
Routers
Router Models:
Main function of a router is Internetwork Communication means connecting two or more different
networks. There are a lot of routers available in CPT such as,
b) Switches
Switches
Switch Models:
2960, Generic Switch-PT, Generic Switch Empty, 3560-24PS, 3650-24PS, IE 2000, Generic Bridge-
PT, 2950-24, 2950T.
Name : Ayush.J.Satwase Roll No : 12
c) Hubs
Hubs
Hub Models:
d) Wireless Devices
Wireless
Devices
Meraki, LAP-PT,3702i, WLC,3504,2504, Home Router, Generic Access Point-PT, Generic Access
Point-PT-A, Generic Access Point-PT-N and so on.
Name : Ayush.J.Satwase Roll No : 12
End Devices
• Generic PC-PT, Generic Laptop-PT, Generic Server-PT, Generic Printer-PT, IP Phone7960 and
so on.
Name : Ayush.J.Satwase Roll No : 12
b) Multiuser Connection
Multiuser
Connections
Components
Copper Straight-
Connections
Through
Serial DCE
Automatically Copper Cross-Over
Serial DTE
Console
Fibre
Models
Connection Models:
• Automatically Choose Connection Type, Console. Fiber, Phone, Coaxial, Serial DCE,
Serial DTE.
• Copper Straight-Through: Straight-through cables are mainly used for connecting
nonsimilar devices.
Name : Ayush.J.Satwase Roll No : 12
• Copper Cross-Over: It is widely used to connect two devices of the same type: e.g., two
computers or two switches to each other.
Common Tools
Add
Place Add
Inspect Delete Complex
Note Simple
tool tool PDU
tool PDU
Select
tool
The Common Tools Bar contains tools you will use regularly to interact with the work
space:
PRACTICAL NO. 5
Aim:
How to Connect and Configure networking Devices in Cisco Packet Tracer Simulation Tool.
a) Configuring Router hostname, Fast Ethernet Interface.
b) Configure the PC Gateway and PC IP Address.
Software: Cisco packet tracer.
Theory:
1) Create and Connecting network devices
The large white space that opens by default is the workspace where you will create your topology.
You can use the entire white space and can even scroll down and to the right to utilize a larger area.
Since our topology is very small, we will use only the left portion of the screen. This will help us
with workspace later when we are running a simulation.
Name : Ayush.J.Satwase Roll No : 12
• Do the same thing on the Switch and End Device icon. So, you can see 3 devices on the
workspace (Router, Switch, and End Device).
b) Connecting Devices:
• Click on the Connection icon for the choosing connection models, you can choose
smart connection (automatically). But this we choose the copper straight.
• Choose the Copper Straight icon to connecting the Router and Switch Device. And after
you click on the Copper icon, then click on the Router Device.
Name : Ayush.J.Satwase Roll No : 12
3. Click on the
Router device.
1. Choose the
2. Choose the Copper
Connection icon. Straight icon.
1. Choose
FastEthernet 0/0
Name : Ayush.J.Satwase Roll No : 12
• Click on the Switch device and select FastEthernet0/1. And then You can see the Router
and Switch Connected with the Copper Straight but the link between the Router and
Switch is down.
• And finally, click on the End Device (PC) and select the Fast Ethernet0.
c) Port Status
• Point out that the link between the switch and the router is down. This is because the Fast
Ethernet interface on the router is “shutdown”.
• The link between the PC and the switch is up, because the interfaces on these devices start up
in an operational state.
• These link lights are a quick visual way to determine if your links are operational.
Name : Ayush.J.Satwase Roll No : 12
2) Configuring Device:
GUI Interface:
In this example, we learned to make some basic configuration changes through a GUI interface,
while also showing them the equivalent IOS commands.
• To begin configuring a router or a switch, click on it and then click on the Config tab.
• In Global Settings, type in the Router Name in both the Display Name field (updates the
topology) and the Hostname field (updates the configuration).
• In the “Equivalent IOS Commands” window, you will see the commands for every action
you take under the Config tab.
Name : Ayush.J.Satwase Roll No : 12
• Change the name of Router0 to “My Router”.
b)
Configure Router Fast Ethernet Interface:
• To configure an interface under the Config tab, choose the interface, configure its addressing,
and then set the “Port Status” to “On”. The actual commands are shown in the “Equivalent IOS
Commands” window.
• Configure the FastEthernet0/0 interface o IP Address: 192.168.1.1
o Subnet Mask: 255.255.255.0 (The subnet mask will automatically be populated.) o
Turn Port Status to on to activate the interface.
o IOS commands are updated and the link light is now green.
c)
Configure the PC Gateway:
• After clicking the PC icon in the topology, navigate to the Config tab to enter settings for the
Gateway and Display Name.
• No two devices can share the same name in Packet Tracer, therefore, if you have a router named
“My Router”, no other device can have this name.
d)
1. Click on
FasrEthernet
under INTERFACE
to configure the
IP Address and
Subnet Mask.
• Select the Fast Ethernet link to configure the IP address and Subnet Mask.
• The default subnet mask will be filled in automatically when you tab from the IP address field.
• Note that Bandwidth and Duplex can be set to “Auto”. Add Notes:
Conclusion: In this practical, I have studied how to connect the Network Devices and
Configuring initial settings of a device in Cisco Packet Tracer Simulation Tool.
Name : Ayush.J.Satwase Roll No : 12
PRACTICAL NO. 6
Aim:
Verify Connectivity of a small network in Cisco Packet Tracer Simulation Tool.
a) Verifying connectivity using Realtime Mode.
b) Verifying connectivity using Simulation Mode.
Apparatus (Software): Cisco packet tracer 8.0.
Theory:
A) Create 3-Devices Router, Switch and End Device (PC):
In this demonstration, we can use any of the routers listed. In other topologies, use specific router
types, as you may need specific modules added to the devices.
• Do the same thing on the Switch and End Device icon. So, you can see 3 devices on the
workspace (Router, Switch, and End Device).
a) Connecting Devices:
• Click on the Connection icon for the choosing connection models, you can choose connection
models. And you get like this one:
B) Verifying Connectivity:
There are several ways to verify connectivity in Packet Tracer.
• In Realtime mode, open a command prompt from the PC desktop and issue a ping just as
you would in the classroom with real equipment.
• In Simulation Mode, create a simulation that allows you to open up the packet at different
points along the path to view how the device is processing the packet.
• Remember that this is Realtime mode, so packets are processed in real time just as they are
using real equipment.
• Most of the work so far has been completed in the Realtime Mode. In Realtime Mode, your
network is always running (like a real network) whether you are working on the network or
not. Your configurations are created and modified in real time, and the network responds in
real time.
• Simulation Mode is used to observe network traffic in a detailed and controlled pace to
observe the paths that packets take and inspect packets in detail.
• Simulation Mode allows us to create and examine packets.
Create a PDU
Name : Ayush.J.Satwase Roll No : 12
• The Add Simple PDU button is essentially a quick, graphical way to send pings.
• You can send pings between devices that have at least one interface with an IP address.
• To send a ping, press the Add Simple PDU button (the cursor changes to a “packet” icon),
click on the source device, and then click on the destination device. Note that pings will only
work if the devices have configured ports.
• After you make the request, the source device will queue an ICMP or ARP packet (or both),
which will be on standby until you press the Auto Capture/Play or Capture/Forward button.
When you press one of these buttons, the packets will start moving and you can observe the
ping process.
Name : Ayush.J.Satwase Roll No : 12
6. Successful ping
will show a green
check mark.
5. PDU list show
PDU information. 2. Event list can be filtered to
show specific kinds of traffic.
Event List
• The Event List window records (or “captures”) what happens as your PDU propagates the
network.
• If you filter out some type of PDUs on the Event List Filters, they will not show up on the
Event List. They are still in the network; you just do not see them.
• The simulation runs more quickly because you will not see the filtered events, but all filtered
PDUs still affect the network.
Playing the Simulation
• Auto Capture/Play will play the simulation from beginning to end.
• Capture/Forward will move the packet forward one hop at a time with each click of the
Capture/Forward button.
Name : Ayush.J.Satwase Roll No : 12
Output :
Results
• Packet Tracer simulations do not run on a linear time scale. Time is determined by the events
that occur. An event can be defined as any instance of a PDU that is generated in
Name : Ayush.J.Satwase Roll No : 12
the network. The Event List keeps track of all such PDU instances and lists their
information in various fields:
Conclusion: In this practical, I have studied how to Verify Connectivity of a small network in
Cisco Packet Tracer Simulation Tool.
Name : Ayush.J.Satwase Roll No : 12
EXPERIMENT NO. 7
Aim:
Create a Star Topology in Cisco Packet Tracer Simulation Tool.
Apparatus (Software): Cisco packet tracer 8.0.
Theory: Create this Star topology: There are 5 PCs and 1-Hub.
• We will begin building our network topology by selecting devices and media in which to
connect them. Several types of devices and network connections can be used.
• In which we will keep it simple by using End devices, Switches, Hubs and Connections.
Step 4: Select “Connections” and then select “Automatically choose connection types •
Draw connections from Hub to all PCs.
Name : Ayush.J.Satwase Roll No : 12
Step 5: Double click on a PC, a box will appear. Click on Desktop tab and then select IP
Configuration.
• Configure the IP address and Subnet Mask.
• The default subnet mask will be filled in automatically when you tab from the IP address
field.
Step 6: Repeat “Step 5” to set the Ips for all the PCs.
• Click on Note tool button to add notes to the topology.
• Notes are helpful reminders of configuration settings.
Name : Ayush.J.Satwase Roll No : 12
• If the source PC is marked correct it means you have successfully established the connections.
Output :
Conclusion: In this practical, I have created star topology using Cisco Packet Tracer Simulation Tool
and connection between source and destination device established successfully.
Name : Ayush.J.Satwase Roll No : 12
PRACTICAL NO. 8
Aim:
Implement a Bit stuffing program by using C programming.
Theory:
Definition
Bit stuffing is the mechanism of inserting one or more non-information bits into a message to be
transmitted, to break up the message sequence, for synchronization purpose.
In Data Link layer, the stream of bits from the physical layer is divided into data frames. The data
frames can be of fixed length or variable length. In variable - length framing, the size of each frame
to be transmitted may be different. So, a pattern of bits is used as a delimiter to mark the end of
one frame and the beginning of the next frame. However, if the pattern occurs in the message, then
mechanisms need to be incorporated so that this situation is avoided.
Byte - Stuffing − A byte is stuffed in the message to differentiate from the delimiter. This is also
called character-oriented framing.
Bit - Stuffing − A pattern of bits of arbitrary length is stuffed in the message to differentiate from
the delimiter. This is also called bit - oriented framing
When the receiver receives the message, it removes the stuffed 0s after each sequence of five 1s.
The un-stuffed message is then sent to the upper layers.
Name : Ayush.J.Satwase Roll No : 12
C Program:
#include<stdio.h>
int main() { int
i=0,count=0;
char databits[80];
Output:
Conclusion:
In this practical, I have Implement a Bit stuffing program by using C programming.
Name : Ayush.J.Satwase Roll No : 12
PRACTICAL NO. 9
Aim:
Implement a C Program to find class (A, B, C, D or E) of an IP Address.
Theory:
Definition
In this example, we will see a C program through which we can find the class of a given IP
address.
An IPv4 has range between 0 to 255 and IP Addresses are divided into 5 classes.
Approach
C Program:
#include <stdio.h>
#include <string.h>
/*
Function : extractIpAddress Arguments
:
1) sourceString - String pointer that contains ip address
2) ipAddress - Target variable short type array pointer that will store ip address octets
*/
void extractIpAddress(unsigned char *sourceString,short *ipAddress)
{
unsigned short len=0;
unsigned char oct[4]={0},cnt=0,cnt1=0,i,buf[5];
len=strlen(sourceString);
for(i=0;i<len;i++)
{
if(sourceString[i]!='.'){
buf[cnt++] =sourceString[i];
}
if(sourceString[i]=='.' || i==len-1){
buf[cnt]='\0'; cnt=0;
oct[cnt1++]=atoi(buf);
}
}
ipAddress[0]=oct[0];
Name : Ayush.J.Satwase Roll No : 12
ipAddress[1]=oct[1];
ipAddress[2]=oct[2]; ipAddress[3]=oct[3];
}
int main() {
unsigned char ip[20]={0};
short ipAddress[4];
extractIpAddress(ip,&ipAddress[0]);
return 0;
}
Name : Ayush.J.Satwase Roll No : 12
Output:
Conclusion:
In this practical, I have Implement a C Program to find class (A, B, C, D or E) of an IP Address.
Name : Ayush.J.Satwase Roll No : 12
PRACTICAL NO. 10
Aim:
Implement an Error detecting technique (Cyclic Redundancy Check) using C programming.
Theory:
Error detection techniques are responsible for checking whether any error has occurred or not in
the frame that has been transmitted via network. It does not take into account the number of error
bits and the type of error.
For error detection, the sender needs to send some additional bits along with the data bits. The
receiver performs necessary checks based upon the additional redundant bits. If it finds that the
data is free from errors, it removes the redundant bits before passing the message to the upper
layers.
There are three main techniques for detecting errors in data frames: Parity Check, Checksum and
Cyclic Redundancy Check (CRC).
CRC involves binary division of the data bits being sent by a predetermined divisor agreed upon
by the communicating system. The divisor is generated using polynomials. So, CRC is also
called polynomial code checksum.
Name : Ayush.J.Satwase Roll No : 12
• The sender performs binary division of the data segment by the divisor.
• It then appends the remainder called CRC bits to the end of data segment. This makes the
resulting data unit exactly divisible by the divisor.
Decoding
• The receiver divides the incoming data unit by the divisor.
• Otherwise, it is understood that the data is corrupted and is therefore rejected. The
receiver may then send an erroneous acknowledegment back to the sender for
retransmission.
Name : Ayush.J.Satwase Roll No : 12
C Program:
#include<stdio.h>
#include<conio.h>
//C Program: Cyclic Redundancy Check - CodeWithC.com
void main() {
int i,f[20],n[50],div[50],j,temp,quotient[20],z[10];
printf("enter the number\n"); for(i=0;i<8;i++)
{ scanf("%d",&n[i]);
}
printf("enter the divisor\n"); for(i=0;i<4;i++)
{ scanf("%d",&div[i]);
} for(i=8;i<12;i++)
{ n[i]=0; }
for(i=0;i<8;i++)
{ temp=i;
if(n[i]==1) { for
(j=0;j<4;j++)
{
if (n[temp]==div[j])
{n[temp]=0;
f[j]=0;} else
{n[temp]=1; f[j]=1;}
temp=temp+1;
} quotient[i]=1; } else
quotient[i]=0; }
printf("\nthe quotient is \n");
Name : Ayush.J.Satwase Roll No : 12
for(i=0;i<8;i++)
printf("%d",quotient[i]);
for(j=0;j<4;j++) printf("%d",f[j]);
}
Name : Ayush.J.Satwase Roll No : 12
Output:
Conclusion:
In this practical, I have Implemented an Error detecting technique (Cyclic Redundancy Check)
using C programming.