Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Ex - No 1

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Ex no 1: Learn to use commands like tcpdump, netstat, ifconfig, nslookup and traceroute.

Capture ping and


trace route PDUs using a network protocol analyzer and examine

Aim:
To learn the usage of commands like tcpdump, netstat, ifconfig, nslookup and traceroute. Capture ping and
traceroute PDUs using a network protocol analyzer and examine.

Algorithm:

Step 1: Start
Step 2: Open the terminal
Step 3: Issue the Commands tcpdump, netstat, ifconfig, nslookup and traceroute with proper syntax and
perform ping and traceroute operation .
Step 4:Read the result
Step 5:Get the output

SNo Command Purpose Syntax


1 tcpdump dump traffic on a network tcpdump -i any
2 netstat Print network connections, netstat -r
routing tables, interface netstat -i
statistics, masquerade
connections, and multicast
memberships
3 ifconfig configure a network ifconfig
interface
4 nslookup Nslookup is a program to nslookup google.com
query Internet domain name
servers. Nslookup has
two modes: interactive and
non-interactive.
Interactive mode allows
the user to query name
servers for information
about various hosts and
domains or to print a list of
hosts in a domain. Non-
interactive mode is used to
print just the name and
requested information for a
host or domain.
5 traceroute print the route packets trace traceroute google.com
to network host
6 Ping send ICMP ping google.com
ECHO_REQUEST to
network hosts
Output:
1.tcp dump
tcpdump -i any >a.txt (the output is redirected to a.txt)
02:54:34.766681 IP6 fe80::3cf4:26ff:fe43:ccab > ff02::1: ICMP6, router advertisement, length 64
02:54:34.767405 IP 192.168.1.101.58668 > 192.168.1.1.domain: 57139+ PTR?
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.f.f.ip6.arpa. (90)
02:54:34.770630 IP 192.168.1.1.domain > 192.168.1.101.58668: 57139 NXDomain 0/0/0 (90)
02:54:34.770828 IP 192.168.1.101.40513 > 192.168.1.1.domain: 14252+ PTR?
b.a.c.c.3.4.e.f.f.f.6.2.4.f.c.3.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa. (90)
02:54:34.773912 IP 192.168.1.1.domain > 192.168.1.101.40513: 14252 NXDomain 0/0/0 (90)
02:54:34.774116 IP 192.168.1.101.56139 > 192.168.1.1.domain: 10338+ PTR? 1.1.168.192.in-addr.arpa. (42)
02:54:34.777183 IP 192.168.1.1.domain > 192.168.1.101.56139: 10338 NXDomain 0/0/0 (42)
02:54:34.777346 IP 192.168.1.101.40647 > 192.168.1.1.domain: 25219+ PTR? 101.1.168.192.in-addr.arpa.
(44)
02:54:34.780386 IP 192.168.1.1.domain > 192.168.1.101.40647: 25219 NXDomain 0/0/0 (44)

2.netstat
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.122.0 * 255.255.255.0 U 00 0 virbr0
192.168.0.0 * 255.255.0.0 U 00 0 wlan0
default 192.168.1.1 0.0.0.0 UG 00 0 wlan0
[root@localhost ~]#

3.ifconfig
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 6C:3B:E5:10:5C:11
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:20 Memory:f7c00000-f7c20000

lo Link encap:Local Loopback


inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:194 errors:0 dropped:0 overruns:0 frame:0
TX packets:194 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:10244 (10.0 KiB) TX bytes:10244 (10.0 KiB)

virbr0 Link encap:Ethernet HWaddr 52:54:00:E6:A7:03


inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

wlan0 Link encap:Ethernet HWaddr 00:8E:F2:8A:E0:8A


inet addr:192.168.1.101 Bcast:192.168.255.255 Mask:255.255.0.0
inet6 addr: 2409:4072:38c:7f80:28e:f2ff:fe8a:e08a/64 Scope:Global
inet6 addr: fe80::28e:f2ff:fe8a:e08a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:16855 errors:0 dropped:0 overruns:0 frame:0
TX packets:10894 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:16588986 (15.8 MiB) TX bytes:1475038 (1.4 MiB)
4.traceroute google.com
[root@localhost ~]# traceroute google.com
traceroute to google.com (172.217.163.78), 30 hops max, 60 byte packets
1 192.168.1.1 (192.168.1.1) 4.870 ms 4.803 ms 4.757 ms
2 ***
3 10.71.201.82 (10.71.201.82) 379.988 ms 10.71.201.74 (10.71.201.74) 379.917 ms 380.296 ms
4 172.25.55.205 (172.25.55.205) 380.254 ms 379.772 ms 379.707 ms
5 172.26.56.79 (172.26.56.79) 379.664 ms 379.572 ms 379.547 ms
6 172.25.8.7 (172.25.8.7) 379.450 ms 372.567 ms 372.538 ms
7 ***
8 ***
9 ***
10 72.14.217.58 (72.14.217.58) 162.217 ms 72.14.217.254 (72.14.217.254) 162.202 ms 162.126 ms
11 * * *
12 216.239.42.237 (216.239.42.237) 426.763 ms 72.14.237.164 (72.14.237.164) 106.196 ms 216.239.42.237
(216.239.42.237) 39.846 ms
13 maa05s02-in-f14.1e100.net (172.217.163.78) 40.925 ms 408.176 ms 108.170.253.119 (108.170.253.119)
96.572 ms
[root@localhost ~]#

5.ping google.com
[root@localhost ~]# ping google.com
PING google.com (172.217.163.78) 56(84) bytes of data.
64 bytes from maa05s02-in-f14.1e100.net (172.217.163.78): icmp_seq=1 ttl=114 time=42.1 ms
64 bytes from maa05s02-in-f14.1e100.net (172.217.163.78): icmp_seq=2 ttl=114 time=40.6 ms
64 bytes from maa05s02-in-f14.1e100.net (172.217.163.78): icmp_seq=3 ttl=114 time=39.2 ms
64 bytes from maa05s02-in-f14.1e100.net (172.217.163.78): icmp_seq=4 ttl=114 time=45.8 ms
64 bytes from maa05s02-in-f14.1e100.net (172.217.163.78): icmp_seq=5 ttl=114 time=43.9 ms
^C
--- google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4675ms
rtt min/avg/max/mdev = 39.289/42.373/45.858/2.331 ms
Result:
Thus the commands are successfully executed and verified.

You might also like