Packet Capture
Packet Capture
packet sniffers
packet analysers
protocol analysers, and sometimes
even
traffic monitors
Systems and
Network Troubleshoo
Systems and
Network Troubleshoo
Systems and
Network Troubleshoo
tcpdump
Available everywhere
Windows: http://windump.polito.it/
Syntax also used by other programs (such as
Ethereal)
Often it is the only tool available, so good to
know
Works by putting network interface into
promiscuous mode
Systems and
Network Troubleshoo
Systems and
Network Troubleshoo
Very useful can filter and analyse this later with tcpdump,
ethereal or other tools
but you cannot see what you are capturing till later!
Systems and
Network Troubleshoo
Network Troubleshoo
Systems and
Network Troubleshoo
tcpdump ip
tcpdump tcp
tcpdump ip proto ospf
This will catch DNS name lookups,
but not zone transfers (which use
tcp):
tcpdump udp port 53
Systems and
Network Troubleshoo
10
Systems and
Network Troubleshoo
11
IP Header
Version
Words
Time to Live
Source Address
Destination Address
Padding
Options (0 to 40 bytes)
Your data starts here
31
28
Fragmentation Offset
Header Checksum
Protocol
5-16
24
20
12
16
Total Length
Type of Service
Identification
2
3
8
IHL
DF
MF
Bits
TCP Header
Source Port
header
length
Reserved
URG
ACK
PSH
RST
SYN
FIN
Words
Acknowledgement Number
Window
Urgent Pointer
Checksum
Options (0 to 40 bytes)
5-15
Padding
Your data starts here
31
28
Sequence Number
24
Destination Port
20
16
12
Bits
UDP Header
31
16
Bits
Source Port
Destination Port
Length
Checksum
Your data starts here
Systems and
Network Troubleshoo
14
Systems and
Network Troubleshoo
15
Systems and
Network Troubleshoo
16
HTTP
tcpdump -nr ~/tmp/tcpdump.pcap port http
22:43:32.633636 192.168.25.9.14075 > 172.19.64.52.http: S
1015952778:1015952778(0) win 6144 <mss 1460> (DF)
22:43:32.633693 172.19.64.52.http > 192.168.25.9.14075: S
1929920485:1929920485(0) ack 1015952779 win 5840 <mss 1460>
(DF)
22:43:32.635828 192.168.25.9.14075 > 172.19.64.52.http: P
1:590(589) ack 1 win 6144 (DF)
22:43:32.635906 172.19.64.52.http > 192.168.25.9.14075: . ack
590 win 6479 (DF)
22:43:32.636758 172.19.64.52.http > 192.168.25.9.14075: P
1:217(216) ack 590 win 6479 (DF)
22:43:32.636982 172.19.64.52.http > 192.168.25.9.14075: F
217:217(0) ack 590 win 6479 (DF)
22:43:32.639080 192.168.25.9.14075 > 172.19.64.52.http: R
590:590(0) ack 217 win 0 (DF)
Systems and
Network Troubleshoo
17
format:
src > dst: flags data-seqno ack window urgent
options
Flags are some combination of S (SYN), F (FIN), P
(PUSH) or R (RST) or a single '.' (no flags).
The first time tcpdump sees a tcp 'conversation',
it prints the sequence number from the packet.
On subsequent packets of the conversation, the
difference between the current packet's sequence
number and this initial sequence number is printed.
Systems and
Network Troubleshoo
18
Window
TCP flow-control:
Systems and
Network Troubleshoo
19
Ethereal
King of the Packet Analysers!
Available for Linux, Unix,
Windows
Ethereal
Ethereal can read data captured by
tcpdump, e.g.,
$ ethereal r tcpdump.pcap
or File -> Open
Can capture data itself
Uses same filter language as
tcpdump
Systems and
Network Troubleshoo
21
Systems and
Network Troubleshoo
22
Systems and
Network Troubleshoo
23
Systems and
Network Troubleshoo
24
Systems and
Network Troubleshoo
25
Display Filters
Note the box at the bottom of Ethereal for display
filters
Select only some of the packets captured for display
see man ethereal and search for DISPLAY FILTER
SYNTAX
Different syntax than the syntax for capture filters
Example:
ip.src==172.19.64.52 and ip.dest==172.19.64.57
Systems and
Network Troubleshoo
26
Systems and
Network Troubleshoo
27
Shows:
percentages of protocols,
which machines generate most traffic
which traffic is purely local, which traffic comes
from outside, which traffic goes from inside to
outside of network
Systems and
Network Troubleshoo
28
Ntop RPM
Systems and
Network Troubleshoo
29
Switched Networks
Systems and
Network Troubleshoo
30
You are asked to check out a server on a switched network: what to do?
Use a small hub, and use a notebook running the capture software
Ethernet
Switch
mini-hub
Systems and
notebook
running capture software
Network Troubleshoo
31
Systems and
Network Troubleshoo
32