Cns Man
Cns Man
LAB MANUAL
Computer Networks and Security Laboratory
Pimpri Chinchwad Education Trust’s
Pimpri Chinchwad College of Engineering &
Research Ravet, Pune
IQAC PCCOER
Academic Year: 2024 - 25 Term: I
LABORATORY MANUAL
Subject: Computer Networks and Security
Laboratory
Year: 2024-25
Semester: I
Mission
To establish state-of-the-art facilities to create an environment resulting in individuals who are technically sound
having professionalism, research and innovative aptitude with high moral and ethical values.
Vision
To strive for excellence in the field of Computer Engineering and Research through Creative Problem Solving related
to societal needs
Mission:
1. Establish strong fundamentals, domain knowledge and skills among the students with analytical thinking,
conceptual knowledge, social awareness and expertise in the latest tools & technologies to serve industrial
demands
2. Establish leadership skills, team spirit and high ethical values among the students to serve industrial demands
and societal needs
3. Guide students towards Research and Development, and a willingness to learn by connecting themselves to the
global society
PSO1: Problem-Solving Skills- The ability to apply standard practices and strategies in software project development
using open-ended programming environments to deliver a quality project.
PSO2: Professional Skills-The ability to understand, analyze and develop computer programs in the areas related to
algorithms, software testing, application software, web design, data analytics, IOT and networking for efficient design
of computer-based systems.
PSO3: Successful Career and Entrepreneurship- The ability to employ modern computer languages, environments,
and platforms in creating innovative career paths to be an entrepreneur, and a zest for higher studies, and to generate
IPR & Deliver a quality project.
Course Objectives:
• To learn computer network hardware and software components
• To learn computer network topologies and types of network
• To develop an understanding of various protocols, modern technologies and applications
• To learn modern tools for network traffic analysis
• To learn network programming
• To introduce the concepts and components of Business Intelligence (BI)
• To learn the fundamentals of Software Defined Networks (SDN)
Cognitiv
CO
Statements e level of
learning
Analyze the requirements of network types, topology and
C307.1 transmission media BT- 4 Analyze
Demonstrate error control, flow control techniques and protocols and
BT-3
C307.2 analyze them
Demonstrate
(Apply)
Demonstrate the subnet formation with IP allocation mechanism BT-3
C307.3 and apply various routing algorithms Demonstrate
(Apply)
C307.4 Develop Client-Server architectures and prototypes
BT -6 Develop
(Create)
C307.5 Implement web applications and services using application layer BT-3
protocols Implement
((Apply))
C307.6 Use network security services and mechanisms
BT-3 use
(Apply)
Course Outcomes:
Index
Theory:
1. What is SSL, TLS, and HTTPS?
SSL (Secure Socket Layer) and TLS (Transport Layer Security) are popular cryptographic
protocols that are used to imbue web communications with integrity, security, and
resilience against unauthorized tampering. PKI uses the TLS protocol to establish secure
connections between clients and servers over the internet, ensuring that the information
relayed is encrypted and unable to be read by an external third party.
Note: SSL was the predecessor of TLS, and the world began moving away from SSL once
TLS was introduced in 1999, thanks to the improved security features of the latter. TLS is
currently in its third iteration, and is called TLS 1.3. However, SSL continues to be used as
a metonym for both protocols in general (for example, the word ‘SSL certificate’ is widely
used, but SSL has been completely deprecated and no modern systems support SSL
anymore).
Connections that are secured by TLS will indicate their secure status by displaying HTTPS
(Hypertext Transfer Protocol Secure) in the address bar of web browsers, as opposed to
just HTTP.
While TLS is primarily used to secure client-server connection, it is also used to protect
emails, VoIP calls, and other connections.
1.1. Why are they necessary?
In theory, web connections are completely possible without TLS to secure them. However,
without a security protocol in place, the communication would be rendered completely
open to external access. If a browser connected to the website of an online store, and a
user had to enter their credentials to log in, those credentials could easily be lifted by an
observing party.
TLS, at its core, serves to provide end-to-end encryption for all data transmitted from one
point to another, and uses cryptography to ensure that only the two transacting bodies
are capable of reading this information. Every service in the world now Mandates that
connections are secure by TLS – leading browsers do not allow users to access websites
without a valid TLS connection. TLS has the following benefits:
● The contents of the connection remain encrypted, private, and fully secure – and
cannot be easily deciphered by malicious actors.
● The connection is only made if it is reliable – this reliability check is a part of TLS
communications, and is enforced by the exchange of a Message Authentication Code.
● The use of PKI and TLS certificates ensures that the identities of both communicating
parties are verified.
2. SSL/TLS Handshake Process
1. The “client hello” message: The client sends a “client hello” message that lists
cryptographic information such as the TLS version and, the cipher suites supported by
the client in an order of preference. The message also contains a string of random
bytes, known as the “client random”, that is used in subsequent computations.
2. The “server hello” message: The server responds with a “server hello” message that
contains the cipher suite chosen by the server from the list provided by the client, the
session ID, and another string of random bytes, called the “server random”. The server
also sends its TLS certificate. If the server requires a digital certificate for client
authentication, the server sends a "client certificate request" that includes a list of the
types of certificates supported and the Distinguished Names of acceptable
Certification Authorities (CAs).
3. Server authentication: The client verifies the server's TLS certificate with the
certificate authority that issued it. This confirms that the server is who it says it is, and
that the client is interacting with the actual owner of the domain.
4. Premaster secret: The client sends one more random string of bytes, the “premaster
secret.” The premaster secret is encrypted with the server’s public key (included in the
server’s TLS certificate) and can only be decrypted with the private key by the server.
5. Client authentication: If the server has sent a “client certificate request”, the client
sends its digital certificate. The server verifies the client's certificate.
6. Session keys creation: The server decrypts the premaster secret. Both client and server
generate session keys from the client random, the server random, and the premaster
secret.
7. Client is ready: The client sends the server a “finished” message, which is encrypted
with the secret session key, indicating that the client part of the handshake is complete.
8. Server is ready: The server sends the client a “finished” message, which is encrypted
with the secret session key, indicating that the server part of the handshake is
complete.
9. Secure symmetric encryption achieved: For the duration of the TLS session, the server
and client can now exchange messages that are symmetrically encrypted with the
shared secret session key.
Fig. SSL/TLS Handshake Process
Alert Protocol:
This protocol is used to convey SSL-related alerts to the peer entity. Each message in this
protocol contain 2 bytes.
The level is further classified into two parts:
● Warning:
This Alert has no impact on the connection between sender and receiver.
● Fatal Error:
This Alert breaks the connection between sender and receiver. Silent
Features of Secure Socket Layer:
● The advantage of this approach is that the service can be tailored to the specific
needs of the given application.
● Secure Socket Layer was originated by Netscape.
● SSL is designed to make use of TCP to provide reliable end-to-end secure service.
● This is a two-layered protocol.
Conclusion:
Hence, we have successfully studied the SSL protocol by capturing the packets using
Wireshark tool while visiting any SSL secured website.
Wireshark Analysis
:
Assignment No:2
Problem Statement: 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 Face book, and how many of each
were also HTTP packets.
Objectives: To learn modern tools for network traffic analysis
Outcome: Use network security services and mechanisms Software &
Hardware Requirments:
Operating System: Ubuntu Packet
Analyzer Tool: Wireshark
Theory:
1. Introduction
Wireshark is a network packet analyzer. A network packet analyzer presents captured packet data in
as much detail as possible. You could think of a network packet analyzer as a measuring device for
examining what’s happening inside a network cable, just like an electrician uses a voltmeter for
examining what’s happening inside an electric cable (but at a higher level, of course). In the past, such
tools were either very expensive, proprietary, or both. However, with the advent of Wireshark, that has
changed. Wireshark is available for free, is open source, and is one of the best packet analyzers available
today.
1.1 Features
The following are some of the many features Wireshark provides:
● Available for UNIX and Windows.
● Capture live packet data from a network interface.
● Open files containing packet data captured with tcpdump/WinDump, Wireshark, and
many other packet capture programs.
● Import packets from text files containing hex dumps of packet data.
● Display packets with very detailed protocol information.
● Save packet data captured.
● Export some or all packets in a number of capture file formats.
● Filter packets on many criteria.
● Search for packets on many criteria.
● Colorize packet display based on filters. ● Create various statistics.
2. Wireshark Filter
2.1 Display Filter
Wireshark provides a display filter language that enables you to precisely control which packets
are displayed. They can be used to check for the presence of a protocol or field, the value of a field,
or even compare two fields to each other. These comparisons can be combined with logical
operators, like "and" and "or", and parentheses into complex expressions.
Wireshark's display filter uses Boolean expressions, so you can specify values and chain them
together. The following expressions are commonly used:
● Equals: == or eq
● And: && or and
● Or: || (double pipe) or or
2.1.1 Example
1. eth.src == 00:11:22:33:44:55: Source MAC address is 00:11:22:33:44:55
2. ip.addr == 10.0.0.1: Find all traffic that has IP of 10.0.0.1
3. tcp.dstport != 80: Destination tcp port is NOT 80
4. ip.addr==10.10.10.1
5. ip.addr==192.168.1.10 && ip.addr==192.168.1.20
6. !(ip.addr==192.168.1.10 && ip.addr==192.168.1.20)
7. (ip.addr==192.168.1.10 && ip.addr==192.168.1.20) && (tcp.port==445 ||
tcp.port==139)
8. ip.src==10.10.10.0/24
9. eth.addr==00:1b:17:00:01:31
10. ip.addr==10.10.10.1 && tcp.port==80
11. tcp.port==80
12. tcp.port==80 || tcp.port==3389
13. tcp.dstport==80
14. eth.dst=ff:ff:ff:ff:ff:ff
15. ip.addr==255.255.255.255 ip.host contains "imap"
2.2 Capture Filters
Capture filters are used to decrease the size of captures by filtering out packets before they are
added. Capture filters enable you to capture only traffic that you want to be captured, eliminating an
unwanted stream of packets. Capturing packets is a processor- intensive task, and packet analyzers use a
good amount of primary memory while they are running. Packets are only sent to the capture engine
if they meet a certain criterion (capture filter expressions).
Examples
Capture only traffic to or from IP address 172.18.5.4:
● host 172.18.5.4
Capture traffic to or from a range of IP addresses:
● net 192.168.0.0/24 or
● net 192.168.0.0 mask 255.255.255.0
Capture traffic from a range of IP addresses:
● src net 192.168.0.0/24 or
● src net 192.168.0.0 mask 255.255.255.0 Capture traffic to a range of IP addresses:
● dst net 192.168.0.0/24 or
● dst net 192.168.0.0 mask 255.255.255.0 Capture only DNS (port 53) traffic:
● port 53
Capture non-HTTP and non-SMTP traffic on your server (both are equivalent):
● host www.example.com and not (port 80 or port 25) host www.example.com and
not port 80 and not port 25 Capture except all ARP and DNS traffic:
● port not 53 and not arp
Capture traffic within a range of ports
● (tcp[0:2] > 1500 and tcp[0:2] < 1550) or (tcp[2:2] > 1500 and tcp[2:2] < 1550) or,
with newer versions of libpcap (0.9.1 and later):
● tcp portrange 1501-1549
Capture only Ethernet type EAPOL:
● ether proto 0x888e
Reject ethernet frames towards the Link Layer Discovery Protocol Multicast group: ● not
ether dst 01:80:c2:00:00:0e
Capture only IPv4 traffic - the shortest filter, but sometimes very useful to get rid of lower
layer protocols like ARP and STP:
● ip
Capture only unicast traffic - useful to get rid of noise on the network if you only want to see
traffic to and from your machine, not, for example, broadcast and multicast announcements:
● not broadcast and not multicast
Capture IPv6 "all nodes" (router and neighbor advertisement) traffic. Can be used to find
rogue RAs:
● dst host ff02::1
Conclusion:
Hence, we have Successfully Capture packets using Wireshark and wrote the exact packet
capture filter expressions.
Program:
1. Identify Facebook.com IP Address sudo apt-get install traceroute traceroute
facebook.com
traceroute to facebook.com (31.13.86.8), 30 hops max, 60 byte packets
2. Capture all TCP traffic to/from Facebook, during the time when you log in to your
Facebook account.
Capture filter: tcp and host 31.13.86.8
3. Capture all HTTP traffic to/from Facebook, when you log in to your Facebook account
Capture filter: tcp port 80 and host 31.13.86.8
4. 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.
DISPLAY filter:
tcp.flags.syn==1 && ip.dst==31.13.86.8
tcp.flags.push==1 && ip.dst==31.13.86.8
tcp.flags.reset==1 && ip.dst==31.13.86.8
5. Count how many TCP packets you received from / sent to Face book, and how many
of each were also HTTP packets.
Assignment : 3
PROBLEM STATEMENT
Write a program for DNS lookup. Given an IP address input, it should return URL and vice-
versa.
Prerequisite:
Hardware Requirement:
PIV, 2GB RAM, 500 GB HDD, Lenovo A13-4089Model. Outcomes:
After completion of this assignment students can learn about DNS working
Theory: -
DNS in TCP/IP
Technologies That Use DNS
Domain Name System (DNS) is the default name resolution service used in a
Microsoft Windows Server 2003 network. DNS is part of the Windows Server 2003
TCP/IP protocol suite and all TCP/IP network connections are, by default, configured
with the IP address of at least one DNS server in order to perform name resolution on
the network. Windows Server 2003 components that require name resolution will
attempt to use this DNS server before attempting to use the previous default Windows
name resolution service, Windows Internet Name Service (WINS).
Typically, Windows Server 2003 DNS is deployed in support of Active Directory
directory service. In this environment, DNS namespaces mirror the Active Directory
forests and domains used by an organization. Network hosts and services are
configured with DNS names so that they can be located in the network, and they are
also configured with DNS servers that resolve the names of Active Directory domain
controllers.
Windows Server 2003 DNS is also commonly deployed as a non-Active Directory, or
standard, Domain Name System solution, for the purposes of hosting the Internet
presence of an organization, for example.
DNS Architecture
DNS architecture is a hierarchical distributed database and an associated set of
protocols that define:
The previous figure shows how Microsoft is assigned authority by the Internet root
servers for its own part of the DNS domain namespace tree on the Internet. DNS
clients and servers use queries as the fundamental method of resolving names in the
tree to specific types of resource information. This information is provided by DNS
servers in query responses to DNS clients, who then extract the information and pass
it to a requesting program for resolving the queried name. In the process of resolving
a name, keep in mind that DNS servers often function as DNS clients, querying other
servers in order to fully resolve a queried name.
How the DNS Domain Namespace Is Organized
Any DNS domain name used in the tree is technically a domain. Most DNS discussions,
however, identify names in one of five ways, based on the level and the way a name is
commonly used. For example, the DNS domain name registered to Microsoft
(microsoft.com.) is known as a second-level domain. This is because the name has two
parts (known as labels) that indicate it is located two levels below the root or top of the
tree. Most DNS domain names have two or more labels, each of which indicates a new
level in the tree. Periods are used in names to separate labels. The five categories used to
describe DNS domain names by their function in the namespace are described in the
following table, along with an example of each name type.
Questions:
1] Differentiate between Iterative and Recursive Query.
Conclusion: - Thus we studied DNS in detail and implement the forward and reverse
lookup.
Assignment No: 4
Problem Statement: Write a program using TCP socket for wired network for following
a) Say Hello to Each other b)File transfer c)Calculator.
Objectives: To learn network programming
1. Introduction
The term network programming refers to writing programs that execute across
multiple devices (computers), in which the devices are all connected to each other using
a network.
The java.net package of the J2SE APIs contains a collection of classes and interfaces that
provide the low-level communication details, allowing you to write programs that focus
on solving the problem at hand.
The java.net package provides support for the two common network protocols: TCP:
TCP stands for Transmission Control Protocol, which allows for reliable
communication between two applications. TCP is typically used over the
Internet Protocol, which is referred to as TCP/IP.
UDP: UDP stands for User Datagram Protocol, a connection-less protocol that
allows for packets of data to be transmitted between applications.
2. Socket Programming:
Sockets provide the communication mechanism between two computers using TCP. A
client program creates a socket on its end of the communication and attempts to connect
that socket to a server.
When the connection is made, the server creates a socket object on its end of the
communication. The client and server can now communicate by writing to and reading
from the socket.
The java.net.Socket class represents a socket, and the java.net.ServerSocket class provides
a mechanism for the server program to listen for clients and establish connections with
them.
The following steps occur when establishing a TCP connection between two
computers using sockets:
• The server instantiates a ServerSocket object, denoting which port
number communication is to occur on.
• The server invokes the accept() method of the ServerSocket class.
This method waits until a client connects to the server on the given
port.
• After the server is waiting, a client instantiates a Socket object,
specifying the server name and port number to connect to.
• The constructor of the Socket class attempts to connect the client to
the specified server and port number. If communication is
established, the client now has a Socket object capable of
communicating with the server.
• On the server side, the accept() method returns a reference to a new
socket on the server that is connected to the client's socket.
After the connections are established, communication can occur using I/O streams.
Each socket has both an OutputStream and an InputStream. The client's OutputStream is
connected to the server's InputStream, and the client's InputStream is connected to the
server's OutputStream.
Conclusion:
Hence, we have Successfully Wrote a program using TCP socket for wired network for
following a) Say Hello to Each other b)File transfer c)Calculator.
Assignment Number: 5
network.
OBJECTIVES:
PROBLEM STATEMENT
Write a program using UDP Sockets to enable file transfer (Script, Text, Audio and Video
one file each) between two machines. Demonstrate the packets captured traces using
Wireshark Packet Analyzer Tool for peer to peer mode. Prerequisite:
Basic concepts of addresses, socket primitives, IP structure
Coversion functions, Notations
Hardware Requirement:
PIV, 2GB RAM, 500 GB HDD, Lenovo A13-4089Model.
Outcomes:
After completion of this assignment students can perform socket programming and perform remote
communications between any two remote processes
Theory: -
Program A program is an executable file residing on a disk in a directory. A program is read into
memory and is executed by the kernel as ad result of an exec () function. The exec () has six
variants, but we only consider the simplest one (exec ()) in this course.
Process An executing instance of a program is called a process. Sometimes, task is used instead
of process with the same meaning. UNIX guarantees that every process has a unique identifier
called the process ID. The process ID is always a non-negative integer.
File descriptors File descriptors are normally small non-negative integers that the kernel uses to
identify the files being accessed by a particular process. Whenever it opens an existing file or
creates a new file, the kernel returns a file descriptor that is used to read or write the file. As we
will see in this course, sockets are based on a very similar mechanism (socket descriptors).
The client-server model
The client-server model is one of the most used communication paradigms in networked systems.
Clients normally communicate with one server at a time. From a server’s perspective, at any point
in time, it is not unusual for a server to be communicating with multiple clients. Client need to
know of the existence of and the address of the server, but the server does not need to know the
address of (or even the existence of) the client prior to the connection being established Client and
servers communicate by means of multiple layers of network protocols. In this course we will
focus on the TCP/IP protocol suite.
The scenario of the client and the server on the same local network (usually called LAN, Local
Area Network) is shown in Figure 1
Figure 1: Client and server on the same Ethernet communicating using TCP/IP.
The client and the server may be in different LANs, with both LANs connected to a Wide Area
Network (WAN) by means of routers. The largest WAN is the Internet, but companies may have
their own WANs. This scenario is depicted in Figure 2.
The flow of information between the client and the server goes down the protocol stack on one
side, then across the network and then up the protocol stack on the other side.
UDP is a simple transport-layer protocol. The application writes a message to a UDP socket, which
is then encapsulated in a UDP datagram, which is further encapsulated in an IP datagram, which
is sent to the destination.
There is no guarantee that a UDP will reach the destination that the order of the datagrams will be
preserved across the network or that datagrams arrive only once.
The problem of UDP is its lack of reliability: if a datagram reaches its final destination but the
checksum detects an error, or if the datagram is dropped in the network, it is not automatically
retransmitted.
Each UDP datagram is characterized by a length. The length of a datagram is passed to the
receiving application along with the data.
No connection is established between the client and the server and, for this reason, we say that
UDP provides a connection-less service.
Socket addresses
struct in_addr{
in_addr_t s_addr; /*32 bit IPv4 network byte ordered address*/
};
struct sockaddr_in {
uint8_t sin_len; /* length of structure (16)*/
sa_family_t sin_family; /* AF_INET*/
in_port_t sin_port; /* 16 bit TCP or UDP port number */
struct in_addr sin_addr; /* 32 bit IPv4 address*/
char sin_zero[8]; /* not used but always set to zero */
};
A socket address structure is always passed by reference as an argument to any socket functions.
But any socket function that takes one of these pointers as an argument must deal with socket
address structures from any of the supported protocol families.
A problem arises in declaring the type of pointer that is passed. With ANSI C, the solution is to
use void * (the generic pointer type). But the socket functions predate the definition of ANSI C
and the solution chosen was to define a generic socket address as follows:
struct sockaddr {
uint8_t sa_len;
sa_family_t sa_family; /* address family: AD_xxx value */
char sa_data[14];
};
There are some fundamental differences between TCP and UDP sockets. UDP is a connection-
less, unreliable, datagram protocol (TCP is instead connection-oriented, reliable and stream
based). There are some instances when it makes to use UDP instead of TCP. Some popular
applications built around UDP are DNS, NFS, SNMP and for example, some Skype services and
streaming media.
Figure 3 shows the the interaction between a UDP client and server. First of all, the client does not
establish a connection with the server. Instead, the client just sends a datagram to the server using
the sendto function which requires the address of the destination as a parameter. Similarly, the
server does not accept a connection from a client. Instead, the server just calls the
recvfromfunction, which waits until data arrives from some client. recvfrom returns the IP address
of the client, along with the datagram, so the server can send a response to the client.
As shown in the Figure, the steps of establishing a UDP socket communication on the client side
are as follows:
The steps of establishing a UDP socket communication on the server side are as follows:
The first step is to call the socket function, specifying the type of communication protocol (TCP
based on IPv4, TCP based on IPv6, UDP).
#include <sys/socket.h>
where family specifies the protocol family (AF_INET for the IPv4 protocols), type is a constant
described the type of socket (SOCK_STREAM for stream sockets and SOCK_DGRAM for
datagram sockets.
The function returns a non-negative integer number, similar to a file descriptor, that we define
socket descriptor or -1 on error.
The bind() assigns a local protocol address to a socket. With the Internet protocols, the address is
the combination of an IPv4 or IPv6 address (32-bit or 128-bit) address along with a 16 bit TCP
port number.
#include <sys/socket.h>
where sockfd is the socket descriptor, servaddr is a pointer to a protocol-specific address and
addrlen is the size of the address structure.
This use of the generic socket address sockaddr requires that any calls to these functions must cast
the pointer to the protocol-specific address structure. For example for and IPv4 socket structure:
This function is similar to the read() function, but three additional arguments are required. The
recvfrom() function is defined as follows:
#include <sys/socket.h>
The first three arguments sockfd, buff, and nbytes, are identical to the first three arguments of read
and write. sockfd is the socket descriptor, buff is the pointer to read into, and nbytes is number of
bytes to read. In our examples we will set all the values of the flags argument to 0. The recvfrom
function fills in the socket address structure pointed to by from with the protocol address of who
sent the datagram. The number of bytes stored in the socket address structure is returned in the
integer pointed by addrlen.
This function is similar to the send() function, but three additional arguments are required.The sendto()
function is defined as follows:
#include <sys/socket.h>
ssize_t sendto(int sockfd, const void *buff, size_t nbytes,
int flags, const struct sockaddr *to,
socklen_t addrlen);
The first three arguments sockfd, buff, and nbytes, are identical to the first three arguments of recv. sockfd is
the socket descriptor, buff is the pointer to write from, and nbytes is number of bytes to write. In our examples
we will set all the values of the flags argument to 0. The to argument is a socket address structure containing
the protocol address (e.g., IP address and port number) of where the data is sent.
addlen specified the size of this socket.
The normal close() function is used to close a socket and terminate a TCP socket. It returns 0 if itsucceeds, -
1 on error. It is defined as follows:
#include <unistd.h>
int
close(int sockfd);
1. What is Socket?
2. What are different types of Socket?
3. What are different Socket functions or calls used in UDP Client Server
communication?
4. Explain UCP protocol in details?
Conclusion:
Hence we studied and implement program to demonstrate Socket programming forwired network.
Assignment Number : 6
Title: Study of Go Back-N and Selective Repeat mode of Sliding window protocol.
OBJECTIVES:
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.
Prerequisite:
Basic concepts of Go back N method and its working.
Basic concepts of Selective Repeat ARQ method and its working.
Hardware Requirement:
PIV, 2GB RAM, 500 GB HDD, Lenovo A13-4089Model.
Outcomes:
After completion of this assignment students can learn about working of Go back N and selective repeat
Theory: -
Data-link layer is responsible for implementation of point-to-point flow and error control mechanism.
FlowControl:-
When a data frame (Layer-2 data) is sent from one host to another over a single medium, it is required that
the sender and receiver should work at the same speed. That is, sender sends at a speed on which the
receiver can process and accept the data. What if the speed
(hardware/software) of the sender or receiver differs? If sender is sending too fast the receiver may be
overloaded, (swamped) and data may be lost.
Two types of mechanisms can be deployed to control the flow:
Stop and Wait
This flow control mechanism forces the sender after transmitting a data frame to stop and wait until
the acknowledgement of the data-frame sent is received.
Sliding Window
In this flow control mechanism, both sender and receiver agree on the number of data- frames after
which the acknowledgement should be sent. As we learnt, stop and wait flow control mechanism
wastes resources, this protocol tries to make use of underlying resources as much as possible.
ErrorControl:-
When data-frame is transmitted, there is a probability that data-frame may be lost in the transit or it
is received corrupted. In both cases, the receiver does not receive the correct data- frame and sender does
not know anything about any loss.In such case, both sender and receiver are equipped with some protocols
which helps them to detect transit errors such as loss of data- frame. Hence, either the sender retransmits
the data-frame or the receiver may request to resend the previous data-frame.
• Error detection - The sender and receiver, either both or any, must ascertain that there is some error
in the transit.
• Positive ACK - When the receiver receives a correct frame, it should acknowledge it.
• Negative ACK - When the receiver receives a damaged frame or a duplicate frame, it sends a NACK
back to the sender and the sender must retransmit the correct frame.
• Retransmission: The sender maintains a clock and sets a timeout period. If an acknowledgement
of a data-frame previously transmitted does not arrive before the timeout the sender retransmits the
frame, thinking that the frame or it’s acknowledgement is lost in transit.
There are three types of techniques available which Data-link layer may deploy to control the errors by
Automatic Repeat Requests (ARQ):
Stop-and-wait ARQ
When the sender sends all the frames in window, it checks up to what sequence number it has
received positive acknowledgement. If all frames are positively acknowledged, the sender sends
next set of frames. If sender finds that it has received NACK or has not receive any ACK for a
particular frame, it retransmits all the frames after which it does not receive any positive ACK.
In Selective-Repeat ARQ, the receiver while keeping track of sequence numbers, buffersthe frames in
memory and sends NACK for only frame which is missing or damaged.
The sender in this case, sends only packet for which NACK is received.
Conclusion:
We studied and implemented program of Go-back n and Selective repeat modes of sliding window protocol.
Assignment Number: 7
PROBLEM STATEMENT
Write a program to demonstrate subletting and find the subnet masks. Prerequisite:
Basic concepts of IP address and its classes
Sub netting method and super netting method.
Hardware Requirement:
PIV, 2GB RAM, 500 GB HDD, Lenovo A13-4089Model.
Outcomes:
After completion of this assignment students can learn about subnetting and it us in networking
Theory: - Introduction: -
If definitions are helpful to you, use these vocabulary terms in order to get you started:
● Subnet mask - A 32-bit combination used to describe which portion of an address refers to the subnet
and which part refers to the host.
If you have already received your legitimate address (es) from the Internet Network Information
Center (InterNIC), you are ready to begin. If you do not plan to connect to the Internet, Cisco strongly
suggests that you use reserved addresses from RFC 1918
Understand IP Addresses
An IP address is an address used in order to uniquely identify a device on an IP network. The address
is made up of 32 binary bits, which can be divisible into a network portion and host portion with the
help of a subnet mask. The 32 binary bits are broken into four octets (1 octet = 8 bits).
Each octet is converted to decimal and separated by a period (dot). For this reason, an IP address is
said to be expressed in dotted decimal format (for example, 172.16.81.100). The value in each octet
ranges from 0 to 255 decimal, or 00000000 - 11111111 binary.
Here is how binary octets convert to decimal: The right most bit, or least significant bit, of an octet
holds a value of 20. The bit just to the left of that holds a value of 21. This continues until the left-
most bit, or most significant bit, which holds a value of 27. So if all binary bits are a one, the decimal
equivalent would be 255 as shown here:
1 111 1111
128 64 32 16 8 4 2 1 (128+64+32+16+8+4+2+1=255)
Here is a sample octet conversion when not all of the bits are set to 1.
01000001
0 64 0 0 0 0 0 1 (0+64+0+0+0+0+0+1=65)
And this sample shows an IP address represented in both binary and decimal.
These octets are broken down to provide an addressing scheme that can accommodate large and
small networks. There are five different classes of networks, A to E. This document focuses on
classes A to C, since classes D and E are reserved and discussion of them is beyond the scope of this
document.
Note: Also note that the terms "Class A, Class B" and so on are used in this document in order to
help facilitate the understanding of IP addressing and subnetting. These terms are rarely used in the
industry anymore because of the introduction of classless interdomain routing (CIDR).
Given an IP address, its class can be determined from the three high-order bits (the three left-most bits
in the first octet). Figure 1 shows the significance in the three high order bits and the range of addresses
that fall into each class. For informational purposes, Class D and Class E addresses are also shown.
Figure 1
In a Class A address, the first octet is the network portion, so the Class A example in Figure 1 has a
major network address of 1.0.0.0 - 127.255.255.255. Octets 2, 3, and 4 (the next 24 bi ts) are for the
network manager to divide into subnets and hosts as he/she sees fit. Class A addresses are used for
networks that have more than 65,536 hosts (actually, up to 16777214 hosts!).
In a Class B address, the first two octets are the network portion, so the Class B example in Figure 1
has a major network address of 128.0.0.0 - 191.255.255.255. Octets 3 and 4 (16 bits) are for local
subnets and hosts. Class B addresses are used for networks that have between 256 and 65534 hosts.
In a Class C address, the first three octets are the network portion. The Class C example in Figure
1 has a major network address of 192.0.0.0 - 223.255.255.255. Octet 4 (8 bits) is for local subnets
and hosts - perfect for networks with less than 254 hosts.
Network Masks:
A network mask helps you know which portion of the address identifies the network and which
portion of the address identifies the node. Class A, B, and C networks have default masks, also
known as natural masks, as shown here:
Class A:
255.0.0.0
Class B: 255.255.0.0
Class C: 255.255.255.0
An IP address on a Class A network that has not been subnetted would have an address/mask pair
similar to: 8.20.15.1 255.0.0.0. In order to see how the mask helps you identify the network and
node parts of the address, convert the address and mask to binary numbers.
8.20.15.1 = 00001000.00010100.00001111.00000001
255.0.0.0 = 11111111.00000000.00000000.00000000
Once you have the address and the mask represented in binary, then identification of the network and
host ID is easier. Any address bits which have corresponding mask bits set to 1 represent the network
ID. Any address bits that have corresponding mask bits set to 0 represent the node ID.
8.20.15.1= 00001000.00010100.00001111.00000001
255.0.0.0 = 11111111.00000000.00000000.00000000
net id host id
netid = 00001000 = 8
hostid = 00010100.00001111.00000001 = 20.15.1
Understand 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 are only able to use one network from your Class A, B, or C
network, which is unrealistic.
Each data link on a network must have a unique network ID, with every node on that link being a
member of the same network. If you break a major network (Class A, B, or C) into smaller
subnetworks, it allows you to create a network of interconnecting subnetworks. Each data link on this
network would then have a unique network/subnetwork ID. Any device, or gateway, that connects n
networks/subnetworks has n distinct IP addresses, one for each network / subnetwork that it
interconnects.
In order to subnet a network, extend the natural mask with some of the bits from the host ID portion of
the address in order to create a subnetwork ID. For example, given a Class C network of
which has a natural mask of 255.255.255.0, you can create subnets in this manner:
11001100.00010001.00000101.00000000
255.255.255.224 - 11111111.11111111.11111111.11100000
|sub|
By extending the mask to be 255.255.255.224, you have taken three bits (indicated by "sub") from the
original host portion of the address and used them to make subnets. With these three bits, it is possible
to create eight subnets. With the remaining five host ID bits, each subnet can have up to 32 host
addresses, 30 of which can actually be assigned to a device since host ids of all zeros or all ones are
not allowed (it is very important to remember this). So, with this in mind, these subnets have been
created.
attached. Each subnetwork could potentially support up to 30 host addresses.
This brings up an interesting point. The more host bits you use for a subnet mask, the more subnets
you have available. However, the more subnets available, the less host addresses available per subnet.
For example, a Class C network of 204.17.5.0 and a mask of 255.255.255.224 (/27) allows you to have
eight subnets, each with 32 host addresses (30 of which could be assigned to devices). If you use a
mask of 255.255.255.240 (/28), the break down is:
204.17.5.0 - 11001100.00010001.00000101.00000000
255.255.255.240 - 11111111.11111111.11111111.11110000
|sub |
Since you now have four bits to make subnets with, you only have four bits left for host addresses. So
in this case you can have up to 16 subnets, each of which can have up to 16 host addresses (14 of which
can be assigned to devices).
Take a look at how a Class B network might be subnetted. If you have network 172.16.0.0 ,then you
know that its natural mask is 255.255.0.0 or 172.16.0.0/16. Extending the mask to anything beyond
255.255.0.0 means you are subnetting. You can quickly see that you have the ability to create a lot
more subnets than with the Class C network. If you use a mask of 255.255.248.0 (/21), how many
subnets and hosts per subnet does this allow for?
172.16.0.0 - 10101100.00010000.00000000.00000000
255.255.248.0 - 11111111.11111111.11111000.00000000
| sub |
You use five bits from the original host bits for subnets. This allows you to have 32 subnets (25).
After using the five bits for subnetting, you are left with 11 bits for host addresses. This allows
each subnet so have 2048 host addresses (211), 2046 of which could be assigned to devices.
Note: In the past, there were limitations to the use of a subnet 0 (all subnet bits are set to zero) and all
ones subnet (all subnet bits set to one). Some devices would not allow the use of these subnets. Cisco
Systems devices allow the use of these subnets when the ip subnet zero command is configured.
Examples
Sample Exercise 1
Now that you have an understanding of subnetting, put this knowledge to use. In this example, you are
given two address / mask combinations, written with the prefix/length notation, which have been
assigned to two devices. Your task is to determine if these devices are on the same subnet or different
subnets. You can use the address and mask of each device in order to determine to which subnet each
address belongs.
Device A: 172.16.17.30/20
Device B: 172.16.28.15/20
Looking at the address bits that have a corresponding mask bit set to one, and setting all the other
address bits to zero (this is equivalent to performing a logical "AND" between the mask and address),
shows you to which subnet this address belongs. In this case, DeviceA belongs to subnet 172.16.16.0.
172.16.28.15 - 10101100.00010000.00011100.00001111
255.255.240.0 - 11111111.11111111.11110000.00000000
| sub|
subnet = 10101100.00010000.00010000.00000000 = 172.16.16.0
From these determinations, Device A and Device B have addresses that are part of the same subnet.
Sample Exercise 2
Given the Class C network of 204.15.5.0/24, subnet the network in order to create the network in Figure
3 with the host requirements shown.
Figure 3
The subnets that are being used, Net A, Net C, and Net D have a lot of unused host address space. It
is possible that this was a deliberate design accounting for future growth, but in many cases this is
just wasted address space due to the fact that the same subnet mask is used for all the subnets.
Variable Length Subnet Masks (VLSM) allows you to use different masks for each subnet, thereby
using address space efficiently.
VLSM Example
Given the same network and requirements as in Sample Exercise 2 develop a subnetting scheme with
the use of VLSM, given:
The easiest way to assign the subnets is to assign the largest first. For example, you can assign
in this manner:
Figure 5: Figure 5
CIDR:
Classless Interdomain Routing (CIDR) was introduced in order to improve both address space
utilization and routing scalability in the Internet. It was needed because of the rapid growth of the
Internet and growth of the IP routing tables held in the Internet routers.
CIDR moves way from the traditional IP classes (Class A, Class B, Class C, and so on). In CIDR , an
IP network is represented by a prefix, which is an IP address and some indication of the length of the
mask. Length means the number of left-most contiguous mask bits that are set to one. So network
172.16.0.0 255.255.0.0 can be represented as 172.16.0.0/16. CIDR also depicts a more hierarchical
Internet architecture, where each domain takes its IP addresses from a higher level. This allows for
the summarization of the domains to be done at the higher level. For example, if an ISP owns network
172.16.0.0/16, then the ISP can offer 172.16.1.0/24, 172.16.2.0/24, and so on to customers. Yet, when
advertising to other providers, the ISP only needs to advertise 172.16.0.0/16.
For more information on CIDR, see RFC 1518 and RFC 1519 .
Conclusion:
Hence we studied and implement program to demonstrate subletting and find the subnetmasks.
Assignment Number : 8
PROBLEM STATEMENT
Write a program for error detection and correction for 7/8 bits ASCII codes using Hamming Codes
or CRC.
Prerequisite:
Basic concepts of CRC working.
Software Requirements: C/C++/Java/Python
Hardware Requirement:
PIV, 2GB RAM, 500 GB HDD, Lenovo A13-4089Model.
Outcomes:
After completion of this assignment students can learn about CRC error detection
Theory: -
1. Introduction
All communication systems try to make sure that the transmitted messages reach the destination
without any problem. So they intend to implement different algorithms in order to satisfy this
requirement. One of the options is to encode the message in a way that enables the receiver to
check the corrupted messages; example of such coding is the CRC.
Data storage devices must also prevent any corruption of its data. The best choice for this problem
is to use data redundancy, which costs a lot. So instead of that, data can be encoded using redundant
codes in order to detect the corrupted data and the CRC is the one of the most common codes that
is used in such cases.
2. What is CRC
CRC stands for Cyclic Redundancy Check. Which means that is based on cyclic algorithm that
generates redundant information.
So the resultant number uniquely identifies that block of data. This unique number can be used to
check the validity of data or to compare two blocks. So this approach is used in many
communication and computer systems to ensure the validity of the transmitted or stored data.
4. CRC idea
The main idea of CRC is to treat the message as binary numbers, and divide it by fixed binary
number. The remainder from this division is considered the checksum. The recipient of the
message performs the same division and compare the remainder with the "checksum" (transmitted
remainder).
5. Theory of operation:
As stated in the previous section, the CRC is a simple binary division and subtraction. The only
difference is that these operations are done on modulo arithmetic based on mod 2. For example
the addition and subtraction are replaced with XOR operation that do the sum and subtraction
without carry.
Polynomial concept
The CRC algorithm uses the term polynomial to perform all of its calculations. This polynomial
is the same concept as the traditional arithmetic polynomials. The divisor, dividend, quotient, and
remainder that are represented by numbers are represented as polynomials with binary
coefficients.
For example the number 23 (10111b) can be represented in the polynomial form as:
If we can assume that X is 2, then the operations are simplified more and some because some
terms can be canceled. For example the term 3*x3 is represented as 24 in normal number
representation and 24 = 16+8 which is x4+x3 in polynomial representation.
Generator polynomial:
In order to do the CRC calculation; a divisor must be selected which can be any one. This divisor is
called the generator polynomial. Even though, some polynomials became standard for many
applications. Polynomial selection is behind the scope of this summary.
One of the most used terms in CRC is the width of the polynomial. This width is represented by the
order of the highest power in the polynomial. The width of the polynomial in the previous example is
4, which has 5 bits in its binary representation.
Since CRC is used to detect errors, a suitable generator polynomial must be selected for each
application. This is because each polynomial has different error detection capabilities. CRC algorithms
are commonly called after the generator polynomial width, for example CRC-16 uses a generator
polynomial of width 15 and 16-bit register and CRC-32 uses polynomial width of 31 and 32-bit register.
(Xn*D)+R = (Q*G)+0
Receiver calculation
The message receiver can do one of the followings:
Separate the message and checksum. Calculate the checksum for the message (after appending
zeros) and compare the two checksums.
Checksum the whole message including the CRC (without appending zeros) and check if the new
CRC comes out as Zero.
7. Implementation:
CRC has two main implementation techniques:
• Straightforward
• Look-up table based
Straightforward:
This approach is a direct mapping for the CRC algorithm.
In fact this approach does not use standard microprocessor divide instruction because 1. We need
xor based division (no carry in addition or subtraction) 2. The dividend (the message) can be very
large and behind the processor support.
This approach is relatively low speed and consumes very small resources
This implementation is described in PAINLESS GUIDE TO CRC as:
Note: The register holds the remainder only after the last bit of the message gets out of it.
Parallel Implementation:
In real world the serial approach (bit-by-bit) calculation is not acceptable for many applications that
requires high performance or the smallest processing word size is more than a bit For that reason
parallel implementation is needed.
Conclusion:
Hence we studied and implement program for error detection and correction for 7/8 bits ASCII codes
using CRC.
Assignment No: 9
Problem Statement: Write a program to implement link state /Distance vector
routing protocol to find suitable path for transmission.
Objectives: To develop an understanding of various protocols, modern technologies and
applications
Outcome: Demonstrate the subnet formation with IP allocation mechanism and apply various
routing algorithms
Step-01: Each router prepares its routing table. By their local knowledge. each router knows
about-
• All the routers present in the network
• Distance to its neighboring routers Step-02:
• Each router exchanges its distance vector with its neighboring routers.
• Each router prepares a new routing table using the distance vectors it has obtained from
its neighbors.
• This step is repeated for (n-2) times if there are n routers in the network.
• After this, routing tables converge / become stable.
Step-01:
Each router prepares its routing table using its local knowledge.
Routing table prepared by each router is shown below- At
Router A-
A 0 A
B 2 B
C ∞ –
D 1 D
At Router B-
At Router C-
Destination Distance Next Hop
A ∞ –
B 3 B
C 0 C
D 11 D
At Router D-
Destination Distance Next Hop
A 1 A
B 7 B
C 11 C
D 0 D
Step-02:
Each router exchanges its distance vector obtained in Step-01 with its neighbors.
After exchanging the distance vectors, each router prepares a new routing table.
This is shown below-
At Router A-
• Router A receives distance vectors from its neighbors B and D.
• Router A prepares a new routing table as-
A 0 A
B 2 B
C 5 B
D 1 D
At Router B-
• Router B receives distance vectors from its neighbors A, C and D.
• Router B prepares a new routing table as-
• Cost of reaching destination A from router B = min { 2+0 , 3+∞ , 7+1 } = 2 via A.
• Cost of reaching destination C from router B = min { 2+∞ , 3+0 , 7+11 } = 3 via C.
• Cost of reaching destination D from router B = min { 2+1 , 3+11 , 7+0 } = 3 via A.
Thus, the new routing table at router B is-
A 2 A
B 0 B
C 3 C
D 3 A
At Router C-
• Router C receives distance vectors from its neighbors B and D.
• Router C prepares a new routing table as-
A 5 B
B 3 B
C 0 C
D 10 B
At Router D-
• Router D receives distance vectors from its neighbors A, B and C.
• Router D prepares a new routing table as-
• Cost of reaching destination A from router D = min { 1+0 , 7+2 , 11+∞ } = 1 via A.
• Cost of reaching destination B from router D = min { 1+2 , 7+0 , 11+3 } = 3 via A.
• Cost of reaching destination C from router D = min { 1+∞ , 7+3 , 11+0 } = 10 via
A 1 A
B 3 A
C 10 B
D 0 D
Step-03:
• Each router exchanges its distance vector obtained in Step-02 with its neighboring
routers.
• After exchanging the distance vectors, each router prepares a new routing table. This
is shown below-
At Router A-
• Router A receives distance vectors from its neighbors B and D.
• Router A prepares a new routing table as-
• Cost of reaching destination B from router A = min { 2+0 , 1+3 } = 2 via B.
• Cost of reaching destination C from router A = min { 2+3 , 1+10 } = 5 via B.
• Cost of reaching destination D from router A = min { 2+3 , 1+0 } = 1 via D.
Thus, the new routing table at router A is-
A 0 A
B 2 B
C 5 B
D 1 D
At Router B-
• Router B receives distance vectors from its neighbors A, C and D.
• Router B prepares a new routing table as-
• Cost of reaching destination A from router B = min { 2+0 , 3+5 , 3+1 } = 2 via A.
• Cost of reaching destination C from router B = min { 2+5 , 3+0 , 3+10 } = 3 via C.
• Cost of reaching destination D from router B = min { 2+1 , 3+10 , 3+0 } = 3 via A.
Thus, the new routing table at router B is-
A 2 A
B 0 B
C 3 C
D 3 A
At Router C-
• Router C receives distance vectors from its neighbors B and D.
• Router C prepares a new routing table as-
A 5 B
B 3 B
C 0 C
D 6 B
At Router D-
• Router D receives distance vectors from its neighbors A, B and C. Router D
prepares a new routing table as-
• Cost of reaching destination A from router D = min { 1+0 , 3+2 , 10+5 } = 1 via A.
• Cost of reaching destination B from router D = min { 1+2 , 3+0 , 10+3 } = 3 via A.
• Cost of reaching destination C from router D = min { 1+5 , 3+3 , 10+0 } = 6 via A.
Thus, the new routing table at router D is-
A 1 A
B 3 A
C 6 A
D 0 D
Initially, we have this list of distances (please see the list below):
• The distance from the source node to itself is 0. For this example, the source node will
be node 0 but it can be any node that you choose.
• The distance from the source node to all other nodes has not been determined yet, so
we use the infinity symbol to represent this initially. Unvisited Node:{0,1,2,3,4,5,6}
0 1 2 3 4 5 6
0 ∞ ∞ ∞ ∞ ∞ ∞
Since we are choosing to start at node 0, we can mark this node as visited. Equivalently, we
cross it off from the list of unvisited nodes and add a red border to the corresponding node in
diagram:
Now we need to start checking the distance from node 0 to its adjacent nodes. As you can see,
these are nodes 1 and 2 (see the red edges):
Unvisited Node:{1,2,3,4,5,6}
0 1 2 3 4 5 6
0 2 6 ∞ ∞ ∞ ∞
Unvisited Node:{2,3,4,5,6}
0 1 2 3 4 5 6
0 2 6 7 ∞ ∞ ∞
For node 3: the total distance is 7 because we add the weights of the edges that form the path
0 -> 1 -> 3 (2 for the edge 0 -> 1 and 5 for the edge 1 -> 3).
From the list of distances, we can immediately detect that this is node 2 with distance 6:
Unvisited Node:{3,4,5,6}
0 1 2 3 4 5 6
0 2 6 7 ∞ ∞ ∞
Node 3 already has a distance in the list that was recorded previously (7, see the list below).
This distance was the result of a previous step, where we added the weights 5 and 2 of the two
edges that we needed to cross to follow the path 0 -> 1 -> 3.
But now we have another alternative. If we choose to follow the path 0 -> 2 -> 3, we would
need to follow two edges 0 -> 2 and 2 -> 3 with weights 6 and 8, respectively, which represents
a total distance of 14.
Clearly, the first (existing) distance is shorter (7 vs. 14), so we will choose to keep the original
path 0 -> 1 -> 3. We only update the distance if the new path is shorter. Therefore, we add
this node to the path using the first alternative: 0 -> 1 -> 3.
We update the distances of these nodes to the source node, always trying to find a shorter path,
if possible:
For node 4: the distance is 17 from the path 0 -> 1 -> 3 -> 4.
For node 5: the distance is 22 from the path 0 -> 1 -> 3 -> 5.
Notice that we can only consider extending the shortest path (marked in red). We cannot
consider paths that will take us through edges that have not been added to the shortest path (for
example, we cannot form a path that goes through the edge 2 -> 3). Unvisited Node:{4,5,6}
0 1 2 3 4 5 6
0 2 6 7 17 22 ∞
We need to choose which unvisited node will be marked as visited now. In this case, it's node
4 because it has the shortest distance in the list of distances. We add it graphically in the
diagram:
For node 5:
• The first option is to follow the path 0 -> 1 -> 3 -> 5, which has a distance of 22 from
the source node (2 + 5 + 15). This distance was already recorded in the list of distances
in a previous step.
• The second option would be to follow the path 0 -> 1 -> 3 -> 4 -> 5, which has a
distance of 23 from the source node (2 + 5 + 10 + 6).
Clearly, the first path is shorter, so we choose it for node 5.
For node 6:
• The path available is 0 -> 1 -> 3 -> 4 -> 6, which has a distance of 19 from the source
node (2 + 5 + 10 + 2).
Unvisited Node:{5,6}
0 1 2 3 4 5 6
0 2 6 7 17 22 19
Only one node has not been visited yet, node 5. Let's see how we can include it in the path.
There are three different paths that we can take to reach node 5 from the nodes that have been
added to the path:
• Option 1: 0 -> 1 -> 3 -> 5 with a distance of 22 (2 + 5 + 15).
• Option 2: 0 -> 1 -> 3 -> 4 -> 5 with a distance of 23 (2 + 5 + 10 + 6).
• Option 3: 0 -> 1 -> 3 -> 4 -> 6 -> 5 with a distance of 25 (2 + 5 + 10 + 2 + 6). Unvisited
Node:{6}
0 1 2 3 4 5 6
0 2 6 7 17 22 19
We have the final result with the shortest path from node 0 to each node in the graph.
Conclusion:
Hence, we have successfully implement link state /Distance vector routing protocol to
find suitable path for transmission.
Assignment No: 10
Problem Statement: To study the IPsec (ESP and AH) protocol by capturing the packets
using Wireshark tool.
Objectives: To learn modern tools for network traffic analysis
Outcome: Use network security services and mechanisms Software
& Hardware Requirments:
Operating System: Ubuntu
Packet Analyzer Tool: Wireshark
Hardware: i3 Processor, 4GB RAM, 500GB HDD
Theory:
1. IPSec (IP Security) architecture uses two protocols to secure the traffic or data flow.
These protocols are ESP (Encapsulation Security Payload) and AH (Authentication
Header). IPSec Architecture include protocols, algorithms, DOI, and
Key Management. All these components are very important in order to provide the
three main services:
● Confidentiality
● Authentication
● Integirity
1.1. Architecture:
Architecture or IP Security Architecture covers the general concepts, definitions,
protocols, algorithms and security requirements of IP Security technology.
1.2. ESP Protocol:
ESP(Encapsulation Security Payload) provide the confidentiality service. Encapsulation
Security Payload is implemented in either two ways:
● ESP with optional Authentication.
● ESP with Authentication.
Packet Format:
Theory:
1. Transmission Media:
On any network, the various entities must communicate through some form of media. Just
as humans can communicate through telephone wires or sound waves in the air,
computers can communicate through cables, light, and radio waves. Transmission media
enable computers to send and receive messages but do not guarantee that the messages
will be understood.
Most common network transmission media are coaxial cable, shielded twisted-pair
cable, and unshielded twisted-pair cable, fiber-optic cable and wireless
communications.
Select the appropriate media for various situations. Media choices include the following:
● Twisted-pair cable
● Coaxial cable
● Fiber-optic cable
Wireless communications Situational elements include the following:
● Cost
● Distance limitations
● Number of nodes
2. Types of transmission media
In data communication terminology, a transmission medium is a physical path
between the transmitter and the receiver i.e it is the channel through which data is
sent from one place to another. Transmission Media is broadly classified into the
following types.
4. Packet Tracer
Packet Tracer is a cross-platform visual simulation tool designed by Cisco Systems that
allows users to create network topologies and imitate modern computer networks. The
software allows users to simulate the configuration of Cisco routers and switches using a
simulated command line interface. Packet Tracer makes use of a drag and drop user
interface, allowing users to add and remove simulated network devices as they see fit. The
software is mainly focused towards Certified Cisco Network Associate Academy students
as an educational tool for helping them learn fundamental CCNA concepts. Previously
students enrolled in a CCNA Academy program could freely download and use the tool
free of charge for educational use.
Packet Tracer allows students to design complex and large networks, which is often not
feasible with physical hardware, due to costs. Packet Tracer is commonly used by CCNA
Academy students, since it is available to them for free. However, due to functional
limitations, it is intended by CISCO to be used only as a learning aid, not a replacement for
Cisco routers and switches.
4.1 How to install Packet Tracer latest version 7.1.1 on Ubuntu 16.04.4++
1. Create a Cisco NetCad account at Cisco Network Academy
2. Login to registered netcad account.
3. Navigate to resources and download latest version of Cisco Packet Tracer for Linux.
4. Install/ de-package Packet Tracer using following command
$ sudo dpkg –i < Packet Tracer File Name >.deb
5. if dependency missing error encounter you can fix that using following command $
sudo apt install –f
6. Then again try to Install/ de-package Packet Tracer using following command
$ sudo dpkg –i < Packet Tracer File Name >.deb
7. Accept License Agreement and proceed.
8. once installation complete you can open Packet Tracer using following command
$ sudo packettracer
9. Done
Conclusion:
Hence, we have Successfully Demonstrate the different types of topologies and types of
transmission media by using a packet tracer tool.
Output:
1. Bus Topology
2. Ring Topology
3. Star Topology
4. Hybrid Topology
Assignment No: 12
Problem Statement: Setup a WAN which contains wired as well as wireless LAN by
using a packet tracer tool. Demonstrate transfer of a packet from LAN 1 (wired LAN) to
LAN2 (Wireless LAN).
Objectives: To learn computer network topologies and types of network, network
hardware and software components.
Outcome: Students will be able to Analyze the requirements of network types, topology
and transmission media
Software & Hardware Requirments:
Operating System: Ubuntu
Tool: Packet Tracer
Hardware: i3 Processor, 4GB RAM, 500GB HDD
Theory:
1. Local Area Network
A Local Area Network (LAN) is a group of computer and peripheral devices which are
connected in a limited area such as school, laboratory, home, and office building. It is a
widely useful network for sharing resources like files, printers, games, and other
application. The simplest type of LAN network is to connect computers and a printer in
someone's home or office. In general, LAN will be used as one type of transmission
medium.
It is a network which consists of less than 5000 interconnected devices across several
buildings.
1.1 Characteristics of LAN
Here are important characteristics of a LAN network:
• It is a private network, so an outside regulatory body never controls it.
• LAN operates at a relatively higher speed compared to other WAN systems.
• There are various kinds of media access control methods like token ring and Ethernet.
1.2 Advantages of LAN
• Computer resources like hard-disks, DVD-ROM, and printers can share local area
networks. This significantly reduces the cost of hardware purchases.
• You can use the same software over the network instead of purchasing the licensed
software for each client in the network.
• Data of all network users can be stored on a single hard disk of the server computer.
• You can easily transfer data and messages over networked computers.
• It will be easy to manage data at only one place, which makes data more secure.
• Local Area Network offers the facility to share a single internet connection among all the
LAN users.
1.3 Disadvantages of LAN
• LAN will indeed save cost because of shared computer resources, but the initial cost of
installing Local Area Networks is quite high.
• The LAN admin can check personal data files of every LAN user, so it does not offer good
privacy.
• Unauthorized users can access critical data of an organization in case LAN admin is not
able to secure centralized data repository.
• Local Area Network requires a constant LAN administration as there are issues related
to software setup and hardware failures
2. Wireless Networks
Computer networks that are not connected by cables are called wireless networks. They
generally use radio waves for communication between the network nodes. They allow
devices to be connected to the network while roaming around within the network
coverage.
2.1 Types of Wireless Networks
• Wireless LANs − Connects two or more network devices using wireless distribution
techniques.
• Wireless MANs − Connects two or more wireless LANs spreading over a metropolitan
area.
• Wireless WANs − Connects large areas comprising LANs, MANs and personal networks.
2.2 Advantages of Wireless Networks
• It provides clutter-free desks due to the absence of wires and cables.
• It increases the mobility of network devices connected to the system since the devices
need not be connected to each other.
• Accessing network devices from any location within the network coverage or Wi-Fi
hotspot becomes convenient since laying out cables is not needed.
• Installation and setup of wireless networks are easier.
• New devices can be easily connected to the existing setup since they needn’t be wired to
the present equipment. Also, the number of equipment that can be added or removed to
the system can vary considerably since they are not limited by the cable capacity. This
makes wireless networks very scalable.
• Wireless networks require very limited or no wires. Thus, it reduces the equipment and
setup costs.
2.3 Examples of wireless networks
• Mobile phone networks
• Wireless sensor networks
• Satellite communication networks
• Terrestrial microwave networks
3. Wireless LAN
Wireless LAN stands for Wireless Local Area Network. It is also called LAWN (Local Area
Wireless Network). WLAN is one in which a mobile user can connect to a Local Area Network
(LAN) through a wireless connection.
The IEEE 802.11 group of standards defines the technologies for wireless LANs. For path
sharing, 802.11 standard uses the Ethernet protocol and CSMA/CA (carrier sense
multiple access with collision avoidance). It also uses an encryption method i.e. wired
equivalent privacy algorithm.
Wireless LANs provide high speed data communication in small areas such as building or
an office. WLANs allow users to move around in a confined area while they are still
connected to the network.
In some instance wireless LAN technology is used to save costs and avoid laying cable,
while in other cases, it is the only option for providing high-speed internet access to the
public. Whatever the reason, wireless solutions are popping up everywhere.
3.1 Advantages of WLANs
• Flexibility: Within radio coverage, nodes can communicate without further
restriction. Radio waves can penetrate walls, senders and receivers can be placed
anywhere (also non-visible, e.g., within devices, in walls etc.).
• Planning: Only wireless ad-hoc networks allow for communication without previous
planning, any wired network needs wiring plans.
• Design: Wireless networks allow for the design of independent, small devices which
can for example be put into a pocket. Cables not only restrict users but also designers
of small notepads, PDAs, etc.
• Robustness: Wireless networks can handle disasters, e.g., earthquakes, flood etc.
whereas, networks requiring a wired infrastructure will usually break down
completely in disasters.
• Cost: The cost of installing and maintaining a wireless LAN is on average lower than
the cost of installing and maintaining a traditional wired LAN, for two reasons. First,
after providing wireless access to the wireless network via an access point for the first
user, adding additional users to a network will not increase the cost. And second,
wireless LAN eliminates the direct costs of cabling and the labor associated with
installing and repairing it.
• Ease of Use: Wireless LAN is easy to use and the users need very little new information
to take advantage of WLANs.
• 3.2 Disadvantages of WLANs
• Quality of Services: Quality of wireless LAN is typically lower than wired networks.
The main reason for this is the lower bandwidth due to limitations is radio
transmission, higher error rates due to interference and higher delay/delay variation
due to extensive error correction and detection mechanisms.
• Proprietary Solutions: Due to slow standardization procedures, many companies
have come up with proprietary solutions offering standardization functionality plus
many enhanced features. Most components today adhere to the basic standards IEEE
802.11a or 802.11b.
• Restrictions: Several govt. and non-govt. institutions world-wide regulate the
operation and restrict frequencies to minimize interference.
• Global operation: Wireless LAN products are sold in all countries so, national and
international frequency regulations have to be considered.
• Low Power: Devices communicating via a wireless LAN are typically power
consuming, also wireless devices running on battery power. Whereas the LAN design
should take this into account and implement special power saving modes and power
management functions.
• License free operation: LAN operators don't want to apply for a special license to be
able to use the product. The equipment must operate in a license free band, such as the
2.4 GHz ISM band.
• Robust transmission technology: If wireless LAN uses radio transmission, many
other electrical devices can interfere with them (such as vacuum cleaner, train engines,
hair dryers, etc.).Wireless LAN transceivers cannot be adjusted for perfect
transmission is a standard office or production environment.
Conclusion:
Hence, we have successfully setup a WAN which contains wired as well as wireless LAN
by using a packet tracer tool.
Procedure:
Step1. Connect PC0,PC1,PC2 to Switch in wired LAN
PC Port Switch(2960-
24TT)
PC0 FastEthernet0 FastEthernet0/1
PC1 FastEthernet0 FastEthernet0/2
PC2 FastEthernet0 FastEthernet0/3
Theory:
1. HTTP (Hyper Text Transfer Protocol)
The Hypertext Transfer Protocol (HTTP) is application-level protocol for collaborative,
distributed, hypermedia information systems. It is the data communication protocol used
to establish communication between client and server. HTTP is TCP/IP based
communication protocol, which is used to deliver the data like image files, query results,
HTML files etc on the World Wide Web (WWW) with the default port is TCP 80. It provides
the standardized way for computers to communicate with each other.
1.1 The Basic Characteristics of HTTP (Hyper Text Transfer Protocol):
o It is the protocol that allows web servers and browsers to exchange data over the
web.
o It is a request response protocol.
1.2 The Basic Features of HTTP (Hyper Text Transfer Protocol):
There are three fundamental features that make the HTTP a simple and powerful protocol
used for communication:
o HTTP is media independent: It specifies that any type of media content can be
sent by HTTP as long as both the server and the client can handle the data content.
o HTTP is connectionless: It is a connectionless approach in which HTTP client i.e.,
a browser initiates the HTTP request and after the request is sent the client
disconnects from server and waits for the response.
o HTTP is stateless: The client and server are aware of each other during a current
request only. Afterwards, both of them forget each other. Due to the stateless
nature of protocol, neither the client nor the server can retain the information
about different request across the web pages.
1.3 HTML
HTML stands for Hyper Text Markup Language, which is the most widely used language
on Web to develop web pages. HTML was created by Berners-Lee in late 1991 but "HTML
2.0" was the first standard HTML specification which was published in 1995. HTML 4.01
was a major version of HTML and it was published in late 1999. Though HTML 4.01
version is widely used but currently we are having HTML-5 version which is an extension
to HTML 4.01, and this version was published in 2012.
Hypertext refers to the way in which Web pages (HTML documents) are linked
together. Thus, the link available on a webpage is called Hypertext. Basic HTML
Document
<html>This tag encloses the complete HTML document and mainly comprises of
document header which is represented by <head>...</head> and document body which
is represented by <body>...</body> tags.
<head>This tag represents the document's header which can keep other HTML tags like
<title>, <link> etc.
<title>The <title> tag is used inside the <head> tag to mention the document title.
<body>This tag represents the document's body which keeps other HTML tags like
<h1>, <div>, <p> etc.
2. What is https?
HTTPS stands for Hyper Text Transfer Protocol Secure. It is a protocol for securing the
communication between two systems e.g. the browser and the web server. The following
figure illustrates the difference between communication over http and https:
Outcome: Demonstrate the subnet formation with IP allocation mechanism and apply various
routing algorithms
1. Routing Protocols
A routing protocol specifies how routers communicate with each other to distribute
information that enables them to select routes between nodes on a computer network.
Routers perform the traffic directing functions on the Internet; data packets are
forwarded through the networks of the internet from router to router until they reach
their destination computer. Routing algorithms determine the specific choice of route.
Each router has a prior knowledge only of networks attached to it directly. A routing
protocol shares this information first among immediate neighbors, and then throughout
the network. This way, routers gain knowledge of the topology of the network. The ability
of routing protocols to dynamically adjust to changing conditions such as disabled
connections and components and route data around obstructions is what gives the
Internet its fault tolerance and high availability.
The specific characteristics of routing protocols include the manner in which they avoid
routing loops, the manner in which they select preferred routes, using information about
hop costs, the time they require to reach routing convergence, their scalability, and other
factors such as relay multiplexing and cloud access framework parameters. Certain
additional characteristics such as multilayer interfacing may also be employed as a means
of distributing uncompromised networking gateways to authorized ports
2. Routing Information Protocol (RIP)
Routing Information Protocol (RIP) is a dynamic routing protocol which uses hop count as a
routing metric to find the best path between the source and the destination network. It is a
distance vector routing protocol which has AD(Administrative Distance) value 120 and works
on the application layer of OSI model. RIP uses port number 520.
In the above figure, when the router 1 forwards the packet to the router 2 then it will count as
1 hop count. Similarly, when the router 2 forwards the packet to the router 3 then it will count
as 2 hop count, and when the router 3 forwards the packet to router 4, it will count as 3 hop
count. In the same way, RIP can support maximum upto 15 hops, which means that the 16
routers can be configured in a RIP.
o Command: It is an 8-bit field that is used for request or reply. The value of the request
is 1, and the value of the reply is 2. o Version: Here, version means that which version
of the protocol we are using.
Suppose we are using the protocol of version1, then we put the 1 in this field.
o Reserved: This is a reserved field, so it is filled with zeroes. o Family: It is a 16-bit
field. As we are using the TCP/IP family, so we put 2 value in this field.
o Network Address: It is defined as 14 bytes field. If we use the IPv4 version, then we
use 4 bytes, and the other 10 bytes are all zeroes.
o Distance: The distance field specifies the hop count, i.e., the number of hops used to
reach the destination.
2.6 RIP timers:
• Update timer: The default timing for routing information being exchanged by the
routers operating RIP is 30 seconds. Using Update timer, the routers exchange their
routing table periodically.
• Invalid timer: If no update comes until 180 seconds, then the destination router
consider it as invalid. In this scenario, the destination router mark hop count as 16 for
that router.
• Flush time : It is the time after which the entry of the route will be flushed if it doesn’t
respond within the flush time. It is 60 seconds by default. This timer starts after the
route has been declared invalid and after 60 seconds i.e time will be 180 + 60 = 240
seconds.
Note that all these times are adjustable. Use this command to change the timers :
R1(config-router)# timers basic
R1(config-router)# timers basic 20 80 80 90
Border Gateway Protocol (BGP) is used to Exchange routing information for the internet and
is the protocol used between ISP which are different ASes.
The protocol can connect together any internetwork of autonomous system using an arbitrary
topology. The only requirement is that each AS have at least one router that is able to run BGP
and that is router connect to at least one other AS’s BGP router. BGP’s main function is to
exchange network reach-ability information with other BGP systems. Border Gateway
Protocol constructs an autonomous systems’ graph based on the information exchanged
between BGP routers.
4.1 What is an autonomous system?
The Internet is a network of networks; it’s broken up into hundreds of thousands of smaller
networks known as autonomous systems (AS). Each of these networks is essentially a large
pool of routers run by a single organization.
If we continue to think of BGP as the postal service of the Internet, AS’s are like individual
post office branches. A town may have hundreds of mailboxes, but the mail in those boxes
must go through the local postal branch before being routed to another destination. The internal
routers within an AS are like mailboxes, they forward their outbound transmissions to the AS,
which then uses BGP routing to get these transmissions to their destinations.
The diagram above illustrates a simplified version of BGP. In this version there are only 6
autonomous systems on the Internet. If AS1 needs to route a packet to AS3, it has two different
options:
Hopping to AS2 and then to AS3:
AS2 → AS3
Or hopping to AS6, then to AS5, AS4, and finally to AS3:
AS6 → AS5 → AS4 → AS3
In this simplified model, the decision seems simple. The AS2 route requires fewer hops than
the AS6 route, and therefore it is the quickest, most efficient route. Now imagine that there are
hundreds of thousands of AS’s and that hop count is only one part of a complex route selection
algorithm. That’s the reality of BGP routing on the Internet.
The structure of the Internet is constantly changing, with new systems popping up and existing
systems becoming unavailable. Because of this, every AS must be kept up to date with
information regarding new routes as well as obsolete routes. This is done through peering
sessions where each AS connects to neighboring AS’s with a TCP/IP connection for the
purpose of sharing routing information. Using this information, each AS is equipped to
properly route outbound data transmissions coming from within.
Here’s where part of our analogy falls apart: Unlike post office branches, autonomous systems
are not all part of the same organization. As such, they have no reason to be friendly to each
other and are often times business competitors! For this reason, BGP routes sometimes take
business considerations into account. Autonomous Systems often charge each other to carry
traffic across their networks, and the price of access can be factored into which route is
ultimately selected.
4.2 Characteristics of Border Gateway Protocol (BGP):
• Inter-Autonomous System Configuration: The main role of BGP is to provide
communication between two autonomous systems.
• BGP supports Next-Hop Paradigm.
• Coordination among multiple BGP speakers within the AS (Autonomous System).
• Path Information: BGP advertisement also include path information, along with the
reachable destination and next destination pair.
• Policy Support: BGP can implement policies that can be configured by the
administrator. For ex:- a router running BGP can be configured to distinguish between
the routes that are known within the AS and that which are known from outside the AS.
• Runs Over TCP.
• BGP conserve network Bandwidth.
• BGP supports CIDR.
• BGP also supports Security.
4.3 Functionality of Border Gateway Protocol (BGP): BGP
peers performs 3 functions, which are given below.
1. The second function mainly focus on sending of negative or positive reach-ability
information.
2. The third function verifies that the peers and the network connection between them are
functioning correctly.
BGP Route Information Management Functions:
• Route Storage:
Each BGP stores information about how to reach other networks.
• Route Update:
In this task, Special techniques are used to determine when and how to use the
information received from peers to properly update the routes.
• Route Selection:
Each BGP uses the information in its route databases to select good routes to each
network on the internet network.
• Route advertisement:
Each BGP speaker regularly tells its peer what is knows about various networks and
methods to reach them.
Conclusion:
Hence, we have successfullyconfigure 3 router network using
RIP/OSPF/BGPprotocol.
5. Assign IP Address to PC
Device IP Address Subnet Mask Default Gateway
PC0 192.168.1.2 255.255.255.0 192.168.1.1
PC1 192.168.1.3 255.255.255.0 192.168.1.1
PC2 192.168.2.2 255.255.255.0 192.168.2.1
PC3 192.168.2.3 255.255.255.0 192.168.2.1
PC4 192.168.3.2 255.255.255.0 192.168.3.1
PC5 192.168.3.3 255.255.255.0 192.168.3.1
IP Address
10.0.0.0
11.0.0.0
12.0.0.0
192.168.1.0
192.168.2.0
192.168.3.0
8. Send Packet from any PC to other PC.
OutPut:
2. OSPF Configuration Procedure
1. Drag Two PC(PC0, PC1) and Three Router(1841) Router0, Router1, Router2.
2. Connect PC0 to Router0, PC1 to Router2.
Device Port Device Port
PC0 FastEthernet 0 Router0 FastEthernet 0/0
PC1 FastEthernet 0 Connect To Router2 FastEthernet 0/0
3. Assign IP Address to PC
Device IP Default Gateway
PCO 192.168.1.2 192.168.1.1
PC1 192.168.2.2 192.168.2.1
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router ospf 1
Router(config-router)#network 10.0.0.0 0.0.0.255 area 0
Router(config-router)#network 11.0.0.0 0.255.255.255 area 0
Router(config-router)#exit
Router(config)#
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router ospf 1
Router(config-router)#network 192.168.2.0 0.0.0.255 area 0
Router(config-router)#network 11.0.0.0 0.255.255.255 area 0
Router(config-router)#network 12.0.0.0 0.255.255.255 area 0
Router(config-router)#exit
Router(config)#
10. Send Packet from PC) to PC1
Output:
BGP Configuration Procedure
1. Drag Three PC(PC0, PC1,pc2) and Three Router(1841) Router0, Router1, Router2.
2. Connect PC0 to Router0, PC1 to Router1, PC2 to Router2.
Device Port Device Port
PC0 FastEthernet 0 Router0 FastEthernet 0/0
PC1 FastEthernet 0 Connect To Router1 FastEthernet 0/0
PC2 FastEthernet 0 Router2 FastEthernet 0/0
3. Go to Router Physical Configuration and add HWIC-2T,Cisco 2-Port Serial High-Speed
WAN Interface Card which providing 2 serial ports. Connect Router0 to Router1, Router1
to Router2, Router1 to Router2 using following Configuration.
Device Port Device Port
Router0 Serial 0/0/0 Router1 Serial 0/0/0
Router1 Serial 0/0/1 Connect To Router2 Serial 0/0/0
Router0 Serial 0/0/1 Router2 Serial 0/0/1
5. Assign IP Address to PC
Device IP Address Subnet Mask Default Gateway
PC0 192.168.3.2 255.255.255.0 192.168.3.1
PC1 192.168.1.2 255.255.255.0 192.168.1.1
PC2 192.168.2.2 255.255.255.0 192.168.2.1
6. Assign IP Address to Router Serial Port and Turn it ON
Device Port IP Address Subnet Mask
Router0 Serial 0/0/0 10.0.0.2 255.0.0.0
Router0 Serial 0/0/1 12.0.0.1 255.0.0.0
Router1 Serial 0/0/0 10.0.0.1 255.0.0.0
Router1 Serial 0/0/1 11.0.0.1 255.0.0.0
Router2 Serial 0/0/0 11.0.0.2 255.0.0.0
Router2 Serial 0/0/1 12.0.0.2 255.0.0.0
7. Open CLI of Router0 and execute following command
Router(config)#router bgp 300
Router(config-router)#network 192.168.3.0
Router(config-router)#network 10.0.0.0
Router(config-router)#network 12.0.0.0
Router(config-router)#neighbor 10.0.0.1 remote-as 100 Router(config-router)#neighbor
12.0.0.2 remote-as 200
Router(config-router)#exit