Monday, July 13, 2020

tcpdump in namespaces takes too long to show up

So you're trying to troubleshoot traffic in a Linux network namespace but TCPdump takes forever to show you results?

Try the following tags:

       -l     Make stdout line buffered.  Useful if you want to see the data while capturing it.  E.g.,
       -n     Don't convert addresses (i.e., host addresses, port numbers, etc.) to names.                                                                                 

root@ubuntu:~# ip netns exec ns65 tcpdump -n -l icmp                                                                                                                       
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode                                                                                                 
listening on eth0.65, link-type EN10MB (Ethernet), capture size 262144 bytes                                                                                               
05:16:51.785225 IP 10.63.0.11 > 10.65.0.11: ICMP echo request, id 2019, seq 28, length 64                                                                                  
05:16:51.785341 IP 10.65.0.11 > 10.63.0.11: ICMP echo reply, id 2019, seq 28, length 64                                                                                    
05:16:52.786762 IP 10.63.0.11 > 10.65.0.11: ICMP echo request, id 2019, seq 29, length 64                                                                                  
05:16:52.786882 IP 10.65.0.11 > 10.63.0.11: ICMP echo reply, id 2019, seq 29, length 64                                                                                    

No comments:

Post a Comment