http://kb.pert.geant.net/PERTKB/TcpdumpExamples http://synjunkie.blogspot.com.es/2007/12/fun-with-tcpdump.html
Curs: | DissenyXarxesLinux, LinuxAdministracioAvancada, SeguretatXarxesInformàtiques |
Fitxers: | Protocols_de_xarxes_UNIX.pdf (Protocols_de_xarxes_UNIX.odp) |
Repositori SVN: | http://[email protected]/svn/iceupc/DissenyXarxaLocalLinux, http://[email protected]/svn/iceupc/LinuxAdministracioAvan%c3%a7ada, http://[email protected]/svn/iceupc/SeguretatXarxesInform%C3%A0tiques |
Usuari: | anonymous |
Paraula de pas: | sense paraula de pas |
Autors: | Sergi Tur Badenas |
Tcpdump és una eina de xarxa que ens permet fer un volcat de tot el trànsit que passa per una targeta de xarxa. Tcpdump permet tant capturar el trànsit que li correspon a la màquina on s'executa, com el trànsit de la xarxa Local (promiscuous mode). Tal i com podeu consultar a la secció ifconfig el mode promiscu s'activa amb la comanda ifconfig de la següent manera:
$ ifconfig eth0 promisc $ ifconfig eth0 eth0 Link encap:Ethernet HWaddr 00:80:C8:F8:4A:51 inet addr:192.168.99.35 Bcast:192.168.99.255 Mask:255.255.255.0 UP BROADCAST RUNNING PROMISC MULTICAST MTU:1412 Metric:1 RX packets:190312 errors:0 dropped:0 overruns:0 frame:0 TX packets:86955 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:30701229 (29.2 Mb) TX bytes:7878951 (7.5 Mb) Interrupt:9 Base address:0x5000
A vegades la comanda ifconfig s'ha reportat que falla al mostrar l'estat PROMISCUOUS. Podem utilitzar la comanda alternativa:
$ ip link show
En veritat per executar tcpdump no cal posar la targeta en mode promiscu. Necessitem permisos de root per executar tcpdump perquè activa ell mateix el mode promiscu (si qualsevol usuari d'una màquina multiusuari pogués executar tcpdump, podria capturar el trànsit de la resta d'usuaris).
NOTA: Per deshabilitar el mode promiscu farem la comanda $ sudo ifconfig eth0 -promisc
NOTA: Una de les confusions més comunes és pensar que una xarxa Ethernet amb un Switch és un medi compartit i que simplement amb activar el mode promiscu podem capturar tot el trànsit de la xarxa. Això no és així ja que realment els switchs utilitzen el protocol ARP i les adreces MAC per tal de comunicar un port d'entrada amb el seu corresponent port de sortida sense enviar les dades a la resta de ports. Aquesta és la raó per la qual si posem la targeta en mode promiscu els únics paquets que detectem són aquells paquets que són de BROADCAST. Veieu el [http://www.tcpdump.org/faq.html#q4 FAQ de tcpdump]
tcmpdump per defecte escolta la interfície eth0:
$ sudo tcpdump tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes ....
Podem escoltar altres interfícies amb el paràmetre -i:
$ sudo tcpdump -i lo
Tcpdump només mostra la informació de les capçaleres (no mostra pas les dades dels paquets). Si volem veure les dades em d'utilitzar el paràmetre -X. Per exemple la captura d'uns pings:
$ sudo tcpdump icmp -i lo -X tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on lo, link-type EN10MB (Ethernet), capture size 96 bytes 11:56:32.875810 IP casa-linux.local > casa-linux.local: ICMP echo request, id 29505, seq 614, length 64 0x0000: 4500 0054 0000 4000 4001 b754 c0a8 0102 [email protected]@..T.... 0x0010: c0a8 0102 0800 22a7 7341 0266 500a 0647 ......".sA.fP..G 0x0020: 115d 0d00 0809 0a0b 0c0d 0e0f 1011 1213 .].............. 0x0030: 1415 1617 1819 1a1b 1c1d 1e1f 2021 2223 .............!"# 0x0040: 2425 2627 2829 2a2b 2c2d 2e2f 3031 3233 $%&'()*+,-./0123 0x0050: 3435 45 11:56:32.875828 IP casa-linux.local > casa-linux.local: ICMP echo reply, id 29505, seq 614, length 64 0x0000: 4500 0054 e590 0000 4001 11c4 c0a8 0102 [email protected] 0x0010: c0a8 0102 0000 2aa7 7341 0266 500a 0647 ......*.sA.fP..G 0x0020: 115d 0d00 0809 0a0b 0c0d 0e0f 1011 1213 .].............. 0x0030: 1415 1617 1819 1a1b 1c1d 1e1f 2021 2223 .............!"# 0x0040: 2425 2627 2829 2a2b 2c2d 2e2f 3031 3233 $%&'()*+,-./0123 0x0050: 3435 45
Podeu observar que les dades són sempre les mateixes en el cas d'un ping.
Podeu consultar l'article Depurant amb tcpdump per a veure més exemples d'ús de tcpdump.
Recursos:
Els filtres tcpdump més habituals són:
Els filtres es poden combinar utilitzant expressions lògiques (or, and...).
L'estructura de la sortida de la comanda tcpdump és la següent
$ src > dst: flags [dataseq ack window urgent options]
Exemple:
15:23:44.772291 IP 192.168.1.17.52798 > 85.Red-83-37-170.dynamicIP.rima-tde.net.65000: . ack 1791 win 7851 <nop,nop,timestamp 5520421 997821>
Anem a comprovar perquè protocols com TELNET són insegurs:
Instal·leu un servidor de telnet a les vostres màquines
$ sudo apt-get install telnetd
Un cop instal.lat, amb dos ordinadors feu el següent. En una terminal obriu una connexió remota amb telnet:
$ telnet ip_maquina_remota
I en un altre terminal executeu el següent:
$ sudo tcpdump -X port 23
Ara podeu comprovar que tot el que escriviu a telnet es pot capturar. Si a la màquina remota executeu:
$ hola -bash: hola: command not found
Comprovareu com el text es pot llegir a la finestra on teniu executant-se tcpdump:
...................... 12:13:15.859098 IP acacha.dyndns.org.telnet > casa-linux.local.52390: P 7:39(32) ack 6 win 1448 <nop,nop,timestamp 444348831 3490933> 0x0000: 4510 0054 d3d8 4000 4006 e365 c0a8 0103 [email protected]@..e.... 0x0010: c0a8 0102 0017 cca6 2241 5d60 2dca e78f ........"A]`-... 0x0020: 8018 05a8 0437 0000 0101 080a 1a7c 399f .....7.......|9. 0x0030: 0035 4475 2d62 6173 683a 2068 6f6c 613a .5Du-bash:.hola: 0x0040: 2063 6f6d 6d61 6e64 206e 6f74 2066 6f75 .command.not.fou 0x0050: 6e64 nd
Per comprovar com altres protocols com per exemple HTTP sense SSL són insegurs també podeu consultar l'article Ethereal (Wireshark).
A més existeixen eines com Ettercap o dsniff que encara fan més fàcil la captura de la informació de protocols com telnet. En el cas d'Ettercap fins i tot és possible interceptar la comunicació i escriure les nostres pròpies comandes en la comunicació interceptada.
Segons la IP
$ sudo tcpdump src 192.168.3.1
Resultat de la comanda
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 17:06:30.144058 IP ivanlt.local.52068 > sjc-not17.sjc.dropbox.com.http: Flags [P.], seq 2123340802:2123341137, ack 3421946409, win 1002, options [nop,nop,TS val 198861 ecr 696087661], length 335 17:06:30.145437 IP ivanlt.local.41506 > 192.168.204.1.domain: 56186+ PTR? 150.218.47.199.in-addr.arpa. (45) 17:06:30.145452 IP ivanlt.local.41506 > 192.168.0.4.domain: 56186+ PTR? 150.218.47.199.in-addr.arpa. (45) 17:06:30.390517 IP ivanlt.local.37623 > 192.168.204.1.domain: 18151+ PTR? 206.204.168.192.in-addr.arpa. (46) 17:06:30.492157 IP ivanlt.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 206.204.168.192.in-addr.arpa. (46) 17:06:30.492330 IP ivanlt.local.mdns > 224.0.0.251.mdns: 0*- [0q] 1/0/0 (Cache flush) PTR ivanlt.local. (66) 17:06:30.493117 IP ivanlt.local.38077 > 192.168.204.1.domain: 9739+ PTR? 1.204.168.192.in-addr.arpa. (44) 17:06:30.594531 IP ivanlt.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 1.204.168.192.in-addr.arpa. (44) 17:06:31.595353 IP ivanlt.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 1.204.168.192.in-addr.arpa. (44) 17:06:33.597952 IP ivanlt.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 1.204.168.192.in-addr.arpa. (44) 17:06:35.149612 ARP, Reply ivanlt.local is-at b8:70:f4:f8:83:3a (oui Unknown), length 28 17:06:35.496920 IP ivanlt.local.9994 > 192.168.204.1.domain: 54191+ PTR? 4.0.168.192.in-addr.arpa. (42) 17:06:35.598281 IP ivanlt.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 4.0.168.192.in-addr.arpa. (42) 17:06:36.599989 IP ivanlt.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 4.0.168.192.in-addr.arpa. (42) ^C17:06:38.428228 IP ivanlt.local.17500 > 255.255.255.255.17500: UDP, length 176
15 packets captured 25 packets received by filter 0 packets dropped by kernel
Segons la MAC:
$ sudo tcpdump ether src 50:43:A5:AE:69:55
$ sudo tcpdump host 192.168.3.2
$ sudo tcpdump dst net 192.168.3.0
$ sudo tcpdump src net 192.168.3.0 mask 255.255.255.240 $ sudo tcpdump src net 192.168.3.0/28
Exemple:
$ sudo tcpdump dst net 192.168.204.0/24 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 17:03:16.335172 IP zenbook.local.17500 > 192.168.204.255.17500: UDP, length 216 17:03:16.335953 IP joel-ESPRIMO-P.local.56586 > 192.168.204.1.domain: 36784+ PTR? 255.204.168.192.in-addr.arpa. (46) 17:03:16.336355 IP 192.168.204.1.domain > joel-ESPRIMO-P.local.56586: 36784 NXDomain 0/0/0 (46) 17:03:16.625991 IP alumne-pc.local.17500 > 192.168.204.255.17500: UDP, length 134
Per a capturar un port en concret:
$ sudo tcpdump port 80 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 17:06:39.112873 IP acacha.org.http > zenbook.local.56077: Flags [F.], seq 1284140816, ack 789565095, win 300, options [nop,nop,TS val 160399988 ecr 1161362], length 0 17:06:39.150542 IP zenbook.local.56077 > acacha.org.http: Flags [.], ack 1, win 661, options [nop,nop,TS val 1162640 ecr 160399988], length 0 17:06:44.710573 IP zenbook.local.56077 > acacha.org.http: Flags [F.], seq 1, ack 1, win 661, options [nop,nop,TS val 1164030 ecr 160399988], length 0 17:06:44.989416 IP acacha.org.http > zenbook.local.56077: Flags [.], ack 2, win 300, options [nop,nop,TS val 160401459 ecr 1164030], length 0 ^C 4 packets captured 4 packets received by filter 0 packets dropped by kernel
Per a capturar un port de destinació:
$ sudo tcpdump dst port 80 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 17:07:57.167546 IP zenbook.local.44894 > muc03s02-in-f24.1e100.net.http: Flags [S], seq 272133991, win 14600, options [mss 1460,sackOK,TS val 1182144 ecr 0,nop,wscale 6], length 0 17:07:57.167632 IP zenbook.local.44895 > muc03s02-in-f24.1e100.net.http: Flags [S], seq 1672274543, win 14600, options [mss 1460,sackOK,TS val 1182144 ecr 0,nop,wscale 6], length 0 17:07:57.609229 IP zenbook.local.44894 > muc03s02-in-f24.1e100.net.http: Flags [.], ack 1628885750, win 229, options [nop,nop,TS val 1182254 ecr 2730205201], length 0 17:07:57.609257 IP zenbook.local.44895 > muc03s02-in-f24.1e100.net.http: Flags [.], ack 1635736931, win 229, options [nop,nop,TS val 1182254 ecr 2730205201], length 0 4 packets captured 4 packets received by filter 0 packets dropped by kernel
Per a capturar un port d'origen:
$ sudo tcpdump src port 23
Protocol IP:
$ sudo tcpdump ip tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 17:03:26.738451 IP joel-ESPRIMO-P.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 235.203.168.192.in-addr.arpa. (46) 17:03:26.739699 IP webmaster-asus.local.51707 > 192.168.204.1.domain: 54211+ PTR? 251.0.0.224.in-addr.arpa. (42) 17:03:26.740208 IP 192.168.204.1.domain > webmaster-asus.local.51707: 54211 NXDomain 0/0/0 (42) 17:03:26.841405 IP webmaster-asus.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 251.0.0.224.in-addr.arpa. (42) 17:03:27.739194 IP joel-ESPRIMO-P.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 235.203.168.192.in-addr.arpa. (46) 17:03:27.842207 IP webmaster-asus.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 251.0.0.224.in-addr.arpa. (42) 17:03:29.219145 IP jordi.local.17500 > 255.255.255.255.17500: UDP, length 111 17:03:29.219552 IP jordi.local.17500 > 192.168.204.255.17500: UDP, length 111 17:03:29.491851 IP 192.168.140.117 > 239.255.255.100: igmp v1 report 239.255.255.100 [len 72] 17:03:29.741011 IP joel-ESPRIMO-P.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 235.203.168.192.in-addr.arpa. (46) 17:03:29.842991 IP webmaster-asus.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 251.0.0.224.in-addr.arpa. (42) 17:03:31.741389 IP joel-ESPRIMO-P.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 201.204.168.192.in-addr.arpa. (46) 17:03:31.741675 IP pc-imatge.local.mdns > 224.0.0.251.mdns: 0*- [0q] 1/0/0 (Cache flush) PTR pc-imatge.local. (69) 17:03:31.741931 IP webmaster-asus.local.53176 > 192.168.204.1.domain: 52271+ PTR? 111.204.168.192.in-addr.arpa. (46) 17:03:31.742602 IP 192.168.204.1.domain > webmaster-asus.local.53176: 52271 NXDomain 0/0/0 (46) 17:03:31.743381 IP webmaster-asus.local.39184 > 192.168.204.1.domain: 29151+ PTR? 1.204.168.192.in-addr.arpa. (44) 17:03:31.743857 IP 192.168.204.1.domain > webmaster-asus.local.39184: 29151 NXDomain 0/0/0 (44) 17:03:31.842973 IP joel-ESPRIMO-P.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 232.204.168.192.in-addr.arpa. (46) 17:03:31.843238 IP webmaster-asus.local.mdns > 224.0.0.251.mdns: 0*- [0q] 1/0/0 (Cache flush) PTR webmaster-asus.local. (74) 17:03:31.844695 IP webmaster-asus.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 1.204.168.192.in-addr.arpa. (44) 17:03:31.945552 IP joel-ESPRIMO-P.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 109.204.168.192.in-addr.arpa. (46) 17:03:31.945570 IP PC-IMATGE-2.local.mdns > 224.0.0.251.mdns: 0*- [0q] 1/0/0 (Cache flush) PTR PC-IMATGE-2.local. (71) 17:03:32.103751 IP joel-ESPRIMO-P.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 102.204.168.192.in-addr.arpa. (46) 17:03:32.103995 IP jordi.local.mdns > 224.0.0.251.mdns: 0*- [0q] 1/0/0 (Cache flush) PTR jordi.local. (65) 17:03:32.844908 IP webmaster-asus.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 1.204.168.192.in-addr.arpa. (44) 17:03:34.846808 IP webmaster-asus.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 1.204.168.192.in-addr.arpa. (44) 17:03:36.746489 IP webmaster-asus.local.40072 > 192.168.204.1.domain: 63984+ PTR? 232.204.168.192.in-addr.arpa. (46) 17:03:36.746950 IP 192.168.204.1.domain > webmaster-asus.local.40072: 63984 NXDomain 0/0/0 (46) 17:03:36.747746 IP webmaster-asus.local.39301 > 192.168.204.1.domain: 22503+ PTR? 255.255.255.255.in-addr.arpa. (46) 17:03:36.770824 IP 192.168.204.1.domain > webmaster-asus.local.39301: 22503 0/0/0 (46) 17:03:36.871659 IP webmaster-asus.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 255.255.255.255.in-addr.arpa. (46) 17:03:37.872533 IP webmaster-asus.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 255.255.255.255.in-addr.arpa. (46) 17:03:37.910765 IP ivanlt.local.17500 > 255.255.255.255.17500: UDP, length 176 17:03:37.911420 IP ivanlt.local.17500 > 192.168.204.255.17500: UDP, length 176 ^C17:03:37.911445 IP ivanlt.local.17500 > 192.168.15.255.17500: UDP, length 176 35 packets captured 92 packets received by filter 37 packets dropped by kernel
Protocol UDP
$ sudo tcpdump udp tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 17:08:59.670796 IP jordi.local.17500 > 255.255.255.255.17500: UDP, length 111 17:08:59.671088 IP jordi.local.17500 > 192.168.204.255.17500: UDP, length 111 ^C17:08:59.672067 IP webmaster-asus.local.51227 > 192.168.204.1.domain: 19088+ PTR? 255.255.255.255.in-addr.arpa. (46) 3 packets captured 40 packets received by filter 7 packets dropped by kernel
Protocol ICMP:
$ sudo tcpdump icmp tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 17:10:54.150037 IP zenbook.local > webmaster-asus.local: ICMP echo request, id 3601, seq 1, length 64 17:10:54.150107 IP webmaster-asus.local > zenbook.local: ICMP echo reply, id 3601, seq 1, length 64 17:10:55.148680 IP zenbook.local > webmaster-asus.local: ICMP echo request, id 3601, seq 2, length 64 17:10:55.148736 IP webmaster-asus.local > zenbook.local: ICMP echo reply, id 3601, seq 2, length 64 17:10:56.147686 IP zenbook.local > webmaster-asus.local: ICMP echo request, id 3601, seq 3, length 64 17:10:56.147741 IP webmaster-asus.local > zenbook.local: ICMP echo reply, id 3601, seq 3, length 64 17:10:57.147309 IP zenbook.local > webmaster-asus.local: ICMP echo request, id 3601, seq 4, length 64 17:10:57.147364 IP webmaster-asus.local > zenbook.local: ICMP echo reply, id 3601, seq 4, length 64 8 packets captured 8 packets received by filter 0 packets dropped by kernel
$ sudo tcpdump tcp and port 80
$ sudo tcpdump udp and dst port 53
$ sudo tcpdump tcp and \(port 22 or port 23\)
$ sudo tcpdump tcp and not port 80
S'utilitza la opció -e:
$ sudo tcpdump -e -n -i eth0
$ sudo tcpdump -env -i any icmp tcpdump: listening on any, link-type LINUX_SLL (Linux cooked), capture size 96 bytes 11:37:34.551792 In 00:23:54:08:50:8f ethertype IPv4 (0x0800), length 100: (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ICMP (1), length 84) 192.168.1.3 > 147.83.2.3: ICMP echo request, id 26426, seq 1, length 64 11:37:34.551806 Out 00:16:3e:10:eb:01 ethertype IPv4 (0x0800), length 100: (tos 0x0, ttl 63, id 0, offset 0, flags [DF], proto ICMP (1), length 84) 192.168.1.3 > 147.83.2.3: ICMP echo request, id 26426, seq 1, length 64
En aquest cas el paquet no torna correctament! (no hi ha reply)
$ sudo tcpdump -ennqti eth0 \( arp or icmp \)
Vegeu també:
Cal executar:
$ sudo tcpdump -qtel broadcast and port bootpc > /tmp/mac.list
I iniciar l'arrancada de xarxa de les màquines de les quals es vol recollir la MAC. Després podem executar:
$ sudo perl -ane ’print "\U$F[0]\n"’ /tmp/mac.lis|sort|uniq
Per tal d'obtenir la llista de MACs.
$ tcpdump -i any not port 22
Catch TCP SYN packets:
$ sudo tcpdump -n tcp and port 80 and 'tcp[tcpflags] & tcp-syn == tcp-syn' tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes 13:15:00.302219 IP 10.10.1.240.33111 > 10.10.121.2.http: S 3284556452:3284556452(0) win 5840 <mss 1460,sackOK,timestamp 16261279 0,nop,wscale 10> 13:15:00.302272 IP 10.10.121.2.http > 10.10.1.240.33111: S 975107341:975107341(0) ack 3284556453 win 32767 <mss 1460,sackOK,timestamp 2432550825 16261
In the example above, all packets with TCP SYN flag set are captured. Other flags (ACK, for example) might be set also. Packets which have only TCP SYN flags set, can be captured like this:
$ sudo tcpdump tcp and port 80 and 'tcp[tcpflags] == tcp-syn'
Catch TCP SYN/ACK packets (typically, responses from servers):
$ sudo tcpdump -n tcp and 'tcp[tcpflags] & (tcp-syn|tcp-ack) == (tcp-syn|tcp-ack)' tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes 13:30:19.501816 IP 10.10.121.2.ssh > 10.10.1.240.33114: S 1940763772:1940763772(0) ack 4250485572 win 32767 <mss 1460,sackOK,timestamp 2433470257 1718
Same thing:
$ sudo tcpdump -n tcp and 'tcp[tcpflags] & tcp-syn == tcp-syn' and 'tcp[tcpflags] & tcp-ack == tcp-ack'
$ sudo tcpdump -i bond0 -s 65535 -w tcpdump.log
Consulteu CDP#Obtenir_la_informaci.C3.B3_del_protocol_CPD_amb_tcpdump
$ sudo tcpdump -ni eth0 port 67 or 68 -n -e
Veure només els Echo Request
$ sudo tcpdump -e -x "icmp[0]=8"
Per veure els Echo Replies (Type 0):
$ sudo tcpdump -e -x "icmp[0]=0"
O podeu filtrar qualsevol altre tipus.