AdvancedNetworks
AdvancedNetworks
AIM:
Implement client-server communication employing socket API’s to illustrate the usage of
TCP/UDP protocol.
APPROACH:
We will implement client-server communication using TCP (Transmission Control Protocol) and
UDP (User Datagram Protocol) socket APIs in Java.
1. TCP Implementation:
o A TCP server will be created to listen for incoming client connections.
o A TCP client will connect to the server and send a message.
o The server will receive and respond to the message, ensuring reliable, connection-
oriented communication.
2. UDP Implementation:
o A UDP server will be created to listen for incoming datagrams.
o A UDP client will send a datagram to the server.
o The server will receive and respond to the client without establishing a connection.
THEORY:
• Connection-oriented protocol.
• Ensures reliable data transmission with acknowledgment.
• Uses Socket for the client and ServerSocket for the server in Java.
• Connectionless protocol.
• No guarantee of data delivery (best-effort service).
• Uses DatagramSocket and DatagramPacket in Java for sending and receiving messages.
TCP Implementation:
import java.io.*;
import java.net.*;
1
BufferedReader in = new BufferedReader(new
InputStreamReader(clientSocket.getInputStream()));
PrintWriter out = new PrintWriter(clientSocket.getOutputStream(),
true);
clientSocket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
import java.io.*;
import java.net.*;
} catch (IOException e) {
e.printStackTrace();
}
}
}
UDP Implementation:
import java.net.*;
socket.receive(packet);
String receivedMessage = new String(packet.getData(), 0,
packet.getLength());
System.out.println("Received from client: " + receivedMessage);
socket.send(responsePacket);
} catch (Exception e) {
e.printStackTrace();
}
}
}
import java.net.*;
} catch (Exception e) {
e.printStackTrace();
}
}
}
OUTPUT:
1. TCP Output
3
2. UDP Output
ILLUSTRATION:
UDP sends datagrams without establishing a connection, making it faster but less reliable.
CONCLUSION:
This implementation demonstrates how to use Java socket APIs to establish client-server
communication using both TCP and UDP protocols.
4
Assignment Number: 2 Date: 25/01/2025
AIM:
Using any network simulation tool, simulate routing algorithms/congestion control
algorithms/network applications in traditional network/SDN/Adhoc Networks.
APPROACH:
We will use NS2 (Network Simulator 2) to simulate routing algorithms in a traditional network
setup. The simulation will focus on the Distance Vector Routing Protocol (DVR) and Link State
Routing Protocol (LSR) to evaluate their performance in packet transmission.
Steps to follow:
THEORY:
1. Routing Algorithms:
Routing algorithms determine the best path for data packets in a network. Two major types are:
5
Implementation in NS2 (TCL Script)
# Define simulator
set ns [new Simulator]
# Define nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
# Start simulation
$ns at 0.1 "$udp start"
$ns at 4.0 "finish"
proc finish {} {
global ns nf
$ns flush-trace
close $nf
exec nam out.nam &
exit 0
}
$ns run
6
OUTPUT:
To execute the TCL script, run the following command in the NS2 terminal:
ns routing_simulation.tcl
nam out.nam
Each entry represents a packet being sent (s), received (r), or dropped (d).
CONCLUSION:
7
Assignment Number: 3 Date: 01/02/2025
AIM:
Investigate network protocols by capturing and studying packets using Wireshark..
APPROACH:
We will use Wireshark, a powerful network protocol analyzer, to capture and analyze network
packets. The focus will be on investigating the behaviour of different network protocols such as
TCP, UDP, ICMP, and HTTP.
Steps to follow:
8
3. Filter and Analyze Protocols – Use Wireshark filters to study specific protocols.
4. Interpret Packet Details – Analyze key fields such as source/destination IP, port numbers,
sequence numbers, and flags.
9
THEORY:
1. What is Wireshark?
Wireshark is a network protocol analyzer that captures and inspects packets traveling over a
network. It helps in:
1. Open Wireshark.
2. Select an active network interface (e.g., Wi-Fi, Ethernet).
3. Click Start Capture.
4. Perform a network activity, such as opening a website or pinging a server.
5. Click Stop Capture after a few seconds.
10
Apply icmp filter to capture Ping packets:
Captured TCP SYN, SYN-ACK, and ACK packets confirming a successful three-way handshake.
Captured an HTTP GET request and 200 OK response showing website retrieval.
CONCLUSION:
• Wireshark successfully captured and analyzed network packets for TCP, UDP, ICMP, and
HTTP.
• The TCP handshake confirmed reliable connection establishment.
• The ICMP Echo request/reply validated network connectivity.
• The HTTP request/response demonstrated how web traffic is exchanged.
• This method is essential for troubleshooting, security analysis, and protocol behavior
study.
11
Assignment Number: 4 Date: 08/02/2025
AIM:
SSH to raisoni.net and run a traceroute to google.com. List the results, then interpret and
report your findings.
APPROACH:
THEORY:
What is Traceroute?
traceroute (or tracert on Windows) is a network diagnostic tool that shows the path packets take
from a source to a destination. It helps identify:
Steps to Perform:
traceroute google.com
tracert google.com
12
OUTPUT:
INTERPRETATION OF RESULTS:
1. Number of Hops
2. Latency Trends
CONCLUSION:
13
Assignment Number: 5 Date: 22/02/2025
AIM:
Install any Proxy Server and configure an application gateway.
APPROACH:
We will install and configure Squid Proxy, a widely used caching proxy server. Then, we will set up
an Application Gateway using NGINX to control access to web applications.
Steps to Follow:
THEORY:
A proxy server acts as an intermediary between a client and the internet, forwarding requests and
responses. Benefits include:
14
Implementation:
For Ubuntu/Debian:
For CentOS/RHEL:
Install NGINX:
Add the following configuration for reverse proxying and application gateway:
server {
listen 80;
server_name myproxyserver.com;
15
location / {
proxy_pass http://localhost:3128;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
curl -I http://myproxyserver.com
If the proxy is configured correctly, you should receive HTTP 200 OK responses.
CONCLUSION:
16
Assignment Number: 6 Date: 01/03/2025
AIM:
Install any Firewall and configure it as per the defined security policy.
APPROACH:
We will install UFW (Uncomplicated Firewall) or iptables (for more advanced control) to secure a
network based on a defined security policy. The firewall will be configured to:
THEORY:
A firewall is a security mechanism that controls incoming and outgoing traffic based on predefined
rules. Firewalls help:
Types of Firewalls:
Implementation:
We will use UFW (for simplicity) and iptables (for advanced users).
17
Step 2: Define a Security Policy
Rule Action
Allow SSH (Port 22) Allow
Allow HTTP/HTTPS (80,443) Allow
Allow DNS (53) Allow
Block all other traffic Deny
sudo iptables -F
18
Step 4: Verify Firewall Configuration
For UFW:
For iptables:
sudo iptables -L -v -n
Status: active
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
443/tcp ALLOW Anywhere
53/udp ALLOW Anywhere
CONCLUSION
19
Assignment Number: 7 Date: 08/03/2025
AIM:
Install, Configure and study any Intrusion Detection System (IDS).
APPROACH:
We will install Snort, a widely used Intrusion Detection System (IDS), configure it to monitor
network traffic, and analyze alerts generated for suspicious activity.
Steps to Follow:
THEORY:
An Intrusion Detection System (IDS) monitors network traffic for malicious activity and generates
alerts based on predefined rules.
Types of IDS:
For Ubuntu/Debian:
20
For CentOS/RHEL:
alert icmp any any -> $HOME_NET any (msg:"ICMP Ping Detected"; sid:1000001;
rev:1;)
21
OUTPUT & OBSERVATIONS
CONCLUSION
22