Files: exercises-network-analysis.txt

File exercises-network-analysis.txt, 3.4 KB (added by hervey, 9 years ago)

Exercises on network and local analysis in text

Line 
1APRICOT 2010: Kuala Lumpur, Malaysia
2
3LOCAL NETWORK ANALYSIS TOOLS
4
5Notes:
6------
7* Commands preceded with "$" imply that you should execute the command as
8  a general user - not as root.
9* Commands preceded with "#" imply that you should either be root, or use
10  sudo as a regular user.
11* Commands with more specific command lines (e.g. "RTR-GW>" or "mysql>")
12  imply that you are executing commands on remote equipment, or within
13  another program.
14
15Exercises Local Analysis
16------------------------
17
181. lsof and netstat
19   ----------------
20
21See what services are running on your machine. You can use the
22presentation as a reference.
23
24Or, utilize "man lsof", "man netstat", "lsof -h" and "netstat -h" to see
25the available options (there are a lot!). Remember to use
26sudo when using lsof and netstat to give yourself necessary permissions
27to view everything.
28
29* Using lsof, what IPv4 services are listening on your machine?
30
31* Using netstat, what IPv4 and IPv6 services are listening on your machine?
32
33
342. tcpdump and Wireshark
35   ---------------------
36
37To use tcpdump you need to use sudo, or be root. To use wireshark you need
38to open a terminal and use sudo as a normal user (i.e., userid "inst"):
39
40Use tcpdump like this:
41
42        $ sudo tcpdump -i lo -A -s1500 -w /tmp/tcpdump.log
43
44Now, generate some traffic on your lo interface in another terminal.
45
46For example:
47
48        $ ping localhost
49        $ ssh localhost
50 
51etc. Afterwords press CTRL-C to terminate the tcpdump session.
52
53Note: ssh generates much more "interesting" output.
54
55Now install wireshark:
56
57        $ sudo apt-get install wireshark
58
59Once installed, in another terminal as a normal user ("mgmt") open
60wireshark like this:
61
62        $ sudo wireshark -r /tmp/tcpdump.log
63
64Now you can play with the wireshark interface to start and understand
65how it works. Can you figure out how to follow packets by protocol?
66By Session?
67
68Now try something like this:
69
70        $ sudo rm /tmp/tcpdump.log
71        $ sudo tcpdump -i eth1 -A -s1500 -w /tmp/tcpdump.log
72
73In another terminal do:
74
75        $ ftp limestone.uoregon.edu
76 
77        Connected to limestone.uoregon.edu.
78        220 FTP Server ready.
79        Name (limestone.uoregon.edu:sysadmin): anonymous
80        Password: <anything you want>
81        ftp> exit
82
83End the tcpdump session in the other terminal (CTRL-C). Now view the
84contents of the log file:
85
86        $ sudo wireshark -r /tmp/tcpdump.log
87
88Can you see your password? Sniffing unencrypted passwords on wireless
89lans is very easy with a tool like this.
90
91
923. Using iperf
93   -----------
94
95Use "man iperf" or "iperf -h" for help.
96
97First install iperf:
98
99        $ sudo apt-get install iperf
100
101Ask your neighbor to run:
102
103        $ iperf -s
104
105Connect to your neighbor's machine using:
106
107        $ iperf -c ipNeighbor
108
109How is the throughput between  your machines?
110
111Consider connecting both your PCs directly together (one cable,
112no switch). Use a private IP address on both machines, verify
113you can ping each other, then repeat the previous steps with
114your new connection. Has your throughput improved?
115
116If you have time continue playing with iperf options. If you have a
117remote PC running UNIX or Linux you might want to try installing iperf
118and testing your connection from the workshop lab to your remote
119machine.
120
121Some more things to try...
122
123* Test TCP using various window sizes (-2).
124
125* Verify TCP MSS (-m). How does this affect throughput? What is
126  Path MTU discovery?
127
128* Test with two parallel threads (-P) and compare the totals. Is
129  there any difference? Why?
130
131* Test with different packet sizes and the TCP_NODELAY (-N) option.
132