CN Manual Removed
CN Manual Removed
1
Title: Study of Existing LAN
Objectives:
1. To understand the structure and working of various networks including the interconnecting
devices used in them.
2. To get hands on experience of making and testing cables.
Problem Statement: Setup a wired LAN using Layer 2 Switch and then IP switch of minimum four
computers. It includes preparation of cable, testing of cable using line tester, configuration
machine using IP addresses, testing using PING utility and demonstrate the PING packets
captured traces using Wireshark Packet Analyzer Tool.
Theory:
LAN - Local Area Network
A LAN connects network devices over a relatively short distance. A networked officebuilding,
school, or home usually contains a single LAN, though sometimes one building will contain a
few small LANs (perhaps one per room), and occasionally a LAN will span a group of nearby
buildings.
WAN:
A wide area network (WAN) is a telecommunications network or computer network thatextends
over a large geographical distance. Wide area networks are often established with leased
telecommunication circuits.Business, education and government entities use wide area networks
to relay data to staff, students, clients, buyers, and suppliers from various locations across the
world. In essence, this mode of telecommunication allows a business to effectively carry out its
daily function regardless of location. The Iternnet may be considered a WAN
Network Devices:
Hubs
Hub is one of the basic icons of networking devices which works at physical layer and hence
connect networking devices physically together. Hubs are fundamentally used in networks that
use twisted pair cabling to connect devices.
They are designed to transmit the packets to the other appended devices without altering any of
the transmitted packets received. They act as pathways to direct electrical signals to travel along.
They transmit the information regardless of the fact if data packet is destined for the device
Active Hub: They are smarter than the passive hubs. They not only provide the path
for the data signals infact they regenerate, concentrate and strengthen the signals before
sending them to their destinations. Active hubs are also termed as ‘repeaters’.
Passive Hub: They are more like point contact for the wires to built in the physical
network. They have nothing to do with modifying the signals.
Switches
Switches are the linkage points of an Ethernet network. Just as in hub, devices in switches are
connected to them through twisted pair cabling. But the difference shows up in the manner
both the devices; hub and a switch treat the data they receive.
Hub works by sending the data to all the ports on the device whereas a switch transfers
it only to that port which is connected to the destination device. A switch does so by
havingan in-built learning of the MAC address of the devices connected to it.
Since the transmission of data signals are well defined in a switch hence the network
performance is consequently enhanced. Switches operate in full-duplex mode where
devices can send and receive data from the switch at the simultaneously unlike in half-
duplex mode.
The following method will elucidate further how data transmission takes place via
switches:
Bridges
A bridge is a computer networking device that builds the connection with the other
bridgenetworks which use the same protocol. It works at the Data Link layer of the
OSI Model and connects the different networks together and develops communication
between them.
It connects two local-area networks; two physical LANs into larger logical LAN or two
segments of the same LAN that use the same protocol.
Apart from building up larger networks, bridges are also used to segment larger
networks into smaller portions.
PING Command:
ping is a computer network administration software utility used to test the reachability
of a host on an Internet Protocol (IP) network. It measures the round-trip time for
messages sent from the originating host to a destination computer that are echoed back
to the source.
The name comes from active sonar terminology that sends a pulse of sound and listens
forthe echo to detect objects under water, although it is sometimes interpreted as a
backronym to packet Internet groper.Ping operates by sending Internet Control
Message Protocol (ICMP/ICMP6) Echo Request packets to the target host and
waiting for anICMP Echo Reply.
APPLICATION
Most networks in the real world use the above-mentioned devices to
create networks.
Objectives:
1. To understand the structure and working of various networks network topologies.
Problem Statement: Demonstrate the different types of topologies and types of transmission media
by using a packet tracer tool.
Theory:
NETWORK TOPOLOGY
The study of network topology recognizes seven basic topologies: [3]
Point-to-point topology
Bus (point-to-multipoint) topology
Star topology
Ring topology
Tree topology
Mesh topology
Hybrid topology
This classification is based on the interconnection between computers — be it physicalor logical.
The physical topology of a network is determined by the capabilities of the networkaccess devices
and media, the level of control or fault tolerance desired, and the costassociated with cabling or
telecommunications circuits.
Bus
Star
A star topology is designed with each node (file server, workstations, and peripherals) connected
directly to a central network hub, switch, or concentrator (See fig. 2).
Data on a star network passes through the hub, switch, or concentrator before continuing to its
destination. The hub, switch, or concentrator manages and controls all functions of the network. It
also acts as a repeater for the data flow. This configuration is common with twisted pair cable;
however, it can also be used with coaxial cable or fiber optic cable.
Tree or Expanded Star: A tree topology combines characteristics of linear bus and star
topologies. It consists of groups of star-configured workstations connected to a linear bus
backbone cable (See fig.). Tree topologies allow for the expansion of an existing network, and
enable schools to configure a network to meet their needs.
PROCEDURE
There are generally three main types of networking cables: straight-through, crossover, androllover
cables. Each cable type has a distinct use, and should not be used in place of another. So how do you
know which cable to use for what you need?
Note that some devices such as routers will have advanced circuitry, which enables them to use
both crossover and straight-through cables. In general, however, straight-through cables will not
connect a computer and router because they are not “unlike devices.”
Notice how all we did was switch the orange-white and green-white wires, and then the orange and
green wires. This will enable like devices to communicate. Crossover cables are typically used in
the following situations:
While the rule of thumb is to use crossover cables with like devices, some devices do not
follow standards. Others provide support for both types of cables. However, there is stillsomething
that both crossover and straight-through cables can’t do.
Conclusion: We have studied different types of topologies to form network and demonstrated
these topology in packet tracer.
Problem Statement: Write a program for error detection and correction for 7/8 bits ASCII
codes using Hamming Codes or CRC. Demonstrate the packets captured traces using
Wireshark Packet Analyzer Tool for peer to peer mode.
THEORY:
Cyclic Redundancy Check: CRC
CRC is a different approach to detect if the received frame contains valid data. This technique
involves binary division of the data bits being sent. The divisor is generated using
polynomials. The sender performs a division operation on the bits being sent and calculates
the remainder. Before sending the actual bits, the sender adds the remainder at the end of the
actual bits. Actual data bits plus the remainder is called a codeword. The sender transmits
data bits as codewords.
At the other end, the receiver performs division operation on codewords using the same CRC
divisor. If the remainder contains all zeros the data bits are accepted, otherwise it is
considered as there some data corruption occurred in transit.
Hamming code
Hamming codes can detect up to two-bit errors or correct one-bit errors without
detection of uncorrected errors.
General algorithm
• Write the bit numbers in binary: 1, 10, 11, 100, 101, etc.
• All bit positions that are powers of two (have only one 1 bit in the binary form of
their position) are parity bits: 1, 2, 4, 8, etc. (1, 10, 100, 1000)
• All other bit positions, with two or more 1 bits in the binary form of their
position, are data bits.
• Each data bit is included in a unique set of 2 or more parity bits, as determined
by the binary form of its bit position.
•
Each data bit is included in a unique set of 2 or more parity bits, as determined
by the binary form of its bit position.
• Parity bit 1 covers all bit positions which have the least significant bit set:
bit 1 (the parity bit itself), 3, 5, 7, 9, etc.
• Parity bit 2 covers all bit positions which have the second least significant
bit set: bit 2 (the parity bit itself), 3, 6, 7, 10, 11, etc.
• Parity bit 4 covers all bit positions which have the third least significant
bit set: bits 4–7, 12–15, 20–23, etc.
• Parity bit 8 covers all bit positions which have the fourth least significant
bit set: bits 8–15, 24–31, 40–47, etc.
• In general each parity bit covers all bits where the bitwise AND of the
parity position and the bit position is non-zero.
Example
Error detection
Error correction
Conclusion: Hence we have implemented CRC and Hamming code.
Computer Networks Lab 1
Practical No. 4
Title: Implementation of sliding window protocol(Go back N and Selective Repeat)
Objectives:To demonstrate Go back N and Selective Repeat Modes of Sliding Window Protocol
in peer to peer mode .
Problem Statement:
Write a program to simulate Go back N and Selective Repeat Modes of Sliding Window Protocol
in peer to peer mode and demonstrate the packets captured traces using Wireshark Packet
Analyzer Tool for peer to peer mode.
Outcomes:
Demonstrate Go back N and Selective Repeat Modes and also captured packets using
Wireshark Packet Analyzer Tool for peer to peer mode.
Theory:
The basic idea of sliding window protocol is that both sender and receiver keep a
``window'' of acknowledgment. The sender keeps the value of expected acknowledgment;
while the receiver keeps the value of expected receiving frame. When it receives an
acknowledgment from the receiver, the sender advances the window. When it receives the
expected frame, the receiver advances the window.
Flow Control is a set of procedures that tells the sender how much data it can transmit before it
must wait for an acknowledgment from the receiver. The flow of data should not be allowed to
overwhelm the receiver. Receiver should also be able to inform the transmitter before its limits
(this limit may be amount of memory used to store the incoming data or the processing power at
the receiver end) are reached and the sender must send fewer frames. Hence, Flow control refers
to the set of procedures used to restrict the amount of data the transmitter can send before
waiting for acknowledgment.
There are two methods developed for flow control namely Stop-and-wait and Sliding-window
Sliding window algorithms, used by TCP, permit multiple data packets to be in simultaneous
Computer Networks Lab 2
With the use of multiple frames for a single message, the stop-and-wait protocol does not
perform well. Only one frame at a time can be in transit. Efficiency can be greatly improved by
allowing multiple frames to be in transit at the same time. Efficiency can also be improved by
making use of the full-duplex line. To keep track of the frames, sender station sends sequentially
numbered frames. Since the sequence number to be used occupies a field in the frame, it should
be of limited size. If the header of the frame allows k bits, the sequence numbers range from 0 to
2k – 1. Sender maintains a list of sequence numbers that it is allowed to send (sender window).
The size of the sender’s window is at most 2k – 1. The sender is provided with a buffer equal to
the window size. Receiver also maintains a window of size 2k – 1. The receiver acknowledges a
frame by sending an ACK frame that includes the sequence number of the next frame expected.
This also explicitly announces that it is prepared to receive the next N frames, beginning with the
number specified. This scheme can be used to acknowledge multiple frames. It could receive
frames 2, 3, 4 but withhold ACK until frame 4 has arrived. By returning an ACK with sequence
number 5, it acknowledges frames 2, 3, 4 in one go. The receiver needs a buffer of size 1.
Sliding window algorithm is a method of flow control for network data transfers. TCP, the
Internet's stream transfer protocol, uses a sliding window algorithm.
A sliding window algorithm places a buffer between the application program and the network
data flow. For TCP, the buffer is typically in the operating system kernel, but this is more of an
implementation detail than a hard-and-fast requirement.
Data received from the network is stored in the buffer, from where the application can read at its
own pace. As the application reads data, buffer space is freed up to accept more input from the
network. The window is the amount of data that can be "read ahead" - the size of the buffer, less
the amount of valid data stored in it. Window announcements are used to inform the remote host
of the current window size.
An example of a sliding window in packet transmission is one in which, after the sender
fails to receive an acknowledgement for the first transmitted packet, the sender "slides"
the window, i.e. resets the window, and sends a second packet. This process is repeated
Computer Networks Lab 3
for the specified number of times before the sender interrupts transmission. Sliding
window is sometimes (loosely) called acknowledgement delay period.
Go-Back-N Protocol and “Selective Repeat Protocol” are the sliding window protocols. The
sliding window protocol is primarily an error control protocol, i.e. it is a method of error
detection and error correction. The basic difference between go-back-n protocol and selective
repeat protocol is that the “go-back-n protocol” retransmits all the frames that lie after the
frame which is damaged or lost. The “selective repeat protocol” retransmits only that frame
which is damaged or lost.
Go back N ARQ
Go-Back-N ARQ simplifies the process at the receiver site. The receiver keeps track of only one
variable, and there is no need to buffer out-of-order frames; they are simply discarded. However,
this protocol is very inefficient for a noisy link. In a noisy link a frame has a higher probability of
damage, which means the resending of multiple frames. This resending uses up the bandwidth
and slows down the transmission. For noisy links, there is another mechanism that does not
resend N frames when just one frame is damaged;only the damaged frame is resent. This
mechanism is called Selective RepeatARQ.
Computer Networks Lab 5
3. All the frames after the damaged frame are discarded and the retransmitted frames arrive
in a sequence from a damaged frame onwards, so, there is less headache of sorting the
frames hence it is less complex. On the other hand only damaged or suspected frame is
retransmitted so, extra logic has to be applied for sorting hence, it is more complicated.
4. Go-Back-N has a window size of N-1 and selective repeat have a window size
<=(N+1)/2.
5. Neither sender nor receiver need the sorting algorithm in Go-Back-N whereas, receiver
must be able to sort the as it has to maintain the sequence.
6. In Go-Back-N receiver discards all the frames after the damaged frame hence, it don’t
need to store any frames. Selective repeat protocol does not discard the frames arrived
after the damaged frame instead it stores those frames till the damaged frame arrives
successfully and is sorted in a proper sequence.
7. In selective repeat NAK frame refers to the damaged frame number and in Go-Back-N,
NAK frame refers to the next frame expected.
8. Generally the Go-Back-N is more is use due to its less complex nature instead of
Selective Repeat protocol.
Conclusion: Hence we have implemented of sliding window protocol(Go back N and Selective
Repeat).
Practical No. 5
PROBLEM STATEMENT:
Prerequisite:
1. IP Address Classes
2. Classless & Classful IP Addressing
Learning Objectives:
1. Understand the concept Subneting.
2. Understand the Concept of Supernet.
Theory
Introduction
Classes of Address
A: 0-127
Class B: 128-191
Class C: 192-223
Class D: 224-239
Class E: 240-255
14.23.120.8 - The first byte of the address represents 14 which lies between 0 and
127, hence Class A address.
134.11.78.56 - The first byte of address is 134 which lies between 128 and 191
hence the address belongs to Class B.
193.14.56.22 - As first byte is 193 which is between 192 and 223, hence the address
belongs to Class C.
Subnet Mask
Frequently, the Network & Host portions of the address need to be separately extracted.
In most cases, if you know the address class, it’s easy to separate the 2 portions.
Default Mask:
Has predetermined number of 1s
Class A, B and C contains 1s in network ID fields for default subnet mask.
Class A 11111111.00000000.00000000.00000000
Class B 11111111.11111111.00000000.00000000
Class C 11111111.11111111.11111111.00000000
addresses:
IP Subnetting:
Subnetting:
■ Division of a network into subnets
● A subnet mask is used to facilitate the flow of traffic between the different subnets
● A hop is the distance a data packet travels form one node to the other .
■ Number of Subnets=(2n)
■ Although the 2 formulas look identical, the key is to remember the number you’re
trying to calculate, hosts or subnets.
■ Eg., suppose you are asked to determine the number of subnets available & the
number of hosts available on each subnet on the network 192.168.1.0
■ Using the subnet & hosts formulas, the answers are easily calculated. Of course, you
must know your powers of 2 to calculate the answers
Example:
Given the following Host IP Address, Network Mask and Subnet mask find the Major
Network Address, Network Broadcast Address, Range of Host if not subnetted, Subnet
Address, range of host (First address and last address) ,Broadcast address,Total no of
subnets and number of hosts per subnet.
2. Perform a bit-wise AND operation on the IP Address and the Subnet Mask
4. The result is the Subnet Address of this Subnet or “Wire” which is 138.101.114.192
3. Add 0’s for the rest of the bits in the Network Address
Determine which bits in the address contain Network (subnet) information and
which contain Host information:
■ Use the Network Mask: 255.255.0.0 and divide (Great Divide) the from the rest of
the address.
■ Use Subnet Mask: 255.255.255.192 and divide (Small Divide) the subnet from the
hosts between the last “1” and the first “0” in the subnet mask.
First Host 10001010 01100101 01110010 11 000001 138 101 114 193
Last Host 10001010 01100101 01110010 11 111110 138 101 114 254
Conclusion:
Hence we have studied Subnetting and the importance of subnetting.
PROBLEM STATEMENT:
Write a program to implement link state /Distance vector routing protocol to find
suitable path for transmission
Prerequisite:
1.Shortest path finding
2. Classification of routing Algorithm
LearningObjectives:
1. Understand the concept Distance vector routing
2. Understand the Concept of Routing Algorithms
Theory
A distance-vector routing (DVR) protocol requires that a router inform its neighbors of
topology changes periodically. Historically known as the old ARPANET routing algorithm
(or known as Bellman-Ford algorithm).
Bellman Ford Basics – Each router maintains a Distance Vector table containing the distance
between itself and ALL possible destination nodes. Distances,based on a chosen metric, are
computed using information from the neighbors’ distance vectors.
1. A router transmits its distance vector to each of its neighbors in a routing packet.
2. Each router receives and saves the most recently received distance vector from
each of its neighbors.
3. A router recalculates its distance vector when:
○ It receives a distance vector from a neighbor containing different
information than before.
○ It discovers that a link to a neighbor has gone down.
7.4.1 Introduction
Problem Definition :
Use packet Tracer tool for configuration of 3 router network using one of the
following protocol RIP/OSPF/BGP
● Prerequisite
1. Routing Protocols.
2. Basics of Packet Tracer.
● Learning Objectives:
1. To Understand Simulation Tool.
2. Should Able to Configure Routing Protocols
Theory:
Introduction
● OSPF is an interior gateway protocol (IGP) for routing Internet Protocol (IP) packets
solely within a single routing domain, such as an autonomous system. It gathers link
state information from available routers and constructs a topology map of the
network. The topology is presented as a routing table to the Internet layer which
routes packets based solely on their destination IP address.
● Open Shortest Path First (OSPF) is a routing protocol for Internet Protocol (IP)
networks. It uses a link state routing (LSR) algorithm and falls into the group of
interior gateway protocols (IGPs), operating within a single autonomous system (AS).
SNJB’s KBJ COE , Chandwad Computer Network & Security Lab 2019 pattern 1
CONFIGURE ROUTING INFORMATION PROTOCOL (RIP)
Open the router 1 (R1) which is the main router connected to ISP router. Do the following
command for RIP Routing.
R1>enable
R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#network 200.100.10.0
DHCP message types:
R1(config-router)#network 192.168.20.0
R1(config-router)#network 10.10.10.0
R1(config-router)#
After enabling router with enable command then go to privileged mode with configure
terminal command. Now with router rip command, enable routing for all routers. The
version 2 Command, configure routing information protocol with version two. And next set
all network id like the above network command. I have set all three network which connect
directly to R1.
For ISP router, just enter the network id 200.100.10.0, because only one network
connected to ISP router.
ISP>enable
ISP#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
ISP(config)#router rip
R1>enable
R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#router ospf 1
R1(config-router)#network 20.10.10.0 0.0.0.3 area 0
R1(config-router)#network 10.10.10.0 0.0.0.3 area 0
R1(config-router)#network 10.10.10.4 0.0.0.3 area 0
R1(config-router)#
The router OSPF command is enable OSPF routing on the router, and the 1 before OSFP is the
process ID of the OSFP Protocol. You can set different process id from “1-65535” for each
router.
The network command with network ID “network 20.10.10.0” is the network identifier, and
the “ 0.0.0.3″ is the wildcard mask of 20.10.10.0 network. Wildcard mask determine which
interfaces to advertise, because OSPF advertise interfaces, not networks.
Conclusion:
Hence we have studied Packet Tracer Properly for implementation of RIP & OSPF.
Prerequisite:
a) Socket Header b) Network Programming c) Ports
Learning Objectives:
1. To understand Work of Socket
2. Different methods associated with Client & Server Socket
New Concepts:
1. Client Server Communication
2. Port Address
Theory:
Introduction
Theory: Socket Programming: The Berkeley socket interface, an API, allows
communications between hosts or between processes on one computer, using the concept of
a socket. It can work with many different I/O devices and drivers, although support for these
depends on the operating system implementation. This interface implementation is implicit
for TCP/IP, and it is therefore one of the fundamental technologies underlying the Internet.
It was first developed at the University of California, Berkeley for use on Unix systems. All
modern operating systems now have some implementation of the Berkeley socket interface,
as it has become the standard interface for connecting to the Internet. Programmers can
make the socket interfaces accessible at three different levels, most powerfully and
fundamentally at the RAW socket level. Very few applications need the degree of control over
outgoing communications that this provides, so RAW sockets support was intended to be
available only on computers used for developing Internet related technologies. TCP TCP
provides the concept of a connection. A process creates a TCP socket by calling the socket()
function with the parameters PF_INET or PF_INET6 and SOCK_STREAM. Server Setting up a
simple TCP server involves the following steps: Creating a TCP socket, with a call to socket().
Computer Networks Lab 2 Binding the socket to the listen port, with a call to bind(). Before
calling bind(), aprogrammer must declare a sockaddr_in structure, clear it (with bzero()
SNJB’s KBJ COE , Chandwad Computer Network & Security Lab 2019 pattern 1
ormemset()), and the sin_family (AF_INET or AF_INET6), and fill its sin_port (the listening
port, in network byte order) fields. Converting a short int to networkbyte order can be done
by calling the function htons() (host to network short). Preparing the socket to listen for
connections (making it a listening socket), with acall to listen(). Accepting incoming
connections, via a call to accept(). This blocks until anincoming connection is received, and
then returns a socket descriptor for theaccepted connection. The initial descriptor remains a
listening descriptor, andaccept() can be called again at any time with this socket, until it is
closed. Communicating with the remote host, which can be done through send() andrecv().
Eventually closing each socket that was opened, once it is no longer needed, using close().
Note that if there were any calls to fork(), each process must close the sockets it knew about
(the kernel keeps track of how many processes have a descriptor open), and two processes
should not use the same socket at once. Client: Setting up a TCP client involves the following
steps:
1. Creating a TCP socket, with a call to socket().
2. Connecting to the server with the use of connect, passing a sockaddr_in structure with the
sin_family set to AF_INET or AF_INET6, sin_port set to the port the end point is listening (in
network byte order), and sin_addr set to the IPv4 or IPv6address of the listening server (also
in network byte order.)
3. Communicating with the server by send()ing and recv()ing.Terminating the connection
and cleaning up with a call to close(). Again, if therewere any calls to fork(), each process
must close() the socket. Functions:
4. socket(): socket() creates an endpoint for communication and returns a descriptor.
socket() takes three arguments: domain, which specifies the protocol family of the created
socket.
For example: PF_INET for network protocol IPv4 or PF_INET6 for IPv6). type, one of:
Computer Networks Lab 3 SOCK_STREAM (reliable stream-oriented service) SOCK_DGRAM
(datagram service) SOCK_SEQPACKET (reliable sequenced packet service), or SOCK_RAW
(raw protocols atop the network layer). protocol usually set to 0 to represent the default
transport protocol for the specified domain and type values (TCP for PF_INET or PF_INET6
and SOCK_STREAM, UDP for those PF_ values and SOCK_DGRAM), but which can also
4. Perform communication with client Receive from client: String line = is.readLine(); Send to
client: os.writeBytes(“Hello\n”)
Methods Associated with Socket:The following diagram shows the complete Client and Server
interaction –
Problem Definition:
Write a program using UDP Sockets to enable file transfer (Script, Text, Audio and
Video one file each) between two machines
Prerequisite:
a) Socket Header b) Network Programming c) Ports
Learning Objectives:
1. To understand Work of Socket
2. Different methods associated with Client & Server Socket
New Concepts:
1. Client Server Communication
2. Port Address
Theory:
Introduction
What is UDP?
UDP is a connectionless and unreliable transport protocol.The two ports serve to identify the
end points within the source and destination machines. User Datagram Protocol is used, in
place of TCP, when a reliable delivery is not required.However, UDP is never used to send
important data such as web-pages, database information, etc. Streaming media such as
video,audio and others use UDP because it offers speed.
Why UDP is faster than TCP?
The reason UDP is faster than TCP is because there is no form of flow control. No error
checking,error correction, or acknowledgment is done by UDP.UDP is only concerned with
speed. So when, the data sent over the Internet is affected by collisions, and errors will be
present. UDP packet's called as user datagrams with 8 bytes header. A format of user
datagrams is shown in figur 3. In the user datagrams first 8 bytes contains header information
and the remaining bytes contains data.
APPLICATION :
Socket programming is essential in developing any application over a network.
Problem Definition:
Write a program for DNS lookup. Given an IP address input, it should return URL and vice
versa.
Prerequisite:
1. IP Address and OSI & TCP/IP Model.
2. Role of different servers.
3. Working of internet.
Learning Objectives:
1. Understand what is Domain Name System and DNS lookup working.
2. Understand what is DNS Structure and Hierarchy.
New Concepts:
1. Name Server and Domain Name System.
2. DNS lookup, Zone
Theory
Introduction
The Domain Name System (DNS) is a hierarchical decentralized naming system for
computers, services, or other resources connected to the Internet or a private network. It
associates various information with domain names assigned to each of the participating
entities.
it translates more readily memorized domain names to the numerical IP addresses needed
for locating and identifying computer services and devices with the underlying network
protocols. By providing a worldwide, distributed directory service, the Domain Name
System is an essential component of the functionality on the Internet that has been in use
since 1985.
HOST.TXT files:
The ARPANET, the predecessor of the Internet, had no distributed host name database.
Each network node maintained its own map of the network nodes as needed and assigned
those names that were memorable to the users of the system.
The hosts file contains lines of text consisting of an IP address in the first text field followed
by one or more host names. Each field is separated by white space – tabs are often preferred
for historical reasons, but spaces are also used. Comment lines may be included; they are
indicated by an octothorpe (#) in the first position of such lines. Entirely blank lines in the
file are ignored. For example, a typical hosts file may contain the following:
127.0.0.1 localhost loopback
::1 localhost
Domain Name Space
The domain name space refers a hierarchy in the internet naming structure. This hierarchy
SNJB’s KBJ COE , Chandwad Computer Network & Security Lab 2019 pattern 1
has multiple levels (from 0 to 127), with a root at the top. The following diagram shows
the domain name space hierarchy:
Name Server
Name server contains the DNS database. This database comprises of various names and
their corresponding IP addresses. Since it is not possible for a single server to maintain
entire DNS database, therefore, the information is distributed among many DNS servers.
∙ Hierarchy of server is same as hierarchy of names.
∙ The entire name space is divided into the zones
Zones
Zone is collection of nodes (sub domains) under the main domain. The server maintains a
database called zone file for every zone.
If the domain is not further divided into sub domains then domain and zone refers to the
same thing. The information about the nodes in the sub domain is stored in the servers at
the lower levels however; the original server keeps reference to these lower levels of
servers.
Types of Name Servers
Following are the three categories of Name Servers that manages the entire Domain
Name System:
1. Root Server
2. Primary Server
3. Secondary Server
Conclusion: Hence we conclude that we have lookup the URL which we want to visit the request is
travels to local router to DNS server and it resolve the query as possible otherwise it forwards the query to
next DNS hop.
Problem Definition:
Installing and configure DHCP server and write a program to install the software on
remote machine.
Prerequisite:
1. Knowledge about IP and Subnets.
2. Linux basic commands.
Learning Objectives:
1. Understand the concept of DHCP.
2. Configuring DHCP and installation of software.
New Concepts:
1. Crimping
2. Access Point Configuration
Theory
Introduction
2. DHCP Offer
3. DHCP Discover: At this time, the DHCP client can start to use the IP address
4. DHCP Release: At this time, the DHCP client has released the IP address
Conclusion:
Hence we Installed and Configured DHCP and studied Installation of Software
on remote Machine.
Problem Definition: Capture packets using Wireshark, write the exact packet capture filter
expressions to accomplish the following and save the output in file:
1. Capture all TCP traffic to/from Facebook, during the time when you log in to your Facebook
account
2. Capture all HTTP traffic to/from Facebook, when you log in to your Facebook account
3. Write a DISPLAY filter expression to count all TCP packets (captured under item #1) that
have the flags SYN, PSH, and RST set. Show the fraction of packets that had each flag set.
4. Count how many TCP packets you received from / sent to Facebook, and how many of each
were also HTTP packets.
Prerequisite:
1. Knowledge about Packet tracer
2. TCP and UDP basics
Learning Objectives:
1. Understand the concept and working of Wireshark
Theory
Ethernet: Ethernet is a way of connecting computers together in a local area network. It has
been the most widely used method of linking computers together in LANs since the 1990s.
The basic idea of its design is that multiple computers have access to it and can send data at
any time.
This is comparatively easy to engineer. If two computers send data at the same time, a
collision will occur. When this happens, the data sent is not usable. In general, both computers
will stop sending, and wait a random amount of time, before they try again.
A special protocol was developed to deal with such problems. It is called Carrier sense
multiple access with collision detection or CSMA/CD. Different cable types there are different
Ethernet standards. Today, Ethernet cables look like thick telephone cables. They connect to
boxes called hubs or switches.
Each cable runs from a computer's network interface card (NIC) to such a box. This cable is
called 10BaseT or 100BaseT, or 1000BaseT Cable. All cable types: 10Base2 and 10Base5:
These coaxial cables are like those used in television, but they are a bit thinner. They are also
called "thinnet" or "coax". Each computer has a "T" plugged into it, and cables plug into each
side of the "T". Sometimes, instead of a "T", a vampire tap is used which goes through the skin
of a cable. It supports 10MBits per second transfer speed, and was the first to be adopted.
10BaseT: Cables look like thick phone cables, but with 8 copper wires instead of 2 or 4, and
GCOERC, Nashik Computer Network & Security Lab 2019 pattern 1
they go from each computer' to a Hub or a Switch. Supported speed is 10 MBit/second.
10BaseF: Same as 10BaseT, but cables transmit light pulses, instead of electrical signals.
100BaseT: Cables look the same as 10BaseT, but can run at up to 100 MBits per second
1000BaseT: Cables look the same as 10BaseT, but can run at up to 1GBit (1000MBit) per
second.
IP has the task of delivering packets from the source host to the destination host solely based
on the IP addresses in the packet headers. For this purpose, IP defines packet structures that
encapsulate the data to be delivered. It also defines addressing methods that are used to label
the datagram with source and destination information. Historically, IP was the
connectionless datagram service in the original
Transmission Control Program introduced by Vint Cerf and Bob Kahn in 1974; the other
being the connection-oriented Transmission Control Protocol (TCP). The Internet protocol
suite is therefore often referred to as TCP/IP.
The first major version of IP, Internet Protocol Version 4 (IPv4), is the dominant protocol of
the Internet. Its successor is Internet Protocol Version 6 (Ipv6). Function: The Internet
Protocol is responsible for addressing hosts, encapsulating data into datagrams (including
fragmentation and reassembly) and routing datagrams from a source host to a destination
host across one or more IP networks.For these purposes, the Internet Protocol defines the
format of packets and provides an addressing system.
The IP header includes source IP address, destination IP address, and other metadata needed
to route and deliver the datagram. The payload is the data that is transported. This method
of nesting the data payload in a packet with a header is called encapsulation.
In theory, a transport layer protocol could be a very simple software routine, but the TCP
protocol cannot be called simple. Why use a transport layer which is as complex as TCP? The
most important reason depends on IP's unreliability. In fact all the layers below TCP are
unreliable and deliver the datagram hop-by-hop.
The IP layer delivers the datagram hop-by-hop and does not guarantee delivery of a
datagram; it is a connectionless system. IP simply handles the routing of datagrams; and if
problems occur, IP discards the packet without a second thought, generating an error
message back to the sender in the process. The task of ascertaining the status of the
datagrams sent over a network and handling the resending of information
if parts have been discarded falls to TCP. Most users think of TCP and IP as a tightly knit pair,
but TCP can be, and frequently is, used with other transport protocols. For example, TCP or
parts of it are used in the File Transfer Protocol (FTP) and the Simple Mail Transfer Protocol
(SMTP), both of which do not use IP. The Transmission Control Protocol provides a
considerable number of services to the IP layer and the upper layers. Most importantly, it
provides a connection-oriented protocol to the upper layers that enable an application to be
sure that a datagram sent out over the network was received in its entirety. In this role, TCP
acts as a message-validation protocol providing reliable communications.
Once a connection is established this is always sent. Data Offset: 4 bits The number of 32 bit
words in the TCP Header. This indicates where the data begins. The TCP header (even one
including options) is an integral number of 32 bits long. Reserved: 6 bits Reserved for future
use. Must be zero. Control Bits: 6 bits (from left to right): URG: Urgent Pointer field significant
ACK: Acknowledgment field significant PSH: Push Function RST: Reset the connection SYN:
Synchronize sequence numbers FIN: No more data from sender Window: 16 bits The number
of data octets beginning with the one indicated in the acknowledgment field which the sender
of this segment is willing to accept. Checksum: 16 bits
The checksum field is the 16 bit one's complement of the one's complement sum of all 16 bit
words in the header and text. If a segment contains an odd number of header and text octets
to be checksummed, the last octet is padded on the right with zeros to form a 16 bit word for
checksum purposes. The pad is not transmitted as part of the segment. While computing the
checksum, the checksum field itself is replaced with zeros.
The urgent pointer points to the sequence number of the octet following the urgent data. This
field is only be interpreted in segments with the URG control bit set. Options: variable Options
may occupy space at the end of the TCP header and are a multiple of 8 bits in length. All
options are included in the checksum. An option may begin on any octet boundary. There are
two cases for the format of an option:
What is UDP?
'Figure 2:UDP UDP is a connectionless and unreliable transport protocol.The two ports serve
to identify the end points within the source and destination machines. User Datagram
Protocol is used, in place of TCP, when a reliable delivery is not required.However, UDP is
never used to send important data such as web-pages, database information, etc. Streaming
media such as video,audio and others use UDP because it offers speed.
3. In the user datagrams first 8 bytes contains header information and the remaining bytes
contains data.
In this UDP does not need to establish a connection before sending data. Communication
consists only of the data segments themselves
• Same best effort semantics as IP
• No ack, no sequence, no flow control
• Subject to loss, duplication, delay, out-of-order, or loss of connection
• Fast, low overhead 1.Suit for reliable, local network 2.RTP(Real-Time Transport Protocol)
Conclusion: Thus we have studied packet formats captured through Wireshark for
wired network
Problem Definition: Study and Analyze the performance of HTTP, HTTPS and FTP protocol
using Packet tracer tool.
The File Transfer Protocol (FTP) is a standard network protocol used for the transfer of
computer files between a client and server on a computer network.
FTP employs a client-server architecture whereby the client machine has an FTP client
installed and establishes a connection to an FTP server running on a remote machine. After
the connection has been established and the user is successfully authenticated, the data
transfer phase can begin.
Worth noting: Although FTP does support user authentication, all data is sent in clear text,
including usernames and passwords. For secure transmission that protects the username
and password, and encrypts the content, FTP is often secured with SSL/TLS (FTPS) or
replaced with SSH File Transfer Protocol (SFTP).
FTP topology.PNG
3. Now try using an FTP client built in the Laptop to send files to an FTP server configured in
the Server.
Provide the username(cisco) and password(cisco) [which are the defaults] for ftp login.
PC0 has an FTP client which can be used to read, write, delete and rename files present in the
FTP server.
The FTP server can be used to read and write configuration files as well as IOS images.
Additionally, the FTP server also supports file operations such rename, delete and listing
directory.
4. Create a file in the Laptop then upload it to the server using FTP.
To do this, open the Text Editor in the Laptop, create a file and give it your name of choice.
Type any text in the editor then save your file. e.g. myFile.txt.
5. Now upload the file from the Laptop to the server using FTP. (An FTP connection has to be
started first. But this is what we’ve done in step 3)
put MyFile.txt
6. Once file upload is successful, go to the Server FTP directory to verify if the file sent has
been received . To do this, go to Server-> Services->FTP. Here look for MyFile.txt sent from
the laptop.
Something extra: To check other FTP commands supported by the FTP client running on the
Laptop(or PC), you can use a question mark (?) on the Laptop’s command prompt as shown
below:
You can see the put command that we used to upload our file to the FTP server. Other
commands listed include:
For example, we can open an HTTP directory in the server by typing: cd /http. This will
change the current directory from FTP directory to HTTP directory
Once the http directory is open, you can upload a file to the HTTP server. You’re now
uploading a file to an HTTP folder(directory) using FTP.
To see this working, let’s open an HTTP directory and upload(put) a file to it using FTP:
You can now check up in the HTTP directory in the server and verify that the file uploaded
from the Laptop(MyFile.txt) is well received:
Notice that we are uploading files to an HTTP Server directory using File Transfer
Protocol.(FTP). This is what actually happens when you use an FTP client such as FileZilla
client to upload files to a website. In our case here, we are using an FTP client built-in the
Laptop.
This may interest you: The first FTP client applications were command-line programs
developed before operating systems had graphical user interfaces, and are still shipped with
most Windows and Linux operating systems. (Actually this is what we have been using this
far). Many FTP clients(e.g. FileZilla) and automation utilities have since been developed for
desktops, servers, mobile devices, and hardware. FTP has also been incorporated into
productivity applications, such as HTML editors.
We’ll create an html file in our Laptop, upload it to HTTP server directory using FTP, then
try to access the file from the Laptop’s browser.
On the Laptop, open the text editor, then type some markup(html) and save the file with the
extension .html. See all this below:
File2 html.PNG
If you’re already in the HTTP directory, you just need to type: put File2.html. If no, first ftp
the server(ftp 192.168.1.2), provide the login username(cisco) and password(cisco); change
the current directory to HTTP(cd /http) , and finally upload the html file onto the HTTP
directory(put File2.html)
Check whether the html file uploaded has been received in the HTTP directory:
Go to Server->Services-> HTTP. Then look up for the file in the File Manager.
Now edit index.html file in the HTTP directory so as to include a link to File2 that we’ve just
uploaded. This will make File2 accessible from the Laptop’s browser. To do this, locate
index.html then click edit. Proceed to edit it as shown below. Then save and accept
overwrite.Index.html editing to include File2 html.PNG
Finally, try to access the newly uploaded file from the Laptop’s browser.
So go to the Laptop’s browser and access the server using the server’s IP address. By doing
this, the browser is making an http request to the server. The server will respond to the
Laptop with the index.html file containing a link to File2 which we’ve uploaded from the
Laptop using FTP.
Conclusion: Thus we have studied the performance of HTTP, HTTPS and FTP protocol using
Packet tracer tool.
Problem Definition: To study the IPsec (ESP and AH) protocol by capturing the packets
using Wireshark tool.
IPsec (Internet Protocol Security) is a framework that helps us to protect IP traffic on the
network layer. Why? Because the IP protocol itself doesn’t have any security features at all. IPsec
can protect our traffic with the following features:
Confidentiality: by encrypting our data, nobody except the sender and receiver will be
able to read our data.
Integrity: we want to make sure that nobody changes the data in our packets. By
calculating a hash value, the sender and receiver will be able to check if changes have been
made to the packet.
Authentication: the sender and receiver will authenticate each other to make sure that
we are really talking with the device we intend to.
Anti-replay: even if a packet is encrypted and authenticated, an attacker could try to
capture these packets and send them again. By using sequence numbers, IPsec will not
transmit any duplicate packets.
As a framework, IPsec uses a variety of protocols to implement the features. Here’s an overview:
Between two routers to create a site-to-site VPN that “bridges” two LANs together.
Between a firewall and windows host for remote access VPN.
Between two linux servers to protect an insecure protocol like telnet.
IPsec is pretty complex and there are a lot of different ways to implement it. In this lesson I will
start with an overview and then we will take a closer look at each of the components.
Before we can protect any IP packets, we need two IPsec peers that build the IPsec tunnel.
To establish an IPsec tunnel, we use a protocol called IKE (Internet Key Exchange).
IKE phase 1
IKE phase 2
In IKE phase 1, two peers will negotiate about the encryption, authentication, hashing and
other protocols that they want to use and some other parameters that are required. In this phase,
an ISAKMP (Internet Security Association and Key Management Protocol) session is
established. This is also called the ISAKMP tunnel or IKE phase 1 tunnel.
The collection of parameters that the two devices will use is called a SA (Security Association).
Here’s an example of two routers that have established the IKE phase 1 tunnel:
The IKE phase 1 tunnel is only used for management traffic. We use this tunnel as a secure
method to establish the second tunnel called the IKE phase 2 tunnel or IPsec tunnel and for
management traffic like keepalives.
Below is the fig of our two routers that completed IKE phase 2:
IKE builds the tunnels for us but it doesn’t authenticate or encrypt user data. We use two other
protocols for this:
AH (Authentication Header)
ESP (Encapsulating Security Payload)
Transport mode
Tunnel mode
The main difference between the two is that with transport mode we will use the original IP
header while in tunnel mode, we use a new IP header. Here’s an example to help you visualize
this:
Initiation: something has to trigger the creation of our tunnels. For example when you
configure IPsec on a router, you use an access-list to tell the router what data to protect.
When the router receives something that matches the access-list, it will start the IKE
process. It’s also possible to manually initiate the tunnel.
IKE phase 1: we negotiate a security association to build the IKE phase 1 tunnel (ISAKMP
tunnel).
IKE phase 2: within the IKE phase 1 tunnel, we build the IKE phase 2 tunnel (IPsec
tunnel).
Data transfer: we protect user data by sending it through the IKE phase 2 tunnel.
Termination: when there is no user data to protect then the IPsec tunnel will be
terminated after a while.
Transport Mode
Transport mode is simple, it just adds an AH header after the IP header. Here’s an example of an
IP packet that carries some TCP traffic:
Transport Mode
When we use transport mode, we use the original IP header and insert an ESP header.
Here’s what it looks like:
Tunnel Mode
How about ESP in tunnel mode? This is where we use a new IP header which is useful for
site-to-site VPNs:
It’s similar to transport mode but we add a new header. The original IP header is now also
encrypted.
Conclusion: Thus we have studied IPsec (ESP and AH) protocol by capturing the packets using
Wireshark tool