Network Design LAB-MANUAL
Network Design LAB-MANUAL
LAB MANUAL
Second Year IT – Semester IV
Theory:
i) arp
This diagnostic command displays and modifies the IP-to-Ethernet or Token Ring physical
address translation tables used by the Address Resolution Protocol (ARP).
Syntax
arp -a [inet_addr] [-N [if_addr]]
arp -dinet_addr [if_addr]
arp -sinet_addrether_addr [if_addr]
Parameters
o -a: Displays current ARP entries by querying TCP/IP. If inet_addr is specified, only the IP and
physical Addresses for the specified host are displayed.
o -d:Deletes the entry specified by inet_addr
o -s: adds an entry in the ARP cache to associate the IP address inet_addrwith the physical
address ether_addr.The physical address is given as 6 hexadecimal bytes separated by
hyphens. The IP address is specified using dotted decimal notation. The entry is static. It will
not be automatically removed from the cache after the timeout expires and will not exist after a
reboot of your computer.
o -N [if_addr]:Displays the ARP entries for the network interface specified by if_addr.
ether_addr Specifies a physical address. if_addr Specifies, if present, the IP address of the
interface whose address translation table should be modified. If not present, the first applicable
interface will be used. inet_addr Specifies an IP address in dotted decimal notation.
ii) hostname
This diagnostic command prints the name of the host on which the command is used.
Syntax:
hostname -- This command has no parameters.
iii) ipconfig
This diagnostic command displays all current TCP/IP network configuration values. This
command is useful on computers running DHCP because it enables users to determine which
TCP/IP configuration values have been configured by DHCP. If you enter only ipconfigwithout
parameters, the response is a display of all of the current TCP/IP configuration values, including
IP address, subnet mask, and default gateway.
Syntax
ipconfig [/all | /renew [adapter] | /release [adapter]]
Parameters
o all: Produces a full display. Without this switch, ipconfig displays only the IP address, subnet
mask, and default gateway values for each network card.
o renew [adapter]:Renews DHCP configuration parameters. This option is available only on
computers running the DHCP Client service. To specify an adapter name, type the adapter
name that appears when you use ipconfig without parameters.
o release [adapter]:Releases the current DHCP configuration. This option disables TCP/IP on
the local computer and is available only on DHCP clients. To specify an adapter name, type
the adapter name that appears when you use ipconfig without parameters.
iv) netstat
This diagnostic command displays protocol statistics and current TCP/IP network connections.
Syntax
netstat [-a] [-e][-n][-s] [-p protocol] [-r] [interval]
Parameters
o -a:Displays all connections and listening ports; server connections are usually not shown.
o -e: Displays Ethernet statistics. This can be combined with the -s option.
o -n: Displays addresses and port numbers in numerical form (rather than attempting name
lookups).
o -s:Displays per-protocol statistics. By default, statistics are shown for TCP, UDP, ICMP, and
IP; the -p option can be used to specify a subset of the default.
o -p protocol:Shows connections for the protocol specified.
o -r Displays the contents of the routing table.
o Interval:Redisplays selected statistics, pausing interval seconds between each display.
v) ping
This diagnostic command verifies connections to one or more remote computers.
Syntax
ping [-t] [-a] [-n count] [-l length] [-f] [-i ttl] [-v tos] [-r count] [-s count]
[[-j host-list] | [-k host-list]] [-w timeout] destination-list
Parameters
o -t: Pings the specified host until interrupted.
o -a:Resolves addresses to host names.
o -n:count Sends the number of ECHO packets specified by count. The default is 4.
o -l length:Sends ECHO packets containing the amount of data specified by length. The default is
64 bytes; the maximum is 8192.
o -f:Sends a Do Not Fragment flag in the packet. The packet will not be fragmented by gateways on
the route.
o -ittl: Sets the time to live field to the value specified by ttl.
o -v tos: Sets the type of service field to the value specified by tos.
o -r count:Records the route of the outgoing packet and the returning packet in the record route
field. A minimum of 1 to a maximum of 9 hosts must be specified by count.
o -s count: Specifies the timestamp for the number of hops specified by count.
o -j host-list: Routes packets via the list of hosts specified by host-list. Consecutive hosts can be
separated by intermediate gateways (loose source routed). The maximum number allowed by IP is
9.
o -k host-list: Routes packets via the list of hosts specified by host-list. Consecutive hosts cannot be
separated by intermediate gateways (strict source routed). The maximum number allowed by IP is
9.
o -w timeout:Specifies a timeout interval in milliseconds.
o destination-list:Specifies the remote hosts to ping.
vi) route
This diagnostic command manipulates network routing tables.
Syntax
route [-f] [command [destination] [MASK netmask] [gateway] [METRIC metric]]
Parameters
o -f: Clears the routing tables of all gateway entries. If this parameter is used in conjunction with
one of the commands, the tables are cleared prior to running the command.
o command:Specifies one of four commands.
Command Purpose
print Prints a route
add Adds a route
delete Deletes a route
change Modifies an existing route
vii) tracert
This diagnostic utility determines the route taken to a destination by sending Internet Control
Message Protocol (ICMP) echo packets with varying time-to-live (TTL) values to the destination.
Each router along the path is required to decrement the TTL on a packet by at least 1 before
forwarding it, so the TTL is effectively a hop count. When the TTL on a packet reaches 0, the
router is supposed to send back an ICMP Time Exceeded message to the source computer.
Tracert determines the route by sending the first echo packet with a TTL of 1 and incrementing the
TTL by 1 on each subsequent transmission until the target responds or the maximum TTL is
reached. The route is determined by examining the ICMP Time Exceeded messages sent back by
intermediate routers. Notice that some routers silently drop packets with expired TTLs and will be
invisible to tracert.
Syntax
tracert[-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name
Parameters
o -d: Specifies not to resolve addresses to host names.
o -h maximum_hops: Specifies maximum number of hops to search for target.
o -j host-list:Specifies loose source route along host-list.
o -w timeout :Waits the number of milliseconds specified by timeout for each reply.
o target_name:Name of the target host.
Commands Execution:
Conclusion: This experiment helps us to test different networking commands that helps us to know about
different network parameters.
Experiment No. 2
Theory:
NS is an event driven network simulator developed at UC Berkeley that simulates variety of IP
networks. It implements network protocols such as TCP and UPD, traffic source behavior such as FTP,
Telnet, Web, CBR and VBR, router queue management mechanism such as Drop Tail, RED and CBQ,
routing algorithms such as Dijkstra, and more. NS also implements multicasting and some of the MAC layer
protocols for LAN simulations. The NS project is now a part of the VINT project that develops tools for
simulation results display, analysis and converters that convert network topologies generated by well-known
generators to NS formats. Currently, NS (version 2) written in C++ and OTcl (Tcl script language with
Object-oriented extensions developed at MIT) is available.
As shown in Figure 1, in a simplified user's view, NS is Object-oriented Tcl (OTcl) script interpreter that
has a simulation event scheduler and network component object libraries, and network setup (plumbing)
module libraries (actually, plumbing modules are implemented as member functions of the base simulator
object). In other words, to use NS, you program in OTcl script language. To setup and run a simulation
network, a user should write an OTcl script that initiates an event scheduler, sets up the network topology
using the network objects and the plumbing functions in the library, and tells traffic sources when to start
and stop transmitting packets through the event scheduler. The term "plumbing" is used for a network setup,
because setting up a network is plumbing possible data paths among network objects by setting the
"neighbor" pointer of an object to the address of an appropriate object. When a user wants to make a new
network object, he or she can easily make an object either by writing a new object or by making a
compound object from the object library, and plumb the data path through the object.
Another major component of NS beside network objects is the event scheduler. An event in NS is a packet
ID that is unique for a packet with scheduled time and the pointer to an object that handles the event. In NS,
an event scheduler keeps track of simulation time and fires allthe events in the event queue scheduled for the
current time by invoking appropriate network components, which usually are the ones who issued the
events, and let them do the appropriate action associated with packet pointed by the event.
Network components communicate with one another passing packets;however, this does not consume actual
simulation time. All the network components that need to spend some simulation time handling a packet
(i.e. need a delay) use the event scheduler by issuing an event for the packet and waiting for the event to be
fired to itself before doing further action handling the packet. For example, a network switch component
that simulates a switch with 20 microseconds of switching delay issues an event for a packet to be switched
to the scheduler as an event 20 microsecond later. The scheduler after 20 microsecond dequeues the event
and fires it to the switch component, which then passes the packet to an appropriate output link component.
Another use of an event scheduler is timer. For example, TCP needs a timer to keep track of a packet
transmission time out for retransmission (transmission of a packet with the same TCP packet number but
different NS packet ID). Timers use event schedulers in a similar manner that delay does. The only
difference is that timer measures a time value associated with a packet and does an appropriate action
related to that packet after a certain time goes by, and does not simulate a delay.
NS is written not only in OTcl but in C++ also. For efficiency reason, NS separates the data path
implementation from control path implementations. In order to reduce packet and event processing time (not
simulation time), the event scheduler and the basic network component objects in the data path are written
and compiled using C++. These compiled objects are made available to the OTcl interpreter through an
OTcl linkage that creates a matching OTcl object for each of the C++ objects and makes the control
functions and the configurable variables specified by the C++ object act as member functions and member
variables of the corresponding OTcl object. In this way, the controls of the C++ objects are given to OTcl. It
is also possible to add member functions and variables to a C++ linked OTcl object. The objects in C++ that
do not need to be controlled in a simulation or internally used by another object do not need to be linked to
OTcl. Likewise, an object (not in the data path) can be entirely implemented in OTcl. Figure 2 shows an
object hierarchy example in C++ and OTcl. One thing to note in the figure is that for C++ objects that have
an OTcl linkage forming a hierarchy, there is a matching OTcl object hierarchy very similar to that of C++.
Figure 3 shows the general architecture of NS. In this figure a general user (not an NS developer) can be
thought of standing at the left bottom corner, designing and running simulations in Tcl using the simulator
objects in the OTcl library. The event schedulers and most of the network components are implemented in
C++ and available to OTcl through an OTcl linkage that is implemented using tclcl. The whole thing
together makes NS, which is a OO extended Tcl interpreter with network simulator libraries.
As shown in Figure 1, when a simulation is finished, NS produces one or more text-based output files that
contain detailed simulation data, if specified to do so in the input Tcl (or more specifically, OTcl) script.
The data can be used for simulation analysis or as an input to a graphical simulation display tool called
Network Animator (NAM). NAM has a nice graphical user interface similar to that of a CD player (play,
fast forward, rewind, pause and so on), and also has a display speed controller. Furthermore, it can
graphically present information such as throughput and number of packet drops at each link, although the
graphical information cannot be used for accurate simulation analysis.
Step 3: Double click [Link] and install it. The default install directory isC:/Program Files/Tcl.
Step 4: Copy [Link] & [Link] from the extracted folder and paste it intoC:/Program Files/Tcl/bin
directory.
Step 5: (Optional) Add the path C:/Program Files/Tcl/bin to the environmentvariable PATH. This will
allow you to execute NS from anywhere.
NS2 Installation in Linux (Ubuntu):
Step 1: Open the Terminal from the Programs Menu / Press Ctrl + Alt +T Step 2: Update your repository
by running the following command
Step 6: Install NS2 NAM & XGRAPH using the below command
Conclusion:Thus, we have installed and configured NS2 on Windows and Linux (Ubuntu).
Experiment No. 3
Aim: To simulate and analyze the effect of varying number of nodes and physical layer parameters using
Network Simulator 2 (NS2).
Apparatus / Requirements:
Software:
o Network Simulator 2 (NS2)
o TCL scripting language
Hardware:
o Computer system (Linux/Ubuntu preferred)
Basic knowledge of:
o Networking concepts
o Wireless communication
o TCL scripting
Theory:
Network Simulator 2 (NS2) is a discrete event simulator widely used for research in networking. It supports
simulation of wired and wireless networks, including physical (PHY) layer configurations.
Key Concepts:
1. Number of Nodes
Nodes represent devices in a network.
Increasing the number of nodes affects:
o Network congestion
o Packet delivery ratio
o Delay and throughput
Procedure:
Step 1: Initialize Simulator
Create a new NS2 TCL script file.
set ns [new Simulator]
Conclusion:
NS2 effectively simulates wireless networks with configurable node count and physical layer
settings.
The number of nodes significantly impacts network performance.
Proper physical layer configuration improves communication reliability and efficiency.
This experiment helps in understanding real-world wireless network behavior.
Experiment No. 4
Aim: To configure and verify static routing between multiple networks using Cisco Packet Tracer.
Apparatus / Requirements:
Software:
o Cisco Packet Tracer
Hardware (virtual):
o Routers (e.g., 2 or 3 routers)
o PCs (end devices)
o Ethernet cables
Basic knowledge of:
o IP addressing
o Routing concepts
Theory:
Routing is the process of forwarding packets from one network to another.
Static Routing:
Static routing is a manual method where routes are configured by the network administrator.
Unlike dynamic routing, it does not automatically update routes.
Key Features
Simple to configure for small networks
No routing protocol overhead
More secure (no route advertisements)
Not scalable for large networks
Static Route Syntax
ip route [destination_network] [subnet_mask] [next_hop_ip]
Example
ip route [Link] [Link] [Link]
Procedure:
Step 1: Create Network Topology
PC2
IP: [Link]
Subnet Mask: [Link]
Gateway: [Link]
Router R1
enable
configure terminal
interface g0/0
ip address [Link] [Link]
no shutdown
interface g0/1
ip address [Link] [Link]
no shutdown
Router R2
enable
configure terminal
interface g0/0
ip address [Link] [Link]
no shutdown
interface g0/1
ip address [Link] [Link]
no shutdown
On Router R1
ip route [Link] [Link] [Link]
On Router R2
ip route [Link] [Link] [Link]
Conclusion:
Static routing is simple and effective for small networks.
It provides full control over routing decisions.
However, it is not suitable for large or dynamic networks due to manual configuration requirements.
Experiment No. 5
Aim: To simulate and analyze the performance of the Sliding Window Protocol using Network Simulator 2
(NS2).
Apparatus / Requirements:
Software:
o Network Simulator 2 (NS2)
Programming:
o TCL scripting language
Hardware:
o Computer system (Linux/Ubuntu preferred)
Basic knowledge of:
o Data communication
o Flow control protocols
Theory:
The Sliding Window Protocol is a flow control mechanism used in data transmission to ensure efficient
and reliable delivery of packets.
Key Concepts:
1. Sliding Window
3. Working Principle
proc finish {} {
global ns
$ns halt
}
Step 8: Run Simulation
$ns run
Result:
The simulation successfully demonstrates sliding window behavior using TCP.
Multiple packets are transmitted before receiving acknowledgments.
Efficient data transfer compared to Stop-and-Wait is observed.
Conclusion:
Sliding Window Protocol improves network efficiency by allowing continuous transmission.
NS2 simulates this behavior using TCP mechanisms.
Aim: To perform subnetting and supernetting and implement them using Cisco Packet Tracer.
Apparatus / Requirements:
Software:
o Cisco Packet Tracer
Hardware (virtual):
o Routers
o Switches
o PCs
Basic knowledge of:
o IP addressing
o Subnet masks
o Routing
Theory:
1. Sub netting: Sub netting is the process of dividing a large network into smaller sub-networks
(subnets).
Advantages:
Efficient IP address utilization
Improved network performance
Enhanced security and management
Example:
Network: [Link]/24
Subnet into 4 subnets:
Subnet Network Address Range Broadcast
1 [Link]/26 .1 – .62 .63
2 [Link]/26 .65 – .126 .127
3 [Link]/26 .129 – .190 .191
4 [Link]/26 .193 – .254 .255
2. Super netting: Super netting (route summarization) is the process of combining multiple networks
into a single larger network.
Advantages:
Reduces routing table size
Improves routing efficiency
Example:
Combine:
[Link]/24
[Link]/24
Supernet: [Link]/23
Procedure:
Part A: Sub netting
Step 1: Design Topology
Open Cisco Packet Tracer
Add:
o 1 Router
o 2–4 PCs
o 1 Switch
Step 2: Assign Subnet IPs
Example:
Subnet 1:
o PC1: [Link] /26
o Gateway: [Link]
Subnet 2:
o PC2: [Link] /26
o Gateway: [Link]
interface g0/0
ip address [Link] [Link]
no shutdown
interface g0/1
ip address [Link] [Link]
no shutdown
Step 4: Verify
showip route
Result:
Subnetting successfully divided a network into smaller segments.
Supernetting successfully combined multiple networks into a single route.
Communication between networks was achieved efficiently.
Conclusion:
Subnetting improves network management and reduces congestion.
Supernetting simplifies routing by reducing routing table entries.
Both techniques are essential for efficient IP address management in real-world networks.
Experiment No. 7
Aim: To study and implement socket programming using the TCP protocol for reliable communication
between client and server.
Apparatus / Requirements:
Software:
o C / C++ / Python (any programming language supporting sockets)
Tools:
o Compiler (GCC / Python interpreter)
Hardware:
o Computer system (Linux/Windows)
Basic knowledge of:
o Computer networks
o TCP/IP model
Theory:
Socket Programming
Socket programming enables communication between two devices over a network using endpoints called
sockets.
Function Description
socket() Create socket
bind() Assign IP & port
listen() Wait for connection
accept() Accept client
connect() Connect to server
send() / recv() Data transfer
close() Close socket
Procedure:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include <unistd.h>
intmain() {
intserver_fd, client_socket;
structsockaddr_inaddress;
intaddrlen=sizeof(address);
charbuffer[1024] = {0};
address.sin_family=AF_INET;
address.sin_addr.s_addr=INADDR_ANY;
address.sin_port=htons(8080);
close(client_socket);
close(server_fd);
return0;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include <unistd.h>
intmain() {
intsock=0;
structsockaddr_inserv_addr;
char*message="Hello from client";
charbuffer[1024] = {0};
serv_addr.sin_family=AF_INET;
serv_addr.sin_port=htons(8080);
close(sock);
return0;
}
Step 3: Compile Programs
gccserver.c-o server
gccclient.c-o client
Apparatus / Requirements:
Software:
o C / C++ / Python
Tools:
o GCC Compiler / Python Interpreter
Hardware:
o Computer system (Linux/Windows)
Basic knowledge of:
o Computer networks
o TCP/IP model
Theory:
Socket Programming
Socket programming allows two systems to communicate over a network using endpoints called sockets.
Features of UDP
Procedure:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include <unistd.h>
intmain() {
intsockfd;
charbuffer[1024];
structsockaddr_inserver_addr, client_addr;
socklen_tlen=sizeof(client_addr);
server_addr.sin_family=AF_INET;
server_addr.sin_port=htons(PORT);
server_addr.sin_addr.s_addr=INADDR_ANY;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include <unistd.h>
intmain() {
intsockfd;
char*message="Hello from client";
charbuffer[1024];
structsockaddr_inserver_addr;
server_addr.sin_family=AF_INET;
server_addr.sin_port=htons(PORT);
inet_pton(AF_INET, "[Link]", &server_addr.sin_addr);
close(sockfd);
return0;
}
gccudp_server.c-oudp_server
gccudp_client.c-oudp_client
./udp_server
./udp_client
Result:
Conclusion:
Aim: To simulate and analyze the TCP/IP stack using a network protocol analyzer and study the network
traffic.
Apparatus / Requirements:
Software:
o Wireshark (or similar network protocol analyzer)
Hardware:
o Computer system with internet connectivity
Basic knowledge of:
o TCP/IP model
o Networking protocols
Theory:
TCP/IP Stack
The TCP/IP model consists of four layers:
1. Application Layer – HTTP, FTP, DNS
2. Transport Layer – TCP, UDP
3. Internet Layer – IP
4. Network Access Layer – Ethernet
UDP: udp
DNS: dns
HTTP: http
Aim: To design a scalable and efficient network for an organization using IP addressing, DNS (naming),
and routing concepts.
Apparatus / Requirements:
Theory:
1. IP Addressing (Addressing)
Each device in a network must have a unique IP address.
IP addressing can be:
o Static
o Dynamic (using DHCP)
Example:
Network: [Link]/24
Subnets created for departments
2. Naming (DNS – Domain Name System)
3. Routing
Routing determines the path for data to travel between networks.
Types:
o Static routing
o Dynamic routing (e.g., RIP, OSPF)
Network Design Overview
IP Addressing Scheme
Department Network Subnet Mask Hosts
HR [Link]/26 [Link] 62
Finance [Link]/26 [Link] 62
IT [Link]/26 [Link] 62
Servers [Link]/26 [Link] 62
DNS Configuration
DNS Server IP: [Link]
[Link] [Link]
[Link] [Link]
[Link] [Link]
Routing Design
Use a central router to connect all subnets
Configure routing between subnets
Example (Static Routing)
ip route [Link] [Link] <next-hop>
ip route [Link] [Link] <next-hop>
(Or use dynamic routing like RIP/OSPF for scalability)
Network Topology (Conceptual)
[ Router ]
HR Finance IT
| | |
PCs PCs PCs
\
[ Switch ]
|
[ DNS Server ]
Procedure:
Use:
o ping
o nslookup
Conclusion: