![]() |
![]() ![]() ![]() |
![]() |
![]() |
|||||
![]() |
||||||||
![]() |
![]() |
![]() |
||||||
TCP Dump TCPDump is a tool for network monitoring and data acquisition. It requires the libcap library. Both can be found here. Short Tutorial After compiling and making the source files (with libcap sharing the same root directory), there should be a tcpdump file ready for execution in the tcpdump directory. One has to be root to be able to run the program. The basic syntax is: tcpdump -i eth0 where eth0 is the interface that you wish to monitor packets on. This then squirts out loads of info onto the screen like as follows; 17:29:44.070670 802.1d config 8000.00:d0:79:95:98:03.8042
root 8000.00:50:80:f0:6a:03 pathcost 23 age 2 max 20 hello 2 fdelay 15
As you can see there's loads of crap going on there, and that's only about 5 seconds worth when nothing is happening! (for some reason it's connected to the BBC...??!?!). Various options exist: -c count : show count number of packets -e : show the link level header -q : print less protocol information -i iface : listen to interface iface, for example, eth0 -n : list numeric addresses and port numbers -N : show only the hostname instead of FQDN (Fully Qualified
Domain Name) -s X : capture X number of bytes from each packet -S : show absolute TCP sequence numbers -v and -vv : increases the amount of information. -vv
gives more information than -v
The number of bytes captured by defaultwhich is 68suffices for most purposes. -e and -q are useful for peeking into the link header and to get lessbut easy to readinformation on each packet, respectively. You may not be looking for all the packets that flow through your network. So, you can capture packets flowing through selective hosts. For this use tcpdumps filtering expressions, in which you can use "and", "or" and "not" to build up the filter you want. Some of the common filtering expressions are: type : type can be host, net or port,
the default is host src hostip : specify the IP address
of the originating host dst hostip : specify the IP address
of the destination host host hostip : specify the IP address
of the host, for which you want to monitor all packetsto and from src port : specify the source port
of the packets dst port : specify the destination
port of the packets port : specify the port, to monitor
packets to and from protocol : specify the protocol used by the packet, for example, TCP, IP, UDP, ICMP, ARP, RARP, etc Trying some examples tcpdump host 128.40.4.44 will capture all incoming and outgoing packets from the machine with IP 128.40.4.44 - in this case my laptop. tcpdump src 128.40.4.44 and dst pc56.hep.ucl.ac.uk will capture all packets moving from 128.40.4.44 to pc56.hep.ucl.ac.uk. Note the use of "and" here. You can also capture packets of specific protocols, as in: tcpdump tcp To capture all packets destined to a specific port, like ftp: tcpdump host 192.168.1.22 and port ftp or tcpdump host 192.168.1.22 and port 21 If you use a ports name like ftp, it must be defined in /etc/services. Alternatively, you can use the port number, 21 in this case.
Ethereal Ethereal is a GTK frontend for packet sniffers like tcpdump. It can classify output and generally make the output of TCPDump nicer. It can be found here.
|
||||||||
![]() |
![]() |
![]() |
||||||
![]() |
![]() |
![]() |
||||||
© 2001-2003, Yee-Ting Li, email: ytl@hep.ucl.ac.uk,
Tel: +44 (0) 20 7679 1376, Fax: +44 (0) 20 7679 7145 Room D14, High Energy Particle Physics, Dept. of Physics & Astronomy, UCL, Gower St, London, WC1E 6BT |
||||||||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |