Lab Manual CNT 2019 20
Lab Manual CNT 2019 20
Lab Manual CNT 2019 20
LABORATORY MANUAL
SOFTWARE LABORATORY-IV
2015 course
Problem analysis: Identify, formulate, review research literature, and analyze complex engineering
PO2 problems reaching substantiated conclusions using first principles of mathematics, natural sciences,
and engineering sciences.
Design/development of solutions: Design solutions for complex engineering problems and design
PO3 system components or processes that meet the specified needs with appropriate consideration for the
public health and safety, and the cultural, societal, and environmental considerations.
Conduct investigations of complex problems: Use research-based knowledge and research methods
PO4 including design of experiments, analysis and interpretation of data, and synthesis of the information to
provide valid conclusions.
Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
PO5 engineering and IT tools including prediction and modeling to complex engineering activities with an
understanding of the limitations.
The engineer and society: Apply reasoning informed by the contextual knowledge to assess societal,
PO6 health, safety, legal and cultural issues and the consequent responsibilities relevant to the professional
engineering practice.
Environment and sustainability: Understand the impact of the professional engineering solutions in
PO7 societal and environmental contexts, and demonstrate the knowledge of, and need for sustainable
development.
Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of
PO8
the engineering practice.
Individual and team work: Function effectively as an individual, and as a member or leader in
PO9
diverse teams, and in multidisciplinary settings.
Communication: Communicate effectively on complex engineering activities with the engineering
PO10 community and with society at large, such as, being able to comprehend and write effective reports and
design documentation, make effective presentations, and give and receive clear instructions.
Project management and finance: Demonstrate knowledge and understanding of the engineering and
PO11 management principles and apply these to one’s own work, as a member and leader in a team, to
manage projects and in multidisciplinary environments.
Life-long learning: Recognize the need for, and have the preparation and ability to engage in
PO12
independent and life-long learning in the broadest context of technological change.
Course Outcomes
Course Statement
Outcome
On completion of this course the student should be able to
314450.1 Understand responsibilities, services offered, protocol used at network layer, understand
different addressing techniques,networking commands and implement a small size network
314450.2 Understand responsibilities, services offered, protocol used at transport layer and use
networking and simulation tools and explore protocol design
314450.3 Understand and explore the different protocols at application layer and configure client
server environment to use application layer protocols.
314450.4 Understand the different wireless technologies and IEEE standards.
314450.5 Understand, explore and implement adhoc networks and study network & transport layer
protocols for wireless network
314450.6 Understand, explore and implement applications on recent trends in network domain.
1. Explore and Study of TCP/IP utilities and Network Commands PO1,PO2,PO3, PSO1,
on Linux. Ping, Tracert/Traceroute/Tracepath, ipconfig / ifconfig, PO4,PO5,PO12 PSO2
NSlookup, Hostname,Arp, Whois,Finger, Netstat, Port Scan /
nmap, Route
8. Using any open source Network Simulator, Implement MANET / PO1,PO2,PO3, PSO1,
Wireless Sensor Network PO4,PO5,PO12 PSO2
11. To learn the wireless communication between the sensor nodes. PO1,PO2,PO3, PSO1,
PO4,PO5,PO12 PSO2
Assignment No. 1
Aim: Explore and Study of TCP/IP utilities and Network Commands on Linux.
Ping, Tracert/Traceroute/Tracepath, ipconfig / ifconfig, NSlookup, Hostname,Arp, Whois, Finger,
Netstat, Port Scan / nmap, Route
CO1. To know responsibilities, services offered, protocol used at network network layer, understand
different addressing techniques,networking commands and implement a small size network
Theory:
Ifconfig is used to configure the kernel-resident network interfaces. It is used at boot time to
set up interfaces as necessary. After that, it is usually only needed when debugging or when
system tuning is needed. If no arguments are given, ifconfig displays the status of the currently
active interfaces. If a single interface argument is given, it displays the status of the given interface only;
if a single -a argment is given, it displays the status of all interfaces, even those that are down.
Otherwise, it configures an interface.
OPTIONS
-a display all interfaces which are currently available, even if down
To view the configuration of a specific interface, specify its name as an option. For instance,
ifconfig eth0
When a network interface is active, it can send and receive data; when it is inactive, it is not able to transmit
or receive. You can use ifconfig to change the status of a network interface from inactive to active, or
vice-versa.
Enabling or disabling a device requires superuser permissions, so you will either have to be logged in as
root, or prefix your command with sudo to run it with superuser privileges.
Configuring An Interface
ifconfig can be used at the command line to configure (or re-configure) a network interface. This is often
unnecessary, since this configuration is typically handled by a script when you boot the system. If you'd like
to do so manually, you will need superuser privileges, so we'll use sudo again when running these
commands.
To assign a static IP address to an interface, specify the interface name and the IP address. For example, to
assign the IP address 69.72.169.1 to the interface wlan0, use the command:
To assign a network mask to an interface, use the keyword netmask and the netmask address. For instance,
to configure the interface eth1 to use a network mask of 255.255.255.0, the command would be:
To assign a broadcast address to an interface, use the keyword broadcast and the broadcast address. For
instance, to configure the interface wlan1 to use a broadcast address of 172.16.25.98, the command would
be:
These configurations can combined in a single command. For instance, to configure interface eth0 to use the
static IP address 192.168.2.5, the network mask 255.255.255.0, and the broadcast address 192.168.2.7, the
command would be:
2. Ping
Verifies IP-level connectivity to another TCP/IP computer by sending Internet Control Message Protocol
(ICMP) Echo Request messages. The receipt of corresponding Echo Reply messages are displayed, along
with round-trip times.
OPTIONS
3. Whois - whois searches for an object in a WHOIS database. WHOIS is a query and response protocol
that is widely used for querying databases that store the registered users of an Internet resource, such as a
domain name or an IP address block, but is also used for a wider range of other information.Most modern
versions of whois try to guess the right server to ask for the specified object. If no guess can be made, whois
will connect to whois.networksolutions.com for NIC handles or whois.arin.net for IPv4 addresses and
network names.
OPTIONS
-h HOST Connect to WHOIS database host HOST.
-H Suppress the display of legal disclaimers.
-p PORT When connecting, connect to network port PORT.
--verbose Operate verbosely.
--help Display a help message, and exit.
DESCRIPTION
The finger displays information about the system users.
OPTIONS
-l Produces a multi-line format displaying all of the information described for the -s option as
well as the user's home directory,home phone number, login shell, mail status, and the contents of the files
“.plan”, “.project”, “.pgpkey” and “.forward” from the user's home directory.
-p Prevents the -l option of finger from displaying the contents of the “.plan”, “.project” and
“.pgpkey” files.
-m Prevent matching of user names. User is usually a login name; however, matching will also
be done on the users' real names,unless the -m option is supplied. All name matching performed by finger
is case insensitive.
DESCRIPTION
traceroute tracks the route packets taken from an IP network on their way to a given host. It
utilizes the IP protocol's time to live (TTL) field and attempts to elicit an ICMP TIME_EXCEEDED
response from each gateway along the path to the host.
This program attempts to trace the route an IP packet would follow to some internet host by
launching probe packets with a small ttl (time to live) then listening for an ICMP "time exceeded" reply
from a gateway. We start our probes with a ttl of one and increase by one until we get an ICMP
"port unreachable" (or TCP reset), which means we got to the "host", or hit a max (which defaults to 30
hops). Three probes (by default) are sent at each ttl setting and a line is printed showing the ttl, address
of the gateway and round trip time of each probe. The address can be followed by additional
information when requested. If the probe answers come from different gateways, the address of each
responding system will be printed. If there is no response within a 5.0 seconds (default), an "*" (asterisk)
is printed for that probe.
6. nslookup - command is used to query Internet name servers interactively for information.
nslookup, which stands for "name server lookup", is a useful tool for finding out information about a named
domain.By default, nslookup will translate a domain name to an IP address (or vice versa). For instance, to
find out what the IP address of microsoft.com is, you could run the command:
nslookup microsoft.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Here, 8.8.8.8 is the address of our system's Domain Name Server. This is the server our system is onfigured
to use to translate domain names into IP addresses. "#53" indicates that we are communicating with it on
port 53, which is the standard port number domain name servers use to accept queries.
We can also perform the above operation in reverse by providing the IP address rather than the domain
name. For instance, the command:
nslookup 134.170.185.46
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
46.185.170.134.in-addr.arpa name = grv.microsoft.com.
7. hostname - command shows or sets the system hostname.hostname is used to display the system's
DNS name, and to display or set its hostname or NIS (Network Information Services) domain name. When
called without any arguments, hostname will display the name of the system as returned by the
gethostname function. When called with one argument or with the --file option, hostname will set the
system's host name using the sethostname function. Only the superuser can set the host name. The host
name is usually set once at system startup in the script /etc/init.d/hostname.sh normally by reading the
contents of a file which contains the host name, e.g., /etc/hostname.
8. Arp - manipulates or displays the kernel's IPv4 network neighbour cache. It can add entries to the table,
delete one, or display the current content.ARP stands for Address Resolution Protocol, which is used to
find the address of a network neighbor for a given IPv4 address.
MODES
arp with no mode specifier will print the current content of the table. It is possible to limit the
number of entries printed, by specifying an hardware address type, interface name or host address.
arp -d address will delete a ARP table entry. Root or netadmin priveledge is required to do this. The
entry is found by IP address.If a hostname is given, it will be resolved before looking up the entry in the
ARP table.
arp -s address hw_addr is used to set up a new table entry. The format of the hw_addr parameter
is dependent on the hardware class, but for most classes one can assume that the usual presentation can be
used. For the Ethernet class, this is 6 bytes in hexadecimal, separated by colons. When adding proxy
arp entries (that is those with the publish flag set a netmask may be specified to proxy arp for entire subnets.
This is not good practice, but is supported by older kernels because it can be useful. If the temp flag is
9. Netstat - command is used to print network connections, routing tables, interface statistics, masquerade
connections, and multicast memberships.netstat ("network statistics") is a command-line tool that displays
network connections (both incoming and outgoing), routing tables, and a number of network interface
(network interface controller or software-defined network interface) and network protocol statistics.
It is used for finding problems in the network and to determine the amount of traffic on the network as a
performance measurement.
10. nmap - It is a network exploration tool and security / port scanner.nmap ("Network Mapper") is an
open source tool for network exploration and security auditing. It was designed to rapidly scan large
networks, although it works fine to scan single hosts. nmap uses raw IP packets in novel ways to determine
what hosts are available on the network, what services (application name and version) those hosts are
offering, what operating systems (and OS versions) they are running, what type of packet filters/firewalls
are in use, and dozens of other characteristics.
Conclusion:
In this way, we studied Studied TCP/IP utilities and Network Commands on Linux
FAQ
Q1. Explain ICMP request reply protocol using in PING command.
Q2. How nslookup makes use of name server?\
Q3. Why is arp protocol required ?
Q4. Explain IP header.
Assignment No. 2
Title of Assignment:
Objectives: To design and implement small size network by sunetting and supernetting
Course Outcome :
CO1: To know responsibilities, services offered, protocol used at network network layer, understand
different addressing techniques, networking commands and implement a small size network
Theory:
Network ID
First address of subnet is called network ID. This address is used to identify one segment or broadcast
domain from all the other segments in the network.
Block Size
Block size is the size of subnet including network address, hosts addresses and broadcast address.
Broadcast ID
There are two types of broadcast, direct broadcast and full broadcast.
Direct broadcast or local broadcast is the last address of subnet and can be hear by all hosts in subnet.
Full broadcast is the last address of IP classes and can be hear by all IP hosts in network. Full broadcast
address is 255.255.255.255
The main difference between direct broadcast and full broadcast is that routers will not propagate local
broadcasts between segments, but they will propagate directed broadcasts.
Host Addresses
All address between the network address and the directed broadcast address is called host address for the
subnet. You can assign host addresses to any IP devices such as PCs, servers, routers, and switches.
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.
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 204.17.5.0 which has a
natural mask of 255.255.255.0, you can create subnets in this manner:
204.17.5.0 - 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 . So,
with this in mind, these subnets have been created.
Supernetting is the opposite of Subnetting. In subnetting, a single big network is divided into multiple
smaller subnetworks. In Supernetting, multiple networks are combined into a bigger network termed as a
Supernetwork or Supernet.
Supernetting is mainly used in Route Summarization, where routes to multiple networks with similar
network prefixes are combined into a single routing entry, with the routing entry pointing to a Super
network, encompassing all the networks. This in turn significantly reduces the size of routing tables and also
the size of routing updates exchanged by routing protocols.
FAQ:
Q1.State IPv4 classful addresses scheme, no. of blocks in each class,no. of host that can be connected in
each block and default mask for each class.
Assignment No. 3
Title of Assignment:
Using a Network Simulator (e.g. packet tracer) Configure a router using router commands, Access Control
lists – Standard & Extended
CO1: To know responsibilities, services offered, protocol used at network network layer, understand
different addressing techniques,networking commands and implement a small size network
Theory:
Introduction to access list:
An access list is essentially a list of condition . Packets can be very useful when u need to
do exercise control over network traffic . An access list would be your tool of choice for design making in
these situation .One of the most common and easiest way to to understand uses of lists is filtering
unwanted packet when implementing security policy.
A Standard Access List only allows you to permit or deny traffic from specific IP addresses. The destination
of the packet and the ports involved do not matter.
Here is an example:
This list allows traffic from all addresses in the range 192.168.3.0 to 192.168.3.255
Extended ACLs allow you to permit or deny traffic from specific IP addresses to a specific destination IP
address and port. It also allows you to specify different types of traffic such as ICMP, TCP, UDP, etc.
Needless to say, it is very grangular and allows you to be very specific. If you intend to create a packet
filtering firewall to protect your network it is an Extended ACL that you will need to create.
Typically you would allow outgoing traffic and incoming initiated traffic. In other words, you want your
users to be able to connect to web servers on the internet for browsing but you do not want anyone on the
Internet to be able to connect to your machines. This will require 2 ACLs. One to only limit our users on the
company network to only use a web browser (so this will block outgoing FTP, e-mail, Kazaa, napster,
online gaming, etc.) The other access-list will only allow incoming traffic from the Internet that has been
initiated from a machine on the inside. This is called an established connection. Let's see what our access
list would look like for starters:
Assumptions:
internal network: 63.36.9.0
ACL 101
access-list 101 permit tcp 63.36.9.0 0.0.0.255 any eq 80
ACL 102
access-list 102 permit tcp any 63.36.9.0 0.0.0.255 established
The system clock runs from the moment the system starts up and keeps track of the current date and time
based on Coordinated Universal Time (UTC), also known as Greenwich Mean Time (GMT). The system
In the following example, the system clock is manually set to 1:32 p.m. on May 12, 2001:
Router# clock set 13:32:00 12 May 2001
Show System Time
To display the system clock, use the show clock EXEC command. If time has not been set by the clock set
command then this command will show the time lapsed since router is up.
Router# show clock
Setting the Banner
To specify a message-of-the-day (MOTD) banner, use the banner motd global configuration command. The
no form of this command deletes the MOTD banner. When someone connects to the router, the MOTD
banner appears before the login prompt.
Router(config)# banner motd # message #
Here (#) sign is used as delaminating character. You can use any character.
Setting the Description for an Interface
To add a description to an interface configuration, use the description interface configuration command. Use
the no form of this command to remove the description.
The description command is meant solely as a comment to be put in the configuration to help you remember
what certain interfaces are used for.
The following example shows how to add a description for a T1 interface:
Router(config)# interface serial 0
Router(config-if)# description T1 line to How2Pass - 128 Kb/s
The description "T1 line to How2Pass - 128 Kb/s" appears in the output of the following EXEC commands: show
startup-config, show interfaces, and show running-config
Setting the Line Password
To specify a password on a line, use the password line configuration command. Use the no form of this
command to remove the password. The first character cannot be a number. The string can contain any
alphanumeric characters, including spaces, up to 80 characters.
Console Password
Console password is needed when logging into router at user EXEC mode from console.
Virtual terminal lines (vty) are used to allow remote access to the router (by telneting through its interfaces).
The router has five virtual terminal lines by default.
Router(config)# line vty 0 4
Router(config-line)# password How2Pass2004
To set a local password to control access to various privilege levels, use the enable password global
configuration command. Use the no form of this command to remove the password requirement.
An enable password is defined as follows:
Must contain from 1 to 25 uppercase and lowercase alphanumeric characters.
Must not have a number as the first character.
Can have leading spaces, but they are ignored. However, intermediate and trailing spaces are recognized.
Router(config)# enable password How2Pass2004
Setting Secret (Encrypted) Password
To set an encrypted local password to control access to various privilege levels, use the enable secret global
configuration command. Use the no form of this command to remove the password requirement.
Router(config)# enable secret How2pass2004
Conclusion:
Hence we have successfully studied router configuration with standard and extended access list.
FAQ:
1. Differentiate between router and a switch?
2. How do router route packets?
3. What is a firewall, proxy server ?
Assignment No. 4
Aim: Using a Network Simulator (e.g. packet tracer) Configure EIGRP – Explore Neighbor-ship Requirements and
Conditions, its K Values Metrics Assignment and Calculation, RIPv2 and EIGRP on same network. WLAN with
static IP addressing and DHCP with MAC security and filters
Theory:
The Routing Information Protocol (RIP) is one of the oldest distance-vector routing protocols which employ
the hop count as a routing metric. RIP prevents routing loops by implementing a limit on the number of
hops allowed in a path from source to destination. The largest number of hops allowed for RIP is 15, which
limits the size of networks that RIP can support.RIP implements the split horizon, route poisoning and
holddown mechanisms to prevent incorrect routing information from being propagated.In RIPv1 router
broadcast updates with their routing table every 30 seconds. In the early deployments, routing tables were
small enough that the traffic was not significant. As networks grew in size, however, it became evident there
could be a massive traffic burst every 30 seconds, even if the routers had been initialized at random times.
In most networking environments, RIP is not the preferred choice for routing as its time to converge and
scalability are poor compared to EIGRP, OSPF.RIP uses the User Datagram Protocol (UDP) as its transport
protocol, and is assigned the reserved port number 520
2) In RIPv1, subnet masks are NOT included in the routing update and In RIPv2 Subnet masks are included
in the routing update.
3) RIPv2 multicasts the entire routing table to all adjacent routers at the address 224.0.0.9, as opposed to
RIPv1 which uses broadcast (255.255.255.255). Unicast addressing is still allowed for special applications.
EIGRP is hybrid protocol, it has advantages of both link state and distance vector protocol. It uses
composite metric calculation formula to select the best route for destination. It sends partial or full update
only when something is change in network. It maintains three tables for ultra-fast convergence.
Neighbor Table: EIGRP shares routing information only with neighbors. To know who the neighbors
are, it uses neighbor table. When a new neighbor is discovered, EIGRP would add its address and interface
on which neighbor is connected in neighbor table. EIGRP uses separate neighbor table for each routed
protocol.
Topology Table: EIGRP uses this table to store all routes which it learned from neighbors. It contains a
list of all destinations and routes advertised by neighboring routers. EIGRP selects single best route for each
destination from this list. That route goes in routing table. Remaining routes are marked as backup routes.
EIGRP refers selected route as Successor and backup route as Feasible Successor. EIGRP uses separate
topology table for each routed protocol.
Routing Table: EIGRP stores single best (Successor) route for each destination in this table. Router uses
this table to forward the packet. There is a separate routing table for each routed protocol.
EIGRP may use five metric components to select the best route for routing table. These are Bandwidth,
Load, Delay, Reliability and MTU. By default EIGRP uses only two components; Bandwidth and delay.
With K-Values we can control which components should be used in route metric calculation. For five metric
components we have five K values.
FAQs:
Q1. How does RIP work?
Q2. State working of EIGRP?
Q3. What is DHCP?
Q4. What id WLAN?
Assignment No. 5
Aim: Using a Network Simulator (e.g. packet tracer) Configure VLAN, Dynamic trunk protocol and
spanning tree protocol OSPF – Explore Neighbor-ship Condition and Requirement, Neighbor-ship states,
OSPF Metric Cost Calculation. Network Address Translation : Static, Dynamic & PAT (Port Address
Translation)
CO1:To know responsibilities, services offered, protocol used at network network layer, understand
different addressing techniques,networking commands and implement a small size network
Theory:
A VLAN is a group of devices on one or more LANs that are configured to communicate as if they were
attached to the same wire, when in fact they are located on a number of different LAN segments. Because
VLANs are based on logical instead of physical connections, they are extremely flexible.
VLANs define broadcast domains in a Layer 2 network. A broadcast domain is the set of all devices that
will receive broadcast frames originating from any device within the set. Broadcast domains are typically
bounded by routers because routers do not forward broadcast frames. Layer 2 switches create broadcast
domains based on the configuration of the switch. Switches are multiport bridges that allow you to create
multiple broadcast domains. Each broadcast domain is like a distinct virtual bridge within a switch.
VLAN Membership
VLAN membership can be assigned to a device by one of two methods. These methods decide how a switch
will associate its ports with VLANs.
Static :Assigning VLANs statically is the most common and secure method. It is pretty easy to set up and
supervise. In this method we manually assign VLAN to switch port. VLANs configured in this way are
usually known as port-based VLANs.
Dynamic: In dynamic method, VLANs are assigned to port automatically depending on the connected
device. In this method we have configure one switch from network as a server. Server contains device
specific information like MAC address, IP address etc. This information is mapped with VLAN. Switch
acting as server is known as VMPS (VLAN Membership Policy Server). Only high end switch can
configured as VMPS. Low end switch works as client and retrieve VLAN information from VMPS.
Dynamic VLANs supports plug and play movability. For example if we move a PC from one port to another
port, new switch port will automatically be configured to the VLAN which the user belongs. In static
method we have to do this process manually.
VLAN Connections
Access link:Access link connection is the connection where switch port is connected with a device that has
a standardized Ethernet NIC. Standard NIC only understand IEEE 802.3 or Ethernet II frames. Access link
connection can only be assigned with single VLAN. That means all devices connected to this port will be in
same broadcast domain.For example twenty users are connected to a hub, and we connect that hub with an
access link port on switch, then all of these users belong to same VLAN. If we want to keep ten users in
another VLAN, then we have to purchase another hub. We need to plug in those ten users in that hub and
then connect it with another access link port on switch.
Trunk link:Trunk link connection is the connection where switch port is connected with a device that is
capable to understand multiple VLANs. Usually trunk link connection is used to connect two switches or
switch to router. Remember earlier in this article I said that VLAN can span anywhere in network, that is
happen due to trunk link connection. Trunking allows us to send or receive VLAN information across the
network. To support trunking, original Ethernet frame is modified to carry VLAN information.
Trunk Tagging: In trunking a separate logical connection is created for each VLAN instead of a single
physical connection. In tagging switch adds the source port’s VLAN identifier to the frame so that other end
device can understands what VLAN originated this frame. Based on this information destination switch can
make intelligent forwarding decisions on not just the destination MAC address, but also the source VLAN
identifier.Since original Ethernet frame is modified to add information, standard NICs will not understand
this information and will typically drop the frame. Therefore, we need to ensure that when we set up a trunk
connection on a switch’s port, the device at the other end also supports the same trunking protocol and has it
configured. If the device at the other end doesn’t understand these modified frames it will drop them. The
modification of these frames, commonly called tagging. Tagging is done in hardware by application-specific
integrated circuits (ASICs).
Spanning Tree Protocol (STP) is a Layer 2 protocol that runs on bridges and switches. The specification for
STP is IEEE 802.1D. The main purpose of STP is to ensure that you do not create loops when you have
redundant paths in your network. Loops are deadly to a network. STP runs on bridges and switches that are
802.1D-compliant. There are different flavors of STP, but 802.1D is the most popular and widely
implemented. You implement STP on bridges and switches in order to prevent loops in the network. Use
STP in situations where you want redundant links, but not loops. Redundant links are as important as
backups in the case of a failover in a network. A failure of your primary activates the backup links so that
Open Shortest Path First (OSPF) is a routing protocol for Internet Protocol (IP) networks. It uses a link state
routing (LSR) algorithm and falls into the group of interior gateway protocols (IGPs), operating within a
single autonomous system (AS).OSPF detects changes in the topology, such as link failures, and converges
on a new loop-free routing structure within seconds. It computes the shortest-path tree for each route using a
method based on Dijkstra's algorithm. The OSPF routing policies for constructing a route table are governed
by link metrics associated with each routing interface. Cost factors may be the distance of a router
(round-trip time), data throughput of a link, or link availability and reliability, expressed as simple unitless
numbers. This provides a dynamic process of traffic load balancing between routes of equal cost.
This command will enable OSPF routing protocol in router. Process ID is a positive integer. We can use any
number from 1 to 65,535. Process ID is locally significant. We can run multiple OSPF process on same
router. Process ID is used to differentiate between them. Process ID need not to match on all routers.
Network command allows us to specify the interfaces which we want to include in OSPF process. This
command accepts three arguments network number, wildcard mask and area number.
Logically a packet will face more overhead in crossing a 56Kbps serial link than crossing a 100Mbps
Ethernet link. Respectively it will take less time in crossing a higher bandwidth link than a lower bandwidth
link. OSPF uses this logic to calculate the cost. Cost is the inverse proportional of bandwidth. Higher
bandwidth has a lower cost. Lower bandwidth has a higher cost.
Reference bandwidth was defined as arbitrary value in OSPF documentation (RFC 2338). Vendors need to
use their own reference bandwidth. Cisco uses 100Mbps (108) bandwidth as reference bandwidth. With this
bandwidth, our equation would be
NAT
R1(config)#interface fastethernet0/0
R1(config-if)#ip nat inside
R1(config-if)#exit
R1(config)#interface fastethernet1/0
R1(config-if)#ip nat outside
R1(config-if)#exit
Configure static default route to forward all packets to any network to next hop 20.0.0.2 or exit interface.
R1(config)#ip route 0.0.0.0 0.0.0.0 20.0.0.2
(or)
R1(config)#ip route 0.0.0.0 0.0.0.0 fastethernet1/0
FAQ’s
Q1. State types of links in OSPF.
Q2. What are private and Public addresses?
Q3. State advantages of VLAN ?
Assignment No. 6
Aim:
Socket Programming in C/C++ on Linux. TCP Client , TCP Server UDP Client , UDP Server
Server accepts operation and floating point numbers from the clients; performs arithmetic
operations and sends the result back to client. Server application must handle at least five clients
simultaneously. Both the server and client should display input and output numbers as well as the
operation. The server and client processes should be run on different machines. During evaluation,
students will demonstrate via creating multiple client processes on different machines.
Objectives: To know the applications of network and use concepts for new
application development
Theory:
Sockets are used for interprocess communication.
Most of the interprocess communication follow a Client-Server
Model, where client and server are two separate processes in itself.
Server and Client exchange messages over the network through a common Socket API
Server Examples
• Web server (port 80)
• FTP server (20, 21)
• Telnet server (23)
• Mail server (25)
What is an API ?
API expands as Application Programming Interface.
A set of routines that an application uses to request and carry out lower-level services performed by
a computer's operating system.
What is a socket?
An interface between application and network which is used for communication between
processes
Once configured the application can
o pass data to the socket for network transmission
o receive data from the socket (transmitted through the network by some other host)
To the kernel, a socket is an endpoint of communication.
To an application, a socket is a file descriptor that lets the application read/write from/to the
network.
Clients and servers communicate with each by reading from and writing to socket
descriptors.
Remember: All Unix I/O devices, including networks, are modeled as files.
SOCK_DGRAM
UDP
no notion of “connection” – app indicates dest. for each packet
Socket Primitives
socket()
The function socket() creates an endpoint for communication and returns a file descriptor for the socket.
socket() takes three arguments:
domain, which specifies the protocol family of the created socket. For example:
o AF_INET for network protocol IPv4 or
o AF_INET6 for IPv6.
o AF_UNIX for local socket (using a file).
type, one of:
o SOCK_STREAM (reliable stream-oriented service or Stream Sockets)
o SOCK_DGRAM (datagram service or Datagram Sockets)
o SOCK_SEQPACKET (reliable sequenced packet service), or
o SOCK_RAW (raw protocols atop the network layer).
protocol specifying the actual transport protocol to use. The most common are IPPROTO_TCP,
IPPROTO_SCTP, IPPROTO_UDP, IPPROTO_DCCP. These protocols are specified in file
netinet/in.h. The value 0 may be used to select a default protocol from the selected domain and type.
The function returns -1 if an error occurred. Otherwise, it returns an integer representing the newly assigned
descriptor.
Prototype:
bind()
Prototype:
listen()
After a socket has been associated with an address, listen() prepares it for incoming connections. However,
this is only necessary for the stream-oriented (connection-oriented) data modes, i.e., for socket types
(SOCK_STREAM, SOCK_SEQPACKET). listen() requires two arguments:
Prototype:
accept()
When an application is listening for stream-oriented connections from other hosts, it is notified of such
events (cf. select() function) and must initialize the connection using the accept() function. The accept()
function creates a new socket for each connection and removes the connection from the listen queue. It takes
the following arguments:
sockfd, the descriptor of the listening socket that has the connection queued.
cliaddr, a pointer to a sockaddr structure to receive the client's address information.
addrlen, a pointer to a socklen_t location that specifies the size of the client address structure passed
to accept(). When accept() returns, this location indicates how many bytes of the structure were
actually used.
The accept() function returns the new socket descriptor for the accepted connection, or -1 if an error occurs.
All further communication with the remote host now occurs via this new socket.
Prototype:
connect()
The connect() system call connects a socket, identified by its file descriptor, to a remote host specified by
that host's address in the argument list.
Certain types of sockets are connectionless, most commonly user datagram protocol sockets. For these
sockets, connect takes on a special meaning: the default target for sending and receiving data gets set to the
given address, allowing the use of functions such as send() and recv() on connectionless sockets.
connect() returns an integer representing the error code: 0 represents success, while -1 represents an error.
Historically, in the BSD-derived systems, the state of a socket descriptor is undefined if the call to connect()
fails (as it is specified in the Single Unix Specification), thus, portable applications should close the socket
descriptor immediately and obtain a new descriptor with socket(), in the case the call to connect() fails.[3]
Prototype:
The gethostbyname() and gethostbyaddr() functions are used to resolve host names and addresses in the
domain name system or the local host's other resolver mechanisms (e.g., /etc/hosts lookup). They return a
pointer to an object of type struct hostent, which describes an Internet Protocol host. The functions take the
following arguments:
The functions return a NULL pointer in case of error, in which cPractical: 25 Marks ase the external integer
h_errno may be checked to see whether this is a temporary failure or an invalid or unknown host. Otherwise
a valid struct hostent * is returned.
These functions are not strictly a component of the BSD socket API, but are often used in conjunction with
the API functions. Furthermore, these functions are now considered legacy interfaces for querying the
domain name system. New functions that are completely protocol-agnostic (supporting IPv6) have been
defined. These new function are getaddrinfo() and getnameinfo(), and are based on a new addrinfo data
structure.
Prototypes:
Conclusion: TCP & UDP socket programs are studied and executed.
FAQs:
1. What is socket?
2. Why port number require for communication?
3. Which are the different types of sockets?
4. Difference between TCP socket and UDP socket.
Assignment No 7
Aim : Introduction to server administration (server administration commands and their applications) and
configuration any three of below Server : (Study/Demonstration Only) FTP, Web Server, DHCP, Telnet,
Mail, DNS
Theory:
Web server
The Apache HTTP server is the most widely-used web server in the world. It provides many powerful
features including dynamically loadable modules, robust media support, and extensive integration with other
popular software.
Install Apache
Apache is available within Ubuntu's default software repositories, so we will install it using conventional
package management tools.
We will begin by updating the local package index to reflect the latest upstream changes. Afterwards, we
can install the apache2 package:
After confirming the installation, apt-get will install Apache and all required dependencies.
apache2.conf: This is the main configuration file for the server. Almost all configuration can be done from
within this file, although it is recommended to use separate, designated files for simplicity. This file will
configure defaults and be the central point of access for the server to read configuration details.This file is
divided into three main sections: configuration for the global Apache server process, configuration for the
default server, and configuration of Virtual Hosts.The "Include" directive allows Apache to read other
configuration files into the current file at the location that the statement appears. The result is that Apache
dynamically generates an overarching configuration file on startup.
The default Virtual Host declaration can be found in a file called "default" in the "sites-available" directory.
We can learn about the general format of a Virtual Host file by examining this file. Open the file with the
following command:
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
. . .
The default Virtual Host is configured to handle any request on port 80, the standard http port. This is
defined in the declaration header where it says "*:80", meaning port 80 on any interface.
<Directory />
Options FollowSymLinks
AllowOverride None
Order Deny,Allow
Deny from All
</Directory>
This will deny access to all content unless specified otherwise in subsequent directory definitions.
The next directory definition is for the document root, so it specifies the "allow from all" option that
overrides the "/" option for this directory.
The "AllowOverride" option is used to decide whether an ".htaccess" file can override settings if it is placed
in the content directory. This is not allowed by default, but can be useful to enable in a variety of
circumstances.
FTP
Installing VsFTP Server in Ubuntu
First, we need to update the system package sources list and then install VSFTPD binary package as
follows:
Once the installation completes, the service will be disabled initially, therefore, we need to start it manually
for the mean time and also enable it to start automatically from the next system boot:
Few configurations to setup and secure our FTP server, first we will create a backup of the original config
file /etc/vsftpd/vsftpd.conf :
$ sudo vi /etc/vsftpd.conf
OR
$ sudo nano /etc/vsftpd.conf
configure VSFTPD to allow/deny FTP access to users based on the user list file /etc/vsftpd.userlist.
But, the option userlist_deny=NO twists the meaning of the default setting, so only users whose username
is explicitly listed in userlist_file=/etc/vsftpd.userlist will be allowed to login to the FTP server.
When users login to the FTP server, they are placed in a chrooted jail, this is the local root
directory which will act as their home directory for the FTP session only.
chroot_local_user=YES
allow_writeable_chroot=YES
The option chroot_local_user=YES importantly means local users will be placed in a chroot jail, their
home directory by default after login.
And we must as well understand that VSFTPD does not permit the chroot jail directory to be writable, by
default for security reasons, however, we can use the option allow_writeable_chroot=YES to disable this
setting.
Save the file and close it. Then we have to restart VSFTPD services for the changes above to take effect:
Then, we have to explicitly list the user aaronkilik in the file /etc/vsftpd.userlist with the echo command
and tee command as below:
Testing anonymous logins: we can clearly see from the output below that anonymous logins are not
permitted on the FTP server:
# ftp 192.168.56.102
Connected to 192.168.56.102 (192.168.56.102).
220 Welcome to TecMint.com FTP service.
Name (192.168.56.102:aaronkilik) : anonymous
530 Permission denied.
Login failed.
ftp> bye
# ftp 192.168.56.102
Connected to 192.168.56.102 (192.168.56.102).
220 Welcome to TecMint.com FTP service.
Name (192.168.56.102:aaronkilik) : aaronkilik
331 Please specify the password.Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
TELNET (Teletype Network) is the service that allows you to access another computer by logging in to
the remote system, such that, you can pass commands to another system by sitting back at your place. It
allows you to send the instructions to a remote client, but in a plain-text format. Telnet listens to all the
requests by the user usually on TCP port 23, but you can change it accordingly.
Telnet is one of the oldest communication protocol to perform this activity, later on with the advancement of
technology “SSH” came into existence, which is a secure method as it sends all the data in an encrypted
format. SSH is used by the professionals in the public network where they can’t take a chance to expose
their credentials to everyone. But with this, it doesn’t mean that Telnet is vanished. There are many
situations where people use Telnet specifically for testing and debugging, in a local or private network.
“telnetd” is a daemon that gets invoked by “inetd” or its extension “xinetd”, both are the internet servers.
To restart “inetd”
“inetd” is daemon used for dealing with incoming network and it is responsible for deciding which program
to run when a request comes.
$ telnet hostipaddress”.
FAQs:
Assignment No 8
Aim : : Using any open source Network Simulator, Implement MANET / Wireless Sensor Network
Theory:
What is ns?
It is Object-oriented, discrete event-driven network simulator
■ Written in C++ and OTcl
ns Architecture
bash-shell$ ns
% set ns [new Simulator]
_o3
% $ns at 1 “puts \“Hello World!\””
1
% $ns at 1.5 “exit”
2
% $ns run
Hello World!
bash-shell$
n0
n1
■ Nodes
● set n0 [$ns node]
● set n1 [$ns node]
● Links and queuing
● $ns duplex-link $n0 $n1 1Mb 10ms RED
● $ns duplex-link $n0 $n1 <bandwidth> <delay> <queue_type>
MANET:
Mobile Ad Hoc Networks: It is Formed by wireless hosts which may be mobile.There is no pre-existing
infrastructure
• Routes between nodes may potentially contain multiple hops
– Nodes act as routers to forward packets for each other
– Node mobility may cause the routes change
FAQ:
Assignment No. 9
Aim: Write a program using Arduino / Rasberry Pi Kit for Demonstration of IOT Application on any one of the
following Topics.Appliance Remote Control,Time Lapse Camera Controller,Security / Automation Sensors,The
Traffic Light Controller,Temperature Controller
Course Outcome
CO6: To understand, explore and implement applications on recent trends in network domain.
Theory:
Hardware Requirements:
Raspberry Pi B+/2/3
HDMI Monitor or HDMI to VGA converter
Digital Relay switch
12V Battery supply
Jumper cables(Male to Male (10), Male to Female(10), Female to Female(10)
Bread Board
Ethernet Cable or Wi-Fi adaptor
USB web-cam
wget http://pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.1.0.tar.gz
cd Rpi.GPIO-0.1.0
Assignment No. 10
Objective :To design and implement small size network and to understand various networking
commands
Course Outcome
CO1: Students will implement small size network and its use of various networking commands
Theory:
Hardware Requirement:
RJ 45 Connector
Crimping tool
Cable
MAN A metropolitan area network (MAN) is a computer network larger than a local area network,
covering an area of a few city blocks to the area of an entire city, possibly also including the surrounding
areas. A MAN is optimized for a larger geographical area than a LAN, ranging from several blocks of
buildings to entire cities.
You usually use straight cable to connect different type of devices. This type of cable will be used most of
the time and can be used to:
1) Connect a computer to a switch/hub's normal port.
2) Connect a computer to a cable/DSL modem's LAN port.
3) Connect 2 switches/hubs with one of the switch/hub using an uplink port and the other one using
normal port.
Cross over cable A crossover cable connects two devices of the same type, for example DTE-DTE
or DCE-DCE
1) Connect 2 computers directly.
2) Connect a router's LAN port to a switch/hub's normal port. (Normally used for expanding network
Connector:
An connector is an electro-mechanical device for joining electrical circuits as an interface using a
mechanical assembly. Connectors consist of plugs (male-ended) and jacks (female-ended). The connection
may be temporary, as for portable equipment, require a tool for assembly and removal, or serve as a
permanent electrical joint between two wires or devices.
RJ 45 connector RJ45 is a standard type of connector for network cables. RJ45 connectors are most
commonly seen with Ethernet cables and networks.RJ45 connectors feature eight pins to which the wire
strands of a cable interface electrically. Standard RJ-45 pin outs define the arrangement of the individual
wires needed when attaching connectors to a cable.
BNC:
The BNC (Bayonet Neill–Concelman) connector is miniatures quick connect/disconnect radio frequency
connector used for coaxial cable The BNC connector is used for signal connections such as:
The BNC was originally designed for military use and has gained wide acceptance in video and RF
applications to 2 GHz
Topology:
Bus topology: All devices are connected to a central cable, called the bus or backbone. Bus networks are
relatively inexpensive and easy to install for small networks. Ethernet systemsuse a bus topology.
Ring topology :All devices are connected to one another in the shape of a closed loop, so that each device is
connected directly to two other devices, one on either side of it. Ring topologies are relatively expensive and
difficult to install, but they offer high bandwidth and can span large distances.
Star topology: All devices are connected to a central hub. Star networks are relatively easy to install and
manage, but bottlenecks can occur because all datamust pass through the hub.
Tree topology: A tree topology combines characteristics of linear bus and star topologies. It consists of
groups of star-configured workstations connected to a linear bus backbone cable.
Switches
A network switch (sometimes known as a switching hub) is a computer networking device that is used to
connect devices together on a computer network by performing a form of packet switching. A switch is
considered more advanced than ahub because a switch will only send a message to the device that needs or
requests it, rather than broadcasting the same message out of each of its ports.A switch is a
multi-port network bridge that processes and forwards data at the data link layer (layer 2) of the OSI model
HUB
An Ethernet hub, active hub, network hub, repeater hub,multiport repeater or hub is a device for
connecting multiple Ethernetdevices together and making them act as a single network segment
FAQ: