Search code examples
linuxudpnetstat

Using netstat in Linux


I want to see statistics for each protocol (TCP/UDP) on my Linux Yocto. I try use netstat -s command (http://www.thegeekstuff.com/2010/03/netstat-command-examples/).

But i receive error netstat:invalid option -- 's'. It is because BusyBox's netstat version doesn't contain the -s option.

  1. Is it possible to install "normal" netstat?

I try to install nettools (which includes netstat) using opkg install, but package manager can't find it.

I also try to compile and install net-tools source from here - https://sourceforge.net/projects/net-tools/, but i receive error during installation.

Maybee i can download package from here: rpmfind.net ?

  1. Is it possible to see statistic without using netstat? (i need information, which command netstat -s returns)

(Example of netstat -s output:

udp:    
71208 datagrams received    
0 with incomplete header    
0 with bad data length field    
0 with bad checksum    
0 with no checksum    
832 dropped due to no socket    
16 broadcast/multicast datagrams dropped due to no socket    
1971 dropped due to full socket buffers    
0 not for hashed pcb    
68389 delivered    
137685 datagrams output

)


Solution

  • the last netstat release is super old. you should build it straight out of git instead (don't worry, we try to keep it sane at all times). use the "Download Snapshot" link in the online git browser.

    that said, have you seen the iproute2 project ? it includes tools like nstat and generally preferred over net-tools when it comes to scripting.