You are on page 1of 69

Practical File of

“Advances in Data & Computer Communication Lab”


Submitted in partial fulfillment of the requirement
For the award of the degree of

M.TECH – WEEKEND
Session 2021
Computer Science & Engineering
Third Semester
MECS-773

Submitted To:
Dr. V P Vishwakarma

Submitted By:
Muskan
00916424821

Guru Gobind Singh Technical University


Sector 16C, Dwarka, New Delhi, 110078

1|Page
INDEX
Sno. Experiment Name

1) Study of basic network command and Network configuration


commands (with all their options).

2) Configuration of IP addressing for a given scenario for a given set


of hybrid topology.

3) Configuration and logging to a CISCO Router and introduction to


the basic user Interfaces. Introduction to the basic router
configuration and basic commands.

4) Configure, implement, and debug the following: Use open-source


tools for debugging and diagnostics. a. RIP routing protocol b.
BGP routing c. OSPF routing protocol.

5) Configure a DHCP Server to serve contiguous IP addresses to a


pool of four IP devices with a default gateway and a default DNS
address.

6) Configuration of Domain Name Server (DNS).

7) Introduction to network simulators used for wireless ad hoc and


sensor networks.

8) Implementation of script to create fixed wireless nodes.

9) Implementation of script to create the dynamic number of


nodes.

10) Implementation of script to create a topology for a wireless


sensor network. (Example: star topology)

2|Page
Experiment – 1: Study of basic network command and Network configuration commands
(with all their options).

1) ipconfig: - The ipconfig command is a fast way of determining your


computer's IP address and other information, such as the address of its default
gateway.
• Syntax: - ipconfig
• Output

2) ipconfig /displaydns :- Display the contents of the DNS Resolver Cache.


A DNS cache (sometimes called a DNS resolver cache) is a temporary database, maintained
by a computer's operating system, that contains records of all the recent visits and
attempted visits to websites and other internet domains.
• Syntax: - ipconfig/displaydns
• Output

P.T.O.

3|Page
3) ipconfig /flushdns :- Flush Your DNS Resolver Cache Windows uses a cache that
remembers DNS responses it's received, saving time when you access the same
addresses again in the future. To ensure Windows is getting addresses from the new
DNS servers instead of using old, cached entries, run the ipconfig /flushdns command
after changing your DNS server.
• Syntax: - ipconfig/flushdns
• Output

4) ipconfig /all: - Displays the same IP addressing information for each adapter as the
default option. Additionally, it displays DNS and WINS settings for each adapter. WINS is
an abbreviation for Windows Internet Name Service and DNS stands for Domain Name
System. Displays the full TCP/IP configuration for all adapters. Adapters can represent
physical interfaces, such as installed network adapters, or logical interfaces, such as
dial-up connections.
• Syntax: - ipconfig/all
• Output

P.T.O.

4|Page
5) ipconfig /release:- To release the current IP configuration ipconfig /release is executed
to force the client to immediately give up its lease by sending the server a DHCP release
notification which updates the server's status information and marks the old client's IP
address as "available". Then, the command ipconfig /renew is executed to request a
new IP address.
• Syntax: - ipconfig/release
• Output

6) ipconfig/renew: - To renew the current Ip Address Configuration.


• Syntax: - ipconfig/renew
• Output

7) ping: - The ping command is used to verify that a device can communicate with another
on a network.
• Syntax: - ping google.co.in
• Output

5|Page
8) ping target address:- The ping command is used to verify that a device can
communicate with another on a network. Here we provide a Ip Address of a Device
within the Same Network.

• Syntax: - ping 192.168.x.x (Ip Address of the Other Device we want to ping with)
• Output

9) ping -n count: - count is the number of echo requests to send The switch sends a series
of Internet Control Message Protocol (ICMP) echo (ping) requests to a specified host
and receives ICMP echo responses.
• Syntax: - ping -n 6 google.co.in
• Output

P.T.O

6|Page
10) tracert: - Tracert is a command which can show you the path a packet of information
taken 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.
• Syntax: - tracert google.co.in
• Output

11) netstat: - Display protocol statistics and current TCP/IP network connections. Displays
all connections and listening ports. Netstat Execute the netstat command alone to show
a relatively simple list of all active TCP connections which, for each one, will show the
local IP address (your computer), the foreign IP address (the other computer or
network device), along with their respective port numbers, as well as the TCP state.
• Syntax: - netstat
• Output

7|Page
12) netstat -a:- Proto, Local Address, Foreign Address, and State, Gives brief info about
them.
• Proto - defined the protocol type (TCP, UDP, etc..,) of the socket.
• Local Address - displays your computer IP address and port, local end of the
socket.
• Foreign Address - displays remote computer that your computer is connected
to, the remote end of the socket.
• State - defines the state of the socket (LISTENING. ESTABLISHED, CLOSE_WAIT,
TIME_WAIT).
• Syntax: - netstat -a
• Output

13) netstat | findstr ESTABLISHED: - To view all established connection from/to your
system.
• Syntax: - netstat | findstr ESTABLISHED

8|Page
• Output

14) netstat -an | find /i "listening”:- To list all listening ports


• Syntax: - netstat -an | find /i "listening"
• Output

15) hostname: - Get the Hostname of the system.


• Syntax: - hostname
• Output

9|Page
16) getmac:- Get the MAC details of the system.
• Syntax: - getmac
• Output

17) arp -a: - Displays and modifies the IP-to-Physical address translation tables used by
address resolution protocol (ARP).
• Syntax: - arp -a
• Output

18) nslookup domain_name/ip_address :- Nslookup is used to query the Domain Name


System (DNS) to obtain domain name or IP address mapping, or other DNS records. The
name "nslookup" means "name server lookup".
• Syntax: - nslookup (Your desired Address/Domain_name)
• Output

10 | P a g e
19) nslookup: - Getting domain name from IP address is Reverse DNS.
• Syntax: - nslookup (Your desired Address)
• Output

20) route print: - It allows you to see your computers routing table.
• Syntax: - nslookup (Your desired Address)
• Output

11 | P a g e
Experiment – 2: - Configuration of Ip Addressing for a given set of topology.

Cisco Packet Tracer: - Introduction to Packet Tracer What is Packet Tracer?


Packet Tracer is a protocol simulator developed by Dennis Frezzo and his team at Cisco
Systems. Packet Tracer (PT) is a powerful and dynamic tool that displays the various protocols
used in networking, in either Real Time or Simulation mode.
• This includes layer 2 protocols such as Ethernet and PPP, layer 3 protocols such as IP,
ICMP, and ARP, and layer 4 protocols such as TCP and UDP. Routing protocols can also
be traced.
• The Cisco Packet Tracer is a powerful computer network simulation program.
• It allows users to experiment with network behaviours.
• It provides simulation capability, visualization capability, authoring capability,
assessment capability, collaboration capability.
• We will begin building our network topology by selecting devices and the media in
which to connect them. Several types of devices and network connections can be used.
• For this Experiment we will use End Devices, Switches, Hubs, and PCs to PCs
Connections.
Step 1 – Choose “Hub”, then select the “PT-HUB” and click on the main area.

Hub0 Will be Added into the Main-


Area.
Step 2 – Select “End Devices” and then select the “PC” and click on the main area.

PC0 Will be Added into the Main-Area.

12 | P a g e
Step 3 – Repeat the above Process to place as many PCs.

Step 4 – Now Select “Connections” and then click on “Automatically choose Connection Type”.

Step 5 – Draw Connections from HUB to PC.

13 | P a g e
Step 6 – Double Click on a PC, a box will appear. After that click on “Desktop” Tab and then
select “IP configuration.”

Step 7 – Write the IP Address of your network and click at the subnet mask field. Subnet Mask
will appear automatically.

14 | P a g e
Step 8 – Repeat Step 6 & Step 7 to set the IPs for all the PC’s.

Fig A

In Fig A, We can Clearly See that –


PC0 is assigned IP Address of 192.168.1.1
PC1 is assigned IP Address of 192.168.1.4
Stepis9assigned
PC2 – Select “Add Simple Message”.
IP Address Drag and Drop the Message to the Source Device and
of 192.168.1.2
thenistoassigned
the Destination Deviceof
and observe the Output of “Realtime” tab.
PC3 IP Address 192.168.1.3

In above Scenario, My Source Device is PC0 and My Destination Device is PC3.


Status is returned “Successful”.

Step 10 – We can also make use of the “Simulation Mode”. Once the Message is Drag and
Drop to Source and Destination Device respectively, choose the “Auto Capture/Play”.

P.T.O.

15 | P a g e
Step 11 – Observe the Path of the Message from source to hub, then to all devices, and then
from destination to hub then back to the source.

Conclusion – Connection is established successfully between Source and Destination Device.

16 | P a g e
Experiment – 3: -Configuration of Router and Introduction to Basic User Interface.

✓ We will begin building our network topology by selecting devices and the media in
which to connect them. Several types of devices and network connections can be used.
✓ For this Experiment we will use End Devices, like Routers and PCs.
Step 1 – Choose “Networking Devices” -> “Routers” and select “Router 4321”. After selecting
click on the main area, a router will be added.

Router0 Will be Added into the Main-Area.

Step 2 – Repeat “Step 1” to add another Router.

Step 3 – Just Like Routers, Now Add 2 Switches into the Main-Area.

Step 4 – Select “End Devices” and then select the “PC” and click on the main area.

17 | P a g e
PC0 Will be Added into the Main-
Area.

Step 5 – Repeat the above Process to place as many PCs.

Step 6 – Now Select “Connections” and then click on “Automatically choose Connection Type”.

Step 7 – Draw Connections.

18 | P a g e
Fig A

Step 8 – Double Click on a Router, a box will appear. After that click on “Config” Tab.

Step 9 – In “Config” Tab, We have to do 2 Things.


1. Config the Router With Switch.
2. Config the Router With the other Router in Network.

According to the Network, User have to Manually figure out which Interface Port
(GigabitEthernet0/0/0 or GigabitEthernet0/0/1) is Connected to the Switch/Router.

In Fig A. Router0 is Connected to Switch via GigabitEthernet0/0/0 and . Connected to


another Router via GigabitEthernet0/0/1. Therefore, Config will be like :–

19 | P a g e
Fig.1.1 Config For GigabitEthernet0/0/0

Fig.1.2 Config For GigabitEthernet0/0/1

We can also configure the router from the command-line interface (CLI).
Following Figures 1.3 & 1.4, show the Implementation of Config of GigabitEthernet0/0/0 &
GigabitEthernet0/0/1 using CLI Commands.

P.T.O.

20 | P a g e
Fig1.3 CLI Config Commands on GigabitEthernet0/0/0

Fig1.4 CLI Config Commands on GigabitEthernet0/0/1

Step 10 – In “Config” Tab, Click on the “Routing” then Static and Config the Static Routes of
the Network.

21 | P a g e
Fig1.5 Static Route Config for Router0

Fig1.6 Static Route Config for Router1

We can also configure the Static Route from the command-line interface (CLI).
Following Figures 1.7 & 1.8, show the Implementation of Config of Router0 & Router1 using
CLI Commands.

Fig1.7 Static Route Config using CLI Fig1.8 Static Route Config using CLI
Commands for Router0 Commands for Router1

22 | P a g e
Step 11 – Double Click on a PC, a box will appear. After that click on “Desktop” Tab and then
select “IP configuration”.

Step 12 – Write the IP Address of your network and click at the subnet mask field. Subnet
Mask will appear automatically. Also Input the Default Gateway.

Step 13 – Repeat Step 11 & Step 12 to set the IPs for all the PC’s.

P.T.O.

23 | P a g e
Fig B

In Fig B, We can Clearly See that –


PC0 is assigned IP Address of 192.168.2.7
PC1 is assigned IP Address of 192.168.2.9
PC2 is assigned IP Address of 192.168.3.5
PC3 is assigned IP Address of 192.168.3.7
Router0 is assigned IP Address of 192.168.1.2
Router1 is assigned IP Address of 192.168.1.4
Default Gateway From Switch0 to Router0 is 192.168.2.3
Default Gateway From Switch1 to Router1 is 192.168.3.3

Step 14 – Select “Add Simple Message”. Drag and Drop the Message to the Source Device and
then to the Destination Device and observe the Output of “Realtime” tab.

P.T.O.

24 | P a g e
In above Scenario –
1) My Source Device is PC2 and My Destination Device is Router1.
Status is returned “Successful”.
2) My Source Device is PC0 and My Destination Device is Router0.
Status is returned “Successful”.

In above Scenario –
1) My Source Device is PC0 and My Destination Device is Router1.
Status is returned “Successful”.
2) My Source Device is PC0 and My Destination Device is PC3.
Status is returned “Successful”.
3) My Source Device is PC2 and My Destination Device is Router0.
Status is returned “Successful”.
4) My Source Device is PC2 and My Destination Device is PC1.
Status is returned “Successful”.

Step 15 – We can also make use of the “Simulation Mode”. Once the Message is Drag and
Drop to Source and Destination Device respectively, choose the “Auto Capture/Play”.

25 | P a g e
Step 16 – Observe the Path of the Message from source to hub, then to all devices, and then
from destination to hub then back to the source.

Packets Going Across the Networks

Packets
Receiving at
Destination is
showed by
“Green Tick”

Conclusion – Connection is established successfully between Source and Destination Device .

26 | P a g e
Experiment – 4: - Configuration of Dynamic Routing Protocols RIP, OSPF and BGP protocols
using CISCO Packet Tracer.

✓ Configure Two autonomous system one by RIP(DISTANCE VECTOR) and other by


OSPF(LINK STATE) and then these autonomous system can communicate by BGP.

BGP
RIP OSPF

✓ RIP exchanges state only between adjacent routers. The information exchanged by the
router is all the information currently known by the router, namely the routing table.
Routing information is exchanged at regular intervals.
✓ OSPF sends information to all routers of the local AS. The information sent is the link
state of all routers adjacent to the router. That is, the network topology of the router.
If the link status changed, the router will use flooding to send information to all
routers.
✓ RIP and OSPF are Intra-Autonomous Interior Routing Protocol.
✓ BGP is Intra-Autonomous Exterior Routing Protocol.
✓ We will begin building our network topology by selecting devices and the media in
which to connect them. Several types of devices and network connections can be used.
✓ For this Experiment we will use End Devices, like PCs and “Router-PT”.
➢ Step 1 to Step 12 Show the Formation & Configuration of Autonomous System
(RIP).
➢ Step 13 to Step 24 Show the Formation & Configuration of Autonomous System
(OSPF).
Step 1 – Choose “Networking Devices” -> “Routers” and select “Router-PT”. After selecting
click on the main area, a router will be added.

Router0 Will be Added into the Main-Area.

27 | P a g e
Step 2 – Repeat “Step 1” to add another Router.

Step 3 – Select “End Devices” and then select the “PC” and click on the main area.

PC0 Will be Added into the Main-


Area.

Step 4 – Repeat the above Process to One More PCs.

Step 5 – Now Select “Connections” and then click on “Automatically choose Connection Type”.

28 | P a g e
Step 6 – Draw Connections.

Fig A
Autonomous
System (RIP)

Step 7 – Double Click on a Router, a box will appear. After that click on “Config” Tab.

Step 8 – In “Config” Tab, we have to do 2 Things.


3. Config the Router With PC.
4. Config the Router With the other Router in Network.

According to the Network, User have to Manually figure out which Interface Port
(FastEthernet0/0, FastEthernet1/0, Serial 2/0, … ) is Connected to the PC/Router.

In Fig A. Router0 is Connected to PC via FastEthernet0/0 and Connected to another Router


via Serial 2/0. Therefore, Config will be like :–

29 | P a g e
Fig.1.1 Config For FastEthernet0/0

Fig.1.2 Config For Serial 2/0

We can also configure the router from the command-line interface (CLI).
Following Figures 1.3 & 1.4, show the Implementation of Config of FastEthernet0/0 & Serial
2/0 using CLI Commands.

P.T.O.

30 | P a g e
Fig1.3 CLI Config Commands on FastEthernet0/0

Fig1.4 CLI Config Commands on Serial 2/0

Step 9 – In “Config” Tab, Click on the “Routing” then RIP and Config the RIP Routes of the
Network.

31 | P a g e
Fig1.5 RIP Route Config for Router0

Fig1.6 RIP Route Config for Router1

We can also configure the Static Route from the command-line interface (CLI).
Following Figures 1.7 & 1.8, show the Implementation of Config of Router0 & Router1 using
CLI Commands.

Fig1.7 RIP Route Config using CLI Fig1.8 RIP Route Config using CLI
Commands for Router0 Commands for Router1

Step 10 – Double Click on a PC, a box will appear. After that click on “Desktop” Tab and then
select “IP configuration”.

32 | P a g e
Step 11 – Write the IP Address of your network and click at the subnet mask field. Subnet
Mask will appear automatically. Also Input the Default Gateway.

Fig1.9 PC0 Config

Fig1.10 PC1 Config

33 | P a g e
Step 12 – Autonomous System (RIP) is Formed and Configured.

Fig B

In Fig B, We can Clearly See that –


PC0 is assigned IP Address of 10.10.10.2
PC1 is assigned IP Address of 20.20.20.2

Router0 & Router1 is assigned Network Address of 30.0.0.0


PC0 to Router0 is assigned Network Address of 10.0.0.0
PC1 to Router1 is assigned Network Address of 20.0.0.0

Step 13 – Choose “Networking Devices” -> “Routers” and select “Router-PT”. After selecting
click on the main area, a router will be added.

34 | P a g e
Router3 Will be Added into the Main-Area.

Step 14 – Repeat “Step 13” to add another Router.

Step 15 – Select “End Devices” and then select the “PC” and click on the main area.

PC2 Will be Added into the Main-


Area.

Step 16 – Repeat the above Process to One More PCs.

35 | P a g e
Step 17 – Now Select “Connections” and then click on “Automatically choose Connection
Type”.

Step 18 – Draw Connections.

Fig C
Autonomous
System (OSPF)

Step 19 – Double Click on a Router, a box will appear. After that click on “Config” Tab.

Step 20 – In “Config” Tab, We have to do 2 Things.


1. Config the Router With PC.
2. Config the Router With the other Router in Network.

According to the Network, User have to Manually figure out which Interface Port
(FastEthernet0/0, FastEthernet1/0, Serial 2/0, … ) is Connected to the PC/Router.

In Fig A. Router2 is Connected to PC via FastEthernet0/0 and Connected to another Router


via Serial 2/0. Therefore, Config will be like :–

36 | P a g e
Fig.2.1 Config For FastEthernet0/0

Fig.2.2 Config For Serial 2/0

We can also configure the router from the command-line interface (CLI).
Following Figures 2.3 & 2.4, show the Implementation of Config of FastEthernet0/0 & Serial
2/0 using CLI Commands.

P.T.O.

37 | P a g e
Fig2.3 CLI Config Commands on FastEthernet0/0

Fig2.4 CLI Config Commands on Serial 2/0

Step 21 – In “Config” Tab, click on the “Routing” then RIP and Config the RIP Routes of the
Network.

38 | P a g e
Fig2.5 RIP Route Config for Router2

Fig2.6 RIP Route Config for Router3

We can also configure the Static Route from the command-line interface (CLI).
Following Figures 1.7 & 1.8, show the Implementation of Config of Router0 &
Router1 using CLI Commands.

Fig2.7 RIP Route Config using CLI Fig2.8 RIP Route Config using CLI
Commands for Router2 Commands for Router3

39 | P a g e
Step 22 – Double Click on a PC, a box will appear. After that click on “Desktop”
Tab and then select “IP configuration”.

Step 23 – Write the IP Address of your network and click at the subnet mask
field. Subnet Mask will appear automatically. Also Input the Default Gateway.

Fig2.9 PC2 Config

Fig2.10 PC3 Config

40 | P a g e
Step 24 – Autonomous System (OSPF) is Formed and Configured.

Fig D

In Fig D, We can Clearly See that –


PC2 is assigned IP Address of 40.40.40.2
PC3 is assigned IP Address of 50.50.50.2

Router2 & Router3 is assigned Network Address of 60.0.0.0


PC2 to Router2 is assigned Network Address of 40.0.0.0
PC3 to Router3 is assigned Network Address of 50.0.0.0

Step 25 – To Transfer a Packet from PC1 to PC2, we have to configure a BGP.


Therefore, Connect Router1 & Router2.

Step 26 – Config Router1 for BGP as: -

41 | P a g e
Fig3.1 Router1 BGP Config

Step 27 – Config Router2 for BGP as :-

Fig3.2 Router2 BGP Config

Step 28 – BGP is Formed and Configured.

Step 29 – Select “Add Simple Message”. Drag and Drop the Message to the
Source Device and then to the Destination Device and observe the Output of
“Realtime” tab.

42 | P a g e
In above Scenario –
3) My Source Device is PC2 and My Destination Device is Router1.
Status is returned “Successful”.
4) My Source Device is PC1 and My Destination Device is PC2.
Status is returned “Successful”.

In above Scenario –
5) My Source Device is PC0 and My Destination Device is Router1.
6) Status is returned “Successful”.
7) My Source Device is PC0 and My Destination Device is PC3.
8) Status is returned “Successful”.
9) My Source Device is PC2 and My Destination Device is Router0.
10) Status is returned “Successful”.
11) My Source Device is PC2 and My Destination Device is PC1.
Status is returned “Successful”.

Step 30 – We can also make use of the “Simulation Mode”. Once the Message is
Drag and Drop to Source and Destination Device respectively, choose the “Auto
Capture/Play”.

Step 31 – Observe the Path of the Message from source to hub, then to all
devices, and then from destination to hub then back to the source.

43 | P a g e
Packets Going Across the Networks

Packets
Receiving at
Destination is
showed by
“Green Tick”

Conclusion – Connection is established successfully between Source and Destination Device.

44 | P a g e
Experiment – 5: -Configuration of DHCP Server to Serve Contiguous IP Address
to the Pool of Four IP Devices with a Default Gateway and Default DNS
Address.

✓ The Dynamic Host Configuration Protocol (DHCP) is a network protocol


that is used to configure network devices so that they can communicate on
an IP network.
✓ A DHCP client uses the DHCP protocol to acquire configuration
information, such as an IP address, a default route and one or more DNS
server addresses from a DHCP server.
✓ The DHCP client then uses this information to configure its host. Once the
configuration process is complete, the host is able to communicate on that
internet.
✓ The DHCP server maintains a database of available IP addresses and
configuration information.
✓ When it receives a request from a client, the DHCP server determines the
network to which the DHCP client is connected, and then allocates an IP
address or prefix that is appropriate for the client, and sends configuration
information appropriate for that client.
✓ Because the DHCP protocol must work correctly even before DHCP clients
have been configured, the DHCP server and DHCP client must be
connected to the same network link.
✓ DHCP servers typically grant IP addresses to clients only for a limited
interval.
✓ DHCP clients are responsible for renewing their IP address before that
interval has expired, and must stop using the address once the interval has
expired, if they have not been able to renew it.
✓ DHCP is used for IPv4 and IPv6.

45 | P a g e
➢ For this Experiment we will use End Devices, like PCs, “Switch-2950” &
“Router-1841”.

Step 1 – Choose “Networking Devices” -> “Routers” and select “Router-1841”.


After selecting click on the main area, a router will be added.

Router0 Will be Added into the Main-Area.

Step 2 – Just Like Routers, Now Add a Switch into the Main-Area

46 | P a g e
Step 3 – Select “End Devices” and then select the “PC” and click on the main
area.

PC0 Will be Added into the Main-


Area.

Step 4 – Repeat the above Process to add Four More PCs.

Step 5 – Again Select “End Devices” and then select the “SERVER” and click on
the main area.

47 | P a g e
Step 6 – Now Select “Connections” and then click on “Automatically choose
Connection Type”.

Step 7 – Draw Connections.

Fig A
A

Step 8 – Double Click on a Router, a box will appear. After that click on “Config”
Tab.

48 | P a g e
Step 9 – In “Config” Tab, We have to Config the Router With Switch.
According to the Network, User have to Manually figure out which Interface
Port (FastEthernet0/0, FastEthernet1/0, Serial 2/0, … ) is Connected to the
Switch.
In Fig A. Router0 is Connected to Switch via FastEthernet0/0. Therefore,
Config will be like :–

Fig.1.1 Config For FastEthernet0/0

We can also configure the router from the command-line interface (CLI).
Following Figure 1.2, show the Implementation of Config of FastEthernet0/0
using CLI Commands.

49 | P a g e
Fig1.2 CLI Config Commands on FastEthernet0/0

Step 10 – Double Click on the Server, a box will appear. After that click on
“Services” Tab and then select “DHCP”.

50 | P a g e
Step 11 – In DHCP Service Tab, Config DHCP Service for the Network as -

Fig1.3 Config of
DHCP Service
on Server

Step 12 – After “DHCP Service” is Configured, click on “Desktop” Tab and then
select “IP configuration”.

Step 13 – Write the IP Address of your network and click at the subnet mask
field. Subnet Mask will appear automatically. Also Input the Default Gateway.

Step 14 – Double Click on a PC, a box will appear. After that click on “Desktop”
Tab and then select “IP configuration”.

51 | P a g e
Step 15 – In “IP configuration” Tab Click on the “DHCP”, IP Address, Subnet
Mask and Default Gateway will be automatically Assigned.

Fig1.4 PC0 Config

Fig1.5 PC1 Config

Step 16 – DHCP Server/Network is Formed and Configured.

52 | P a g e
Fig B

In Fig B, We can Clearly See that –


PC0 is assigned IP Address of 10.0.0.2
PC1 is assigned IP Address of 10.0.0.3
PC2 is assigned IP Address of 10.0.0.4
PC3 is assigned IP Address of 10.0.0.5
PC4 is assigned IP Address of 10.0.0.6

Server0 is assigned IP Address of 10.0.0.10


Default Gateway is 10.0.0.1

Step 17 – Select “Add Simple Message”. Drag and Drop the Message to the
Source Device and then to the Destination Device and observe the Output of
“Realtime” tab.

In above Scenario –
5) My Source Device is PC0 and My Destination Device is PC1.
Status is returned “Successful”.
6) My Source Device is PC0 and My Destination Device is Router0.
Status is returned “Successful”.
7) My Source Device is PC0 and My Destination Device is Server0.
Status is returned “Successful”.

Step 18 – We can also make use of the “Simulation Mode”. Once the Message is
Drag and Drop to Source and Destination Device respectively, choose the “Auto
Capture/Play”.

53 | P a g e
Step 19 – Observe the Path of the Message from source to hub, then to all
devices, and then from destination to hub then back to the source.

54 | P a g e
Packets
Receiving at
Destination is
showed by
“Green Tick”

Conclusion – Connection is established successfully between Source and


Destination Device

Experiment – 6 -Configuration of Domain Name Server (DNS).

• DNS is a host name to IP address translation service. DNS is a distributed


database implemented in a hierarchy of name servers. It is an application
layer protocol for message exchange between clients and servers.
• Every host is identified by the IP address but remembering numbers is very
difficult and also the IP addresses are not static therefore a mapping is
required to change the domain name to IP address. Therefore, DNS is used
to convert the domain name of the websites to their numerical IP address.
➢ For this Experiment we will use End Devices, like PCs, Server And
“Switch-2950-24”.
Step 1 – Choose “Networking Devices” -> “Switches” and select “Switch-2950-
24”. After selecting click on the main area, a switch will be added.

Switch0 Will be Added into the Main-Area.

55 | P a g e
Step 2 – Select “End Devices” and then select the “PC” and click on the main
area.

PC0 Will be Added into the Main-Area.

Step 3 – In “End Devices” Tab then select the “SERVER” and click on the main
area.

PC0 Will be Added into the Main-Area.

Step 4 – Now Select “Connections” and then click on “Automatically choose


Connection Type”.

Step 5 – Draw Connections.

Step 6 – Double Click on a PC, a box will appear. After that click on “Desktop”
Tab and then select “IP configuration”.
56 | P a g e
Step 7 – Write the IP Address and DNS Server IP and click at the subnet mask
field. Subnet Mask will appear automatically.

Step 8 – Double Click on the Server, a box will appear. After that click on
“Desktop” Tab and then select “IP configuration”.

57 | P a g e
Step 9 – Write the IP Address of your network and click at the subnet mask field.
Subnet Mask will appear automatically. Also Input the Default Gateway.

Step 10 – Now click on “Services” Tab and then select “DNS”.

58 | P a g e
Step 11 – In DNS Service Tab, Config DNS Server for the Network IP and map
with domain as -

Step 12 – Now in “Services” Tab and then select “HTTP”.

59 | P a g e
Step 13 – In HTTP Service Tab, add a new File Named – “index.html” and a
simple HTML Code in it and Save it.

Step 14 – In HTTP Service Tab, Turn on The Service.

Step 15 – Again Double Click on a PC, a box will appear. After that click on
“Desktop” Tab and then select “Web Browser”.

60 | P a g e
Step 16 – In the Web Browser, type the DNS Name, which was configured in
“Step 11” and Verify the Output.

Conclusion – A DNS Connection is established successfully.

Experiment 7- Introduction of NS3 used for wireless adhoc and sensor


networks.

NS-3 is a discrete-event network simulator, targeted primarily for research and


educational use. NS-3 is free software, licensed under the GNU GPLv2 license,
and is publicly available for research, development, and use. The goal of the ns-3
project is to develop a free and open source simulation environment suitable for
networking research: it should be aligned with the simulation needs of modern
networking research and should encourage community contribution, peer review,
and validation of the software. NS-3 is maintained by a worldwide team of
volunteer maintainers.

Simulation models: -The ns-3 project is committed to building a solid simulation


core that is well documented, easy to use and debug, and that caters to the needs
of the entire simulation workflow, from simulation configuration to trace
collection and analysis. Furthermore, the ns-3 software infrastructure encourages
the development of simulation models that are sufficiently realistic to allow ns-3
to be used as a realtime network emulator, interconnected with the real world, and
that allows many existing real-world protocol implementations to be reused
within ns-3. The ns-3 simulation core supports research on both IP and non-IP
based networks. However, the large majority of its users focuses on wireless/IP
61 | P a g e
simulations which involve models for Wi-Fi, LTE, or other wireless systems for
layers 1 and 2. Other popular research topics include TCP performance and
mobile ad hoc routing protocol performance.

NS-3 also supports a real-time scheduler that facilitates a number of “simulation-


in-the-loop” use cases for interacting with real systems. For instance, users can
emit and receive ns-3-generated packets on real network devices, and ns-3 can
serve as an interconnection framework to add link effects between virtual
machines. Another emphasis of the simulator is on the reuse of real application
and kernel code. The Direct Code Execution framework allows users to run C or
C++-based applications or the Linux kernel networking stack within ns-3.

Simulation Workflow: - The general process of creating a simulation can be


divided into several steps:

1. Topology definition: To ease the creation of basic facilities and define their
interrelationships, ns-3 has a system of containers and helpers that
facilitates this process.
2. Model development: Models are added to simulation (for example, UDP,
IPv4, point-to-point devices and links, applications); most of the time this
is done using helpers.
3. Node and link configuration: models set their default values (for example,
the size of packets sent by an application or MTU of a point-to-point link);
most of the time this is done using the attribute system.
4. Execution: Simulation facilities generate events, data requested by the user
is logged.
5. Performance analysis: After the simulation is finished and data is available
as a time-stamped event trace. This data can then be statistically analysed
with tools like R to draw conclusions.
6. Graphical Visualization: Raw or processed data collected in a simulation
can be graphed using tools like Gnuplot, matplotlib or XGRAPH.

Ns3 gives us special features which can be used for real life integrations. Some of
these features are :

1. Tracing of the nodes: NS3 allows us to trace the routes of the nodes which
helps us to know how much data is send or received. Trace files are
generated to monitor these activities.
2. NetAnim: It stands for Network Animator.It is an animated version of how
network will look in real and how data will be transferred from one node to
other.

62 | P a g e
3. Pcap file: NS3 helps to generate pcap file which can be used to get all
information of the packets (e.g., Sequence number, Source IP, destination
IP, etc). These pcaps can be seen using a software tool known as wireshark.
4. gnuPlot: GnuPlot is used to plot graphs from the data which we get from
trace file of NS3. Gnuplot gives more accurate graph compare to other
graph making tools and also it is less complex than other tools.

This is a brief introduction to NS3. Basically NS3 can perform most of the
activities which are performed in the network in reality.

Installing ns3 on Ubuntu: -ns3 needs so many dependencies, developmental


libraries, drivers, etc. so install all those
$] sudo apt update
$] sudo apt upgrade

Download the ns3 package from https://www.nsnam.org


I have used ns version 3.27 and the file looks like ns-allinone-3.27.tar.bz2.
You can unzip it in two ways. Right click over the above file and extract it to the
folder (/home/username/). Most preferred place to install is to put it in the home
folder.

Or

go to the location of the download folder and copy the file to the home folder and
open the terminal and give the command

$] tar jxvf ns-allione-3.27.tar.bz2


$] cd ns-allinone-3.27/
$] ./build.py --enable-examples --enable-tests

This will take some time for getting compiled and build. To check any application
is running. do the following steps
$] cd ns-3.27/
$] ./waf --run hello-simulator
This will print the hello Simulator which
indicates that ns3 is installed successfully.

63 | P a g e
Experiment – 8 - Implementation of script to create fixed wireless nodes.

Code
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"

using namespace ns3;


NS_LOG_COMPONENT_DEFINE ("FirstScriptExample");
int
main (int argc, char *argv[])
{
CommandLine cmd (__FILE__);
cmd.Parse (argc, argv);
Time::SetResolution (Time::NS);
LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO);
LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO);
NodeContainer nodes;
nodes.Create (2);
PointToPointHelper pointToPoint;
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
NetDeviceContainer devices;
devices = pointToPoint.Install (nodes);
InternetStackHelper stack;
stack.Install (nodes);
Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer interfaces = address.Assign (devices);
UdpEchoServerHelper echoServer (9);
ApplicationContainer serverApps = echoServer.Install (nodes.Get (1));
serverApps.Start (Seconds (1.0));
serverApps.Stop (Seconds (10.0));
UdpEchoClientHelper echoClient (interfaces.GetAddress (1), 9);
echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
ApplicationContainer clientApps = echoClient.Install (nodes.Get (0));
clientApps.Start (Seconds (2.0));
clientApps.Stop (Seconds (10.0));
Simulator::Run ();
Simulator::Destroy ();
return 0;
}

64 | P a g e
Output

Experiment – 9- Implementation of script to create the dynamic number of


nodes.

Code

#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"

using namespace ns3;


NS_LOG_COMPONENT_DEFINE ("FirstScriptExample");
int
main (int argc, char *argv[])
{
CommandLine cmd (__FILE__);
65 | P a g e
cmd.Parse (argc, argv);
Time::SetResolution (Time::NS);
LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO);
LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO);
NodeContainer nodes;
nodes.Create (3);
PointToPointHelper pointToPoint;
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
NetDeviceContainer devices, devices1;
devices = pointToPoint.Install (nodes.Get(0),nodes.Get(1));
devices1 = pointToPoint.Install (nodes.Get(2),nodes.Get(1));
InternetStackHelper stack;
stack.Install (nodes);
Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer interfaces = address.Assign (devices);
Ipv4InterfaceContainer interfaces1 = address.Assign (devices1);
UdpEchoServerHelper echoServer (90);
ApplicationContainer serverApps = echoServer.Install (nodes.Get (1));
serverApps.Start (Seconds (1.0));
serverApps.Stop (Seconds (10.0));
UdpEchoClientHelper echoClient (interfaces.GetAddress (1), 90);
echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
ApplicationContainer clientApps = echoClient.Install (nodes.Get (0));
clientApps.Start (Seconds (2.0));
clientApps.Stop (Seconds (10.0));
UdpEchoClientHelper echoClient1 (interfaces1.GetAddress (1), 90);
echoClient1.SetAttribute ("MaxPackets", UintegerValue (1));
echoClient1.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
echoClient1.SetAttribute ("PacketSize", UintegerValue (1024));
ApplicationContainer clientApps1 = echoClient1.Install (nodes.Get (2));
clientApps.Start (Seconds (2.0));
clientApps.Stop (Seconds (10.0));
Simulator::Run ();
Simulator::Destroy ();
return 0;
}

66 | P a g e
Output

67 | P a g e
Experiment – 10 -Implementation of script to create star topology.

Code
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/netanim-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"
#include "ns3/point-to-point-layout-module.h"

using namespace ns3;


NS_LOG_COMPONENT_DEFINE ("Star");
int
main (int argc, char *argv[])
{
CommandLine cmd (__FILE__);
cmd.Parse (argc, argv);
Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (137));
Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue ("14kb/s"));
uint32_t nSpokes = 8;
cmd.AddValue ("nSpokes", "Number of nodes to place in the star", nSpokes);
cmd.Parse (argc, argv);
NS_LOG_INFO ("Build star topology.");
PointToPointHelper pointToPoint;
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
PointToPointStarHelper star (nSpokes, pointToPoint);
NS_LOG_INFO ("Install internet stack on all nodes.");InternetStackHelper internet;
star.InstallStack (internet);
NS_LOG_INFO ("Assign IP Addresses.");
star.AssignIpv4Addresses (Ipv4AddressHelper ("10.1.1.0", "255.255.255.0"));
NS_LOG_INFO ("Create applications.");
uint16_t port = 50000;
Address hubLocalAddress (InetSocketAddress (Ipv4Address::GetAny (), port));
PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", hubLocalAddress);
ApplicationContainer hubApp = packetSinkHelper.Install (star.GetHub ());
hubApp.Start (Seconds (1.0));
hubApp.Stop (Seconds (10.0));
OnOffHelper onOffHelper ("ns3::TcpSocketFactory", Address ());
onOffHelper.SetAttribute ("OnTime", StringValue
("ns3::ConstantRandomVariable[Constant=1]"));
onOffHelper.SetAttribute ("OffTime", StringValue
("ns3::ConstantRandomVariable[Constant=0]"));
ApplicationContainer spokeApps;
for (uint32_t i = 0; i < star.SpokeCount (); ++i)
{
AddressValue remoteAddress (InetSocketAddress (star.GetHubIpv4Address (i), port));
onOffHelper.SetAttribute ("Remote", remoteAddress);
68 | P a g e
spokeApps.Add (onOffHelper.Install (star.GetSpokeNode (i)));
}
spokeApps.Start (Seconds (1.0));
spokeApps.Stop (Seconds (10.0));
NS_LOG_INFO ("Enable static global routing.");
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
NS_LOG_INFO ("Enable pcap tracing.");
pointToPoint.EnablePcapAll ("star");
NS_LOG_INFO ("Run Simulation.");
Simulator::Run ();
Simulator::Destroy ();
NS_LOG_INFO ("Done.");
return 0;
}
Output

69 | P a g e

You might also like