Sie sind auf Seite 1von 11

BITS, Pilani - Hyderabad Campus

CS F303 (Computer Networks)


Laboratory 1
2​nd​ Week of January, 2018

Aim:
a) To gain familiarity with the basic network commands.
b) To know the network elements.

General Tips:
● Login as ​ipc3​ user. Password is 3@ipc
● If any command is not installed on your system, do ​sudo apt-get update on the Terminal
followed by ​sudo apt-get install <command_name> ​to install it.
● To see more details about a command, type ​man <command_name> ​or ​<command_name> -h​.
● The screenshots values may (not) match with the paragraph contents.

Network Commands:
Run the following commands on your Terminal window.

1) Troubleshooting network hosts.


The syntax of ping command is
ping [...] destination
where [...] is the set of options and destination is the domain name.

Short for ​Packet InterNet Groper, ​the ping command is used to test the ability of your computer
to reach a specified destination computer. The ping command is usually used as a simple way to
verify that a computer can communicate over the network with another computer. The ping
utility is commonly used to check for network errors and works by sending ​ICMP
ECHO_REQUEST​ to network hosts.

Figure 1. Output of ping command


a) Ping two different machines, one within India and the other one outside India, and
observe the latency.
i) For example, bits-hyderabad.ac.in and ssa.gov
b) Does pinging www.google.com and google.com make any difference?
c) What happens when you enter “ping <ip address>”?
d) Explore these options in ping: -c, -i

2) Understanding about network interfaces


a) ifconfig [options]
ifconfig is used to configure the network interfaces. It is used at boot time to set up interfaces as
necessary. After that, it is usually only needed for debugging purpose.

If no arguments are given, ​ifconfig​ displays the status of the currently active interfaces.

Figure 2. The output of “ifconfig” command

i) What is the IPv4 address of your computer?


ii) What is the MAC/HW address of your NIC card?
iii) What is a loopback interface?
iv) What is the IPv4 address of a loopback interface?
If a single interface argument is given, it displays the status of the given interface only.

Figure 3. The output displayed on running “ifconfig eth0”

If a single ​-a​ argument is given, it displays the status of all interfaces, even those that are down.

Figure 4. The output displayed on running “ifconfig -a”

b) sudo ifconfig eth0 down


The above command will bring the ethernet interface down, meaning, the system would be
disconnected from the network.
i) After running the above command, try to ping any network host. What is the output
observed?

c) sudo ifconfig eth0 up


This command will call DHCP service which is involved in obtaining an IP address.

d) ifplugstatus
The ifplugstatus command will tell you whether a cable is plugged into a network interface or
not. It isn’t installed by default on Ubuntu. Use the following command to install it:
sudo apt-get install ifplugd

Figure 5. Installing “ifplugd” in Ubuntu system

The output of ifplugstatus command when the cable is plugged.

Figure 6. The output of “ifplugstatus” command


i) Remove the ethernet cable (you can check it in your laptop). What is ifplugstatus output?
ii) Bring the ethernet interface down. What is ifplugstatus output?

3) DNS Tool

The syntax for nslookup command is


nslookup [...] [server]
where [...] is the set of options and [server] is the domain name.

DNS stands for Domain Name Server. It is a database which stores URL and its corresponding
IPv4 addresses. The database also stores several other information (​which you will learn in Lab
3​). ​nslookup​ is a program to query the DNS server for IP addresses.
nslookup has two modes: interactive and noninteractive. Interactive mode allows the user to
query name servers for information about various domain names. Non-interactive mode is used
to print just the name and requested information for a host or a domain.
Figure 7. Output of “nslookup” command

To work in interactive mode, type only “nslookup” in the command prompt. Thereafter, type the
URL name and press “ENTER”.

i) Find the IP addresses of the following machines:


a) bits-hyderabad.ac.in
b) swd.bits-hyderabad.ac.in
c) Sites.bits-hyderabad.ac.in
d) id.bits-hyderabad.ac.in
ii) Can a website have more than one IP address?

4) Finding all the intermediate network systems.

The syntax of ​traceroute​ command is


traceroute [...] host [...]
[...] is the set of options.

It isn’t installed by default on Ubuntu. Use the following command to install it:

sudo apt-get install traceroute

traceroute is a command used to display the intermediate nodes through which a packet flows
from a source location to a destination location. A program capable of doing the same in
Microsoft Windows is ​tracert​.

Figure 8. The output of “traceroute” command

i) What is the IP address of the first hop router?


ii) Observe the latency for every hop.
iii) Try a different website and note the IP address of the first hop ISP
iv) Do you see * in any of the outputs?
v) What does these options do: -q, -m, -n,
vi) How to change th packet size of a probe packet?

5) To copy files from/to a remote host.

The syntax of scp command is


scp [...] [[user@]host1:]file1 ... [[user@]host2:]file2
where [...] is the set of options.
scp allows files to be copied between different hosts.

For example,
“scp user1@host1:/home/user1/file.txt /home/your_username”
will copy the file “file.txt” (located at /home/user1) of the remote host ​host1 to your local
directory (/home/your_username).

To download the tar file (CN_Lab_Test1.tar) from host 172.16.3.181 to your system, the
command is
scp ipc5@172.16.3.181:/home/ipc5/CN_Lab_Test1.tar /home/ipc3/
After typing the above command, enter the password ​legrand5

Figure 9. Ubuntu Terminal Output

To upload a tar file (2015A7PS0123H.tar) from your local directory to a remote directory, the
command is
scp /home/ipc3/2015A7PS0123H.tar ipc5@172.16.3.181:/home/ipc5/CN_Labs

Figure 10. Ubuntu Terminal Output

i) Try to download the folder (/home/ipc5/CN_Lab_Test2) from host 172.16.3.181 to your local
PC.
ii) Try to upload your own folder to a remote host.
(The folder and all its contents including sub-folders should be copied).
6) To test the speed of internet connection. Run the following commands for installing
speedtest-cli package.

sudo apt-get install python-pip


sudo pip install speedtest-cli

After installation, type “speedtest-cli” in the Terminal and press enter. The output should be similar to
the figure below.

Figure 11. Ubuntu Terminal Output


Network Elements

Figure 12. Wireless Router (LINKSYS)

Figure 13. Wireless Router ports


Figure 14. Ethernet Cable Figure 15. A view from the top (RJ-45 connector)

Figure 16. RJ-45 Crimping Tool

Figure 17. Crimping the cable


Figure 18. Wired NIC (Network Interface Card)

Figure 19. Wireless NIC


Figure 20. Ethernet Switch (Cisco)

Figure 21. Router (Cisco)

References:
1. Linux ‘man pages’ available at ​http://linux.die.net/man/
2. http://www.computerhope.com/
3. http://www.webupd8.org/2014/02/how-to-test-internet-speed-via-command.html
4. https://en.wikipedia.org/wiki/Wireless_router​ (Linksys router)
5. https://www.washington.edu/itconnect/connect/uw-networks/uw-housing/wireless-routers-in-
uw-residence-hall-rooms/​ (Wireless Router ports)
6. http://www.groundcontrol.com/galileo/ch5-ethernet.htm​ (Ethernet cables & accessories)
7. http://www.tigerdirect.com/applications/SearchTools/item-details.asp?EdpNo=522989 (Wired
NIC)
8. http://chauncy-ict.pbworks.com/w/page/9660241/Network%20Interface%20Card%20and%20T
wister%20Pair%20Cable​ (Laptop Wireless NIC card)
9. http://www.microd.eu/store/cisco-catalyst-48-ethernet-10100-ports-poe-4-sfp-gigabit-ethernet
-ports-network-switch-ws-c3560v2-48ps-s​ (Ethernet Switch)
10. http://www.cisco.com/c/en/us/products/routers/1921-integrated-services-router-isr/index.htm
l​ (Router)

Das könnte Ihnen auch gefallen