0% found this document useful (0 votes)
27 views

CN File

Uploaded by

046Harmehar Kaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

CN File

Uploaded by

046Harmehar Kaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

INDEX

S.No. Program Date Signature


10. Explain the various connecting devices.

11. Explain various Transmission Media.

12. Connect the computers in the Local Area Network.

13. Study of basic network command and Network


configuration commands.

14. Create link, node, connections of various topologies.

15. Simulate three nodes point to point networks with a


duplex link between them.
EXPERIMENT – 10

AIM:
Explain the various connecting devices.

THEORY:
Following are various connecting devices used in Computer Networks:

Repeater: A repeater operates at the physical layer. Its job is to regenerate the signal over the
same network before the signal becomes too weak or corrupted to extend the length to which the
signal can be transmitted over the same network. An important point to be noted about repeaters
is that they do not amplify the signal. When the signal becomes weak, they copy the signal bit by
bit and regenerate it at the original strength. It is a 2 port device.

Hub: A hub is a multiport repeater. A hub connects multiple wires coming from different
branches, for example, the connector in star topology which connects different stations. Hubs
cannot filter data, so data packets are sent to all connected devices. In other words, the collision
domain of all hosts connected through Hub remains one. Also, they do not have the intelligence
to find out the best path for data packets which leads to inefficiencies and wastage.

Types of Hub:

1. Active Hub:- These are the hubs that have their power supply and can clean, boost, and
relay the signal along with the network. It serves both as a repeater as well as a wiring
center. These are used to extend the maximum distance between nodes.
2. Passive Hub:- These are the hubs that collect wiring from nodes and power supply from
the active hub. These hubs relay signals onto the network without cleaning and boosting
them and can’t be used to extend the distance between nodes.
3. Intelligent Hub:- It works like active hubs and includes remote management capabilities.
They also provide flexible data rates to network devices. It also enables an administrator to
monitor the traffic passing through the hub and to configure each port in the hub.

Bridge: A bridge operates at the data link layer. A bridge is a repeater, with add on the
functionality of filtering content by reading the MAC addresses of source and destination. It is
also used for interconnecting two LANs working on the same protocol. It has a single input and
single output port, thus making it a 2 port device.

Types of Bridges:

1. Transparent Bridges: - These are the bridge in which the stations are completely
unaware of the bridge’s existence i.e. whether or not a bridge is added or deleted from
then network, reconfiguration of the stations is unnecessary. These bridges make use of
two processes i.e. bridge forwarding and bridge learning.

2. Source Routing Bridges: - In these bridges, routing operation is performed by the


source station and the frame specifies which route to follow. The host can discover
frames by sending a special frame called a discovery frame, which spreads through the
entire network using all possible paths to the destination.

Switch: A switch is a multiport bridge with a buffer and a design that can boost its efficiency (a
large number of ports implies less traffic) and performance. A switch is a data link layer device.
The switch can perform error checking before forwarding data, which makes it very efficient as
it does not forward packets that have errors and forward good packets selectively to correct ports
only. In other words, the switch divides the collision domain of hosts, but the broadcast domain
remains the same.
Routers: A router is a device like a switch that routes data packets based on their IP addresses.
The router is mainly a Network Layer device. Routers normally connect LANs and WANs and
have a dynamically updating routing table based on which they make decisions on routing the
data packets. The router divides broadcast domains of hosts connected through it. Gateway: A
gateway, as the name suggests, is a passage to connect two networks that may work upon
different networking models. They work as the messenger agents that take data from one system,
interpret it, and transfer it to another system. Gateways are also called protocol converters and
can operate at any network layer.

Gateway: A gateway, as the name suggests, is a passage to connect two networks that may work
upon different networking models. They work as the messenger agents that take data from one
system, interpret it, and transfer it to another system. Gateways are also called protocol
converters and can operate at any network layer.

Brouter: It is also known as the bridging router a device that combines features of both bridge
and router. It can work either at the data link layer or the network layer. Working as a router, it
is capable of routing packets across networks, and working as a bridge, it is capable of filtering
local area network traffic.
Modem: Modem is a device that enables a computer to send or receive data over telephone or
cable lines. The data stored on the computer is digital whereas a telephone line or cable wire can
transmit only analog data.
The main function of the modem is to convert digital signals into analog and vice versa. The
modem is a combination of two devices − a modulator and a demodulator. The modulator
converts digital data into analog data when the data is sent by the computer. The demodulator
converts analog data signals into digital data when it is being received by the computer.
EXPERIMENT – 11
AIM:
Explain various Transmission Media.

THEORY:
Transmission media is a communication channel that carries the information from the sender to
the receiver. Data is transmitted through electromagnetic signals. It is a physical path between
transmitter and receiver in data communication. In the OSI(Open System Interconnection)
phase, transmission media supports Layer 1. Therefore, it is considered to be a Layer 1
component. The electrical signals can be sent through the copper wire, fiber optics, atmosphere,
water, and vacuum.

Causes Of Transmission Impairment:


1. Attenuation: Attenuation means the loss of energy, i.e., the strength of the signal
decreases with increasing the distance which causes the loss of energy.

2. Distortion: Distortion occurs when there is a change in the shape of the signal. This
type of distortion is examined from different signals having different frequencies.

3. Noise: When data is traveled over a transmission medium, some unwanted signal is
added to it which creates the noise.

Classification of Transmission Media:


1. Guided Media: It is defined as the physical medium through which the signals are
transmitted. It is also known as Bounded media.
Types of Guided Media:
I. Twisted pair: Twisted pair is a physical media made up of a pair of cables twisted with
each other. A twisted pair cable is cheap as compared to other transmission media.
Installation of the twisted pair cable is easy, and it is a lightweight cable. The frequency
range for twisted pair cable is from 0 to 3.5KHz. It is two types:
i. Shielded Twisted pair.
ii. Unshielded Twisted Pair.
II. Coaxial Cable: Coaxial cable is a very commonly used transmission medium, for
example, TV wire is usually a coaxial cable. The name of the cable is coaxial as it
contains two conductors parallel to each other. It has a higher frequency as compared to
the Twisted pair cable. Coaxial cable is of two types.
i. Baseband transmission
ii. Broadband transmission
III. Fiber Optic: Fiber optics, also spelled fiber optics, is the science of transmitting data,
voice, and images by the passage of light through thin, transparent fibers. In
telecommunications, fiber optic technology has virtually replaced copper wire in long-
distance telephone lines, and it is used to link computers within local area networks.
Fiber optics provide faster data transmission than copper wires.

2. Unguided Transmission: An unguided transmission transmits electromagnetic waves


without using any physical medium. Therefore it is also known as wireless transmission. In
unguided media, the air is the medium through which electromagnetic energy can flow
easily.
Types of Unguided Media:
I. Radio waves: Radio waves are electromagnetic waves that are transmitted in all
directions of free space. Radio waves are omnidirectional, i.e., the signals are
propagated in all directions. The range in frequencies of radio waves is from 3 Khz to 1
Khz. An example of a radio wave is FM radio.
II. Microwaves: It is a line of sight transmission i.e. the sending and receiving antennas
need to be properly aligned with each other. The distance covered by the signal is
directly proportional to the height of the antenna. Frequency Range: 1GHz– 300GHz.
These are majorly used for mobile phone communication and television distribution.
III. Infrared: Infrared waves are used for very short-distance communication. They cannot
penetrate through obstacles. This prevents interference between systems. Frequency
Range:300GHz – 400THz. It is used in TV remotes, wireless mice, keyboards, printers,
etc.
EXPERIMENT – 12
AIM:
Connect the computers in the Local Area Network.

THEORY:
In order to connect computers in the Local area network we have to set up each system in the
network. In this example I will connect two computer systems.

PROCEDURE:
On the host computer:

On the host computer, follow these steps to share the Internet connection:
1. Log on to the host computer as Administrator or as Owner.
2. Click on Start, and then click on the Control Panel.
3. Click on Network and Internet Connections.
4. Click on Network Connections.
5. Right-click on the connection that you use to connect to the Internet.
6. Click on Properties.
7. Click the Advanced tab.
8. Under Internet Connection Sharing, select the Allow other network users to connect
through this computer's Internet connection check box.
9. If you are sharing a dial-up Internet connection, select the Establish a dial-up connection
whenever a computer on my network attempts to access the Internet check box if you
want to permit your computer to automatically connect to the Internet.
10. Click on OK. You receive the following message:
11. When Internet Connection Sharing is enabled, your LAN adapter will be set to use IP
address 192.168.0.1. Your computer may lose connectivity with other computers on
your network. If these other computers have static IP addresses, it is a good idea to set
them to obtain their IP addresses automatically. Are you sure you want to enable
Internet Connection Sharing?
12. Click Yes.
13. The connection to the Internet is shared to other computers on the local area network
(LAN).
14. The network adapter that is connected to the LAN is configured with a static IP address
of 192.168.0.1 and a subnet mask of 255.255.255.0.
On the client computer:

To connect to the Internet by using the shared connection, you must confirm the
LAN adapter IP configuration, and then configure the client computer. To confirm the LAN
adapter IP configuration, follow these steps:
1.Log on to the client computer as Administrator or as Owner.
2.Click on Start, and then click on the Control Panel.
3.Click on Network and Internet Connections.
4.Click Network Connections.
5.Right-click on Local Area Connection and then click on Properties.
6.Click the General tab, click Internet Protocol (TCP/IP) in the connection, use the
following items list, and then click Properties.
7.In the Internet Protocol (TCP/IP) Properties dialog box, click Obtain an IP address
automatically (if it is not already selected), and then click OK.
Note: You can also assign a unique static IP address in the range of 192.168.0.2 to
192.168.0.254. For example, you can assign the following static IP address, subnet mask,
and default gateway:
a. IP address 192.168.31.202
b. Subnet mask 255.255.255.0
c. Default gateway 192.168.31.1
8.In the Local Area Connection Properties dialog box, click OK.
9.Quit Control Panel.

Both Computers are successfully connected through the Local Area Network.
EXPERIMENT – 13
AIM:
Study of basic network command and Network configuration commands.

THEORY:
All commands related to Network configuration which includes how to switch to privilege mode
and normal mode and how to configure router interface and how to save this configuration to
flash memory or permanent memory.
This commands includes
 Configuring the Router commands
 General Commands to configure network
 Privileged Mode commands of a router
 Router Processes & Statistics
 IP Commands
 Other IP Commands e.g. show ip route etc.
Following are the commands used in Network Configuration:
1. Ping: ping sends an ICMP ECHO_REQUEST packet to the specified host. Ifthe host
responds, you get an ICMP packet back. We can “ping” an IP address tosee if a machine is
alive. If there is no response, you know something is wrong.

2. Tracert: ‘tracert’ is used for traceroute. ‘tracert’ is a command which can show you the
path a packet of information takes from your computer to one you specify. It will list all
the routers it passes through until it reaches its destination, or fails to and is discarded. In
addition to this, it will tell you how long each 'hop' from router to router takes.
3. nslookup: nslookup (stands for “Name Server Lookup”) is a useful command for getting
information from a DNS server. It is a network administration tool for querying the
Domain Name System (DNS) to obtain domain name or IP address mapping or any other
specific DNS record. It is also used to troubleshoot DNS related problems.

4. Pathping: pathping is an interesting command that's unique to Windows. It's sort of a


cross between the ping command and the tracert command, combining the features of both
into one tool. When you run pathping, it first traces the route to the destination address
much the way tracert does. Then, it launches into a 25-second test of each router along the
way, gathering statistics on the rate of data loss to each hop. If the route has a lot of hops,
this can take a long time. However, it can help you to spot potentially unreliable hops.

Commands for router:


In any command mode, you can get a list of available commands by entering a question mark
(?).
1.?: To obtain a list of commands that begin with a particular character sequence, type in
those characters followed immediately by the question mark (?).
2.enable: Use enable command to enter in privilege exec mode.

3.co?: To complete a command enter a few known characters followed by a question mark
(with no space):

4.show: Enter show command with ? ( Question mark ) to list all available commands.

5.configure terminal: Enters global configuration mode, when using the console port.

6.show running-config: Displays the running configuration.

7.show startup-config: Displays the startup configuration.


8.copy running-config startup-config: Copy the running configuration to the startup
configuration.

9.copy startup-config running-config: Copy the startup configuration to the running


configuration.

10.erase startup-config: erase the startup-configuration in NVRAM.


EXPERIMENT – 14
AIM:
Create link, node, connections of various topologies.

PROGRAM:
Ring Topology:
set ns [new Simulator]
$ns rtproto DV
set nf [open out.nam w]
$ns namtrace-all $nf

proc finish {} {
global ns nf
$ns flush-trace close $nf
exec nam out.nam exit 0
}

#Creating Nodes
for {set i 0} {$i<7} {incr i} { set n($i) [$ns node]
}

#Creating Links
for {set i 0} {$i<7} {incr i} {
$ns duplex-link $n($i) $n([expr ($i+1)%7]) 512Kb 5ms DropTail
}

$ns duplex-link-op $n(0) $n(1) queuePos 1


$ns duplex-link-op $n(0) $n(6) queuePos 1

#Creating UDP agent and attching to node 0


set udp0 [new Agent/UDP]
$ns attach-agent $n(0) $udp0

#Creating Null agent and attaching to node 3


set null0 [new Agent/Null]
$ns attach-agent $n(3) $null0
$ns connect $udp0 $null0

#Creating a CBR agent and attaching it to udp0


set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 1024
$cbr0 set interval_ 0.01
$cbr0 attach-agent $udp0
$ns rtmodel-at 0.4 down $n(2) $n(3)
$ns rtmodel-at 1.0 up $n(2) $n(3)
$ns at 0.01 "$cbr0 start"
$ns at 1.5 "$cbr0 stop"
$ns at 2.0 "finish"
$ns run

Star Topology:
#This program will create a Star Topolgy using for loop in tcl in order to use less statements
set ns [new Simulator]
$ns color 1 blue
$ns color 2 red
$ns rtproto DV

set nf [open out.nam w]


$ns namtrace-all $nf

proc finish {} {
global ns nf
$ns flush-trace close $nf
exec nam out.nam exit 0
}

#creating Nodes
for {set i 0} {$i<7} {incr i} {
set n($i) [$ns node]
}

#Creating Links
for {set i 1} {$i<7} {incr i} {
$ns duplex-link $n(0) $n($i) 512Kb 10ms SFQ
}

#Orienting The nodes


$ns duplex-link-op $n(0) $n(1) orient left-up
$ns duplex-link-op $n(0) $n(2) orient right-up
$ns duplex-link-op $n(0) $n(3) orient right
$ns duplex-link-op $n(0) $n(4) orient right-down
$ns duplex-link-op $n(0) $n(5) orient left-down
$ns duplex-link-op $n(0) $n(6) orient left

#TCP_Config
set tcp0 [new Agent/TCP]
$tcp0 set class_ 1
$ns attach-agent $n(1) $tcp0
set sink0 [new Agent/TCPSink]
$ns attach-agent $n(4) $sink0
$ns connect $tcp0 $sink0

#UDP_Config
set udp0 [new Agent/UDP]
$udp0 set class_ 2
$ns attach-agent $n(2) $udp0
set null0 [new Agent/Null]
$ns attach-agent $n(5) $null0
$ns connect $udp0 $null0

#CBR Config
set cbr0 [new Application/Traffic/CBR]
$cbr0 set rate_ 256Kb
$cbr0 attach-agent $udp0

#FTP Config
set ftp0 [new Application/FTP]
$ftp0 attach-agent $tcp0

#Scheduling Events
$ns rtmodel-at 0.5 down $n(0) $n(5)
$ns rtmodel-at 0.9 up $n(0) $n(5)
$ns rtmodel-at 0.7 down $n(0) $n(4)
$ns rtmodel-at 1.2 up $n(0) $n(4)
$ns at 0.1 "$ftp0 start"
$ns at 1.5 "$ftp0 stop"
$ns at 0.2 "$cbr0 start"
$ns at 1.3 "$cbr0 stop"
$ns at 2.0 "finish"
$ns run

Hybrid Topology:
set ns [new Simulator]
set nf [open out.nam w]
$ns namtrace-all $nf

proc finish {} {
global ns nf
$ns flush-trace
close $nf
exec nam out.nam
exit 0
}
$ns rtproto DV

# create nodes and establish links


for {set i 1} {$i<5} {incr i} {
set r($i) [$ns node]
set h($i) [$ns node]
}
for {set i 1} {$i<15} {incr i} {
set p($i) [$ns node]
}

#Creating Links between h and p


for {set i 1} {$i<4} {incr i} {
$ns duplex-link $h(1) $p($i) 1.5Mb 10ms SFQ
$ns duplex-link $h(3) $p([expr ($i+7)]) 1.5Mb 10ms SFQ
}
for {set i 4} {$i<8} {incr i} {
$ns duplex-link $h(2) $p($i) 1.5Mb 10ms SFQ
$ns duplex-link $h(4) $p([expr ($i+7)]) 1.5Mb 10ms SFQ
}

#Creating Links between r nodes and connecting r to h


for {set i 1} {$i<4} {incr i} {
$ns duplex-link $r($i) $r([expr ($i+1)]) 1.5Mb 10ms SFQ
$ns duplex-link $r($i) $h($i) 1.5Mb 10ms SFQ
}

$ns duplex-link $r(4) $r(1) 1.5Mb 10ms SFQ


$ns duplex-link $r(4) $h(4) 1.5Mb 10ms SFQ

# orienting the nodes


$ns duplex-link-op $r(1) $h(1) orient up
$ns duplex-link-op $r(2) $h(2) orient right
$ns duplex-link-op $r(3) $h(3) orient down
$ns duplex-link-op $r(4) $h(4) orient left

#creating tcp agents and attach


set tcp3 [new Agent/TCP]
set tcp9 [new Agent/TCPSink]

$ns attach-agent $p(3) $tcp3


$ns attach-agent $p(9) $tcp9
$ns connect $tcp3 $tcp9
set tcp5 [new Agent/TCP]
set tcp12 [new Agent/TCPSink]
$ns attach-agent $p(5) $tcp5
$ns attach-agent $p(12) $tcp12
$ns connect $tcp5 $tcp12

#creating FTP application for tcp agents


set ftp3 [new Application/FTP]
set ftp5 [new Application/FTP]

$ftp3 attach-agent $tcp3

$ftp5 attach-agent $tcp5

#creating udp agents and attach


set udp13 [new Agent/UDP]
set udp6 [new Agent/Null]
$ns attach-agent $p(13) $udp13
$ns attach-agent $p(6) $udp6
$ns connect $udp13 $udp6

set udp1 [new Agent/UDP]


set udp8 [new Agent/Null]
$ns attach-agent $p(1) $udp1
$ns attach-agent $p(8) $udp8
$ns connect $udp1 $udp8

#creating CBR applications for udp


set cbr13 [new Application/Traffic/CBR]

# send 50 packets in 1 second i.e 1 packet every 1/50 second


$cbr13 set packetSize_ 1536
$cbr13 set interval_ 0.02
$cbr13 attach-agent $udp13
set cbr1 [new Application/Traffic/CBR]

# send 400 packets in 1 second i.e 1 packet every 1/400 second


$cbr1 set packetSize_ 5632
$cbr1 set interval_ 0.0025
$cbr1 attach-agent $udp1

# setting events
$ns rtmodel-at 0.7 down $r(1) $r(2)
$ns rtmodel-at 1.0 up $r(1) $r(2)
$ns rtmodel-at 0.9 down $r(4) $r(3)
$ns rtmodel-at 1.3 up $r(4) $r(3)

$ns at 0.2 "$ftp3 start"


$ns at 1.8 "$ftp3 stop"
$ns at 0.3 "$ftp5 start"
$ns at 1.4 "$ftp5 stop"
$ns at 0.4 "$cbr13 start"
$ns at 1.6 "$cbr13 stop"
$ns at 0.7 "$cbr1 start"
$ns at 1.7 "$cbr1 stop"
$ns at 2.0 "finish"
$ns run

OUTPUT:
1. Ring Topology:

2. Star Topology:
3. Hybrid Topology:
EXPERIMENT – 15
AIM:
Simulate three nodes point to point networks with a duplex link between them.

PROGRAM:
#creates a new simulator
set ns [new Simulator]
set nf [open prog1.nam w]
$ns namtrace-all $nf
set nd [open prog1.tr w]
$ns trace-all $nd
proc finish { } {
global ns nf nd
$ns flush-trace
close $nf
close $nd
exec nam prog1.nam &
exit 0
}

#creating nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]

#linking nodes
$ns duplex-link $n0 $n1 1Mb 10ms DropTail
$ns duplex-link $n1 $n2 512Kb 10ms DropTail

#setting queue size of the link


$ns queue-limit $n1 $n2 5
#creating a udp connection in network simulator
set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0

#set up CBR over udp


set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 500
$cbr0 set interval_ 0.005
$cbr0 attach-agent $udp0
set sink [new Agent/Null]
$ns attach-agent $n2 $sink
$ns connect $udp0 $sink #scheduling events
$ns at 0.2 "$cbr0 start"
$ns at 4.5 "$cbr0 stop"
$ns at 5.0 "finish"
$ns run

OUTPUT:

You might also like