Files: exercises-network-performance.txt

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

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