LNSTAT(8)
๐ lnstat(8) โ unified Linux network statistics ๐
okay bestie, so this is lnstat, and it lives in the System Manager's Manual, section 8 (that's the sysadmin section, iykyk โจ). If you've ever wanted the kernel to just tell you its network stats on a lil schedule, this is the moment. ๐
๐ธ NAME ๐ธ
lnstat โ unified Linux network statistics
โจ SYNOPSIS โจ
lnstat [options]
๐ฆ DESCRIPTION ๐ฆ
So this manual page documents, briefly, the lnstat command. Short and sweet intro, but the vibes are immaculate.
lnstat is a generalized and more feature-complete replacement for the old rtstat program. It's commonly used to periodically print a selection of statistical values that the kernel exports. And like โ not just routing cache stats either, bestie. It supports any kind of statistics the Linux kernel exports via a file in /proc/net/stat/. Any of them. The whole menu. ๐
Here's the tea on how it actually works:
- Each file in
/proc/net/stat/has a header line listing the column names.lnstatuses those names as keys for picking which statistics to print. - For every CPU present in the system, a line follows listing the actual values for each column of the file.
lnstatsums these values up (they're counters, so summing is the move) before printing them.- After each interval, only the difference to the last value is printed. So you're seeing deltas, not the whole running total. โจ
You can select which files and columns you want with the -f and -k parameters. And by default? all columns of all files are printed. Everything. No filter. Chaos, but make it informative. ๐ญ
๐ OPTIONS ๐
lnstat supports the following options. Every single one, no skipping, we love a complete list ๐
-h,--helpโ Show summary of options. Your lil "what do I do" button. ๐ซถ-V,--versionโ Show version of program. Which flavor oflnstatare we running, bestie?-c,--count<count> โ Print <count> number of intervals. So you get exactly that many rounds, then it's done. ๐-d,--dumpโ Dump list of available files/keys. Literally a menu of what you can ask for. Iconic for discovery. ๐-f,--file<file> โ Statistics file to use, and yes, it may be specified multiple times. By default all files in/proc/net/statare scanned.-i,--interval<intv> โ Set interval to 'intv' seconds. How often we check in on the kernel. โฐ-j,--jsonโ Display results in JSON format. For the girlies piping output into other tools. ๐ง-k,--keysk,k,k,...โ Display only keys specified. Each keykis of the form[file:]key. If<file>is given, the search for the given key is limited to that file. Otherwise, the first file containing the searched key is used. So specify a file if you're picky, don't if you're not. ๐-s,--subject[0-2]โ Specify display of subject/header.'0'means no header at all,'1'prints a header only at start of the program, and'2'prints a header every 20 lines. Pick your vibe. โจ-w,--widthn,n,n,...โ Width for each field. For when the default columns just aren't giving. ๐
๐ USAGE EXAMPLES ๐
These are straight from the source, no edits, because the examples ate and we're not touching them:
# lnstat -d
Get a list of supported statistics files. Start here, bestie.
# lnstat -k arp_cache:entries,rt_cache:in_hit,arp_cache:destroys
Select the specified files and keys. Note the file:key syntax in action. ๐
# lnstat -i 10
Use an interval of 10 seconds. Ten whole seconds between updates. Patience is a virtue or whatever. โณ
# lnstat -f ip_conntrack
Use only the specified file for statistics. Just the one. Narrow it down. ๐ฏ
# lnstat -s 0
Do not print a header at all. Clean output, no context, chaos mode. ๐
# lnstat -s 20
Print a header at start and every 20 lines.
# lnstat -c -1 -i 1 -f rt_cache -k entries,in_hit,in_slow_tot
Display statistics for keys entries, in_hit and in_slow_tot of field rt_cache every second. (And -c -1 means it just... keeps going. Forever. Main character energy, honestly. ๐ญ)
๐ FILES ๐
This is the big one. Here's every file and every key it hands you. Buckle up, it's a lot, but it's all important, fr fr. ๐
/proc/net/stat/arp_cache, /proc/net/stat/ndisc_cache
Statistics around neighbor cache and ARP. arp_cache is for IPv4, ndisc_cache is the same for IPv6. Same energy, different protocol. ๐ซ
entriesโ Number of entries in the neighbor table.allocsโ How many neighbor entries have been allocated.destroysโ How many neighbor entries have been removed.hash_growsโ How often the neighbor (hash) table was increased.lookupsโ How many lookups were performed.hitsโ How many lookups were successful. โจres_failedโ How many neighbor lookups failed. ๐ญrcv_probes_mcastโ How many multicast neighbor solicitations were received. (IPv6 only.)rcv_probes_ucastโ How many unicast neighbor solicitations were received. (IPv6 only.)periodic_gc_runsโ How many garbage collection runs were executed.forced_gc_runsโ How many forced garbage collection runs were executed. Happens when adding an entry and the table is too full.unresolved_discardsโ How many neighbor table entries were discarded due to lookup failure.table_fullsโ Number of table overflows. Happens if table is full and forced GC run (seeforced_gc_runs) has failed.
/proc/net/stat/ip_conntrack, /proc/net/stat/nf_conntrack
Conntrack related counters. Heads up: ip_conntrack is for backwards compatibility with older userspace only and shows the same data as nf_conntrack. So don't come for ip_conntrack, it's just doing legacy duty. ๐
entriesโ Number of entries in conntrack table.searchedโ Number of conntrack table lookups performed.foundโ Number of searched entries which were successful.newโ Number of conntrack entries added which were not expected before.invalidโ Number of packets seen which cannot be tracked.ignoreโ Number of packets seen which are already connected to a conntrack entry.deleteโ Number of conntrack entries which were removed.delete_listโ Number of conntrack entries which were put to dying list.insertโ Number of entries inserted into the list.insert_failedโ Number of entries for which list insertion was attempted but failed (happens if the same entry is already present).dropโ Number of packets dropped due to conntrack failure. Either new conntrack entry allocation failed, or protocol helper dropped the packet.early_dropโ Number of dropped conntrack entries to make room for new ones, if maximum table size was reached.icmp_errorโ Number of packets which could not be tracked due to error situation. This is a subset ofinvalid.expect_newโ Number of conntrack entries added after an expectation for them was already present.expect_createโ Number of expectations added.expect_deleteโ Number of expectations deleted.search_restartโ Number of conntrack table lookups which had to be restarted due to hashtable resizes.
/proc/net/stat/rt_cache
Routing cache statistics. And okay, a LOT of these are deprecated, so I'm flagging them all clearly โ don't come at me, I'm just the messenger. ๐
entriesโ Number of entries in routing cache.in_hitโ Number of route cache hits for incoming packets. Deprecated since IP route cache removal, therefore always zero.in_slow_totโ Number of routing cache entries added for input traffic.in_slow_mcโ Number of multicast routing cache entries added for input traffic.in_no_routeโ Number of input packets for which no routing table entry was found.in_brdโ Number of matched input broadcast packets.in_martian_dstโ Number of incoming martian destination packets. ๐ฝin_martian_srcโ Number of incoming martian source packets. ๐ฝout_hitโ Number of route cache hits for outgoing packets. Deprecated since IP route cache removal, therefore always zero.out_slow_totโ Number of routing cache entries added for output traffic.out_slow_mcโ Number of multicast routing cache entries added for output traffic.gc_totalโ Total number of garbage collection runs. Deprecated since IP route cache removal, therefore always zero.gc_ignoredโ Number of ignored garbage collection runs due to minimum GC interval not reached and routing cache not full. Deprecated since IP route cache removal, therefore always zero.gc_goal_missโ Number of garbage collector goal misses. Deprecated since IP route cache removal, therefore always zero.gc_dst_overflowโ Number of destination cache overflows. Deprecated since IP route cache removal, therefore always zero.in_hlist_searchโ Number of hash table list traversals for input traffic. Deprecated since IP route cache removal, therefore always zero.out_hlist_searchโ Number of hash table list traversals for output traffic. Deprecated since IP route cache removal, therefore always zero.
bestie if you see a0from anything inrt_cachethat's marked deprecated, that's not a bug, that's the route cache being gone. Sit with that. ๐ซถ
๐ฅ SEE ALSO ๐ฅ
๐ AUTHOR ๐
lnstat was written by Harald Welte <laforge@gnumonks.org>.
This manual page was written by Michael Prokop <mika@grml.org> for the Debian project (but may be used by others). Shoutout to both of them, absolute legends, we love a documented tool. ๐
and that's the whole page bestie!! ๐ธ this one came out of the System Manager's Manual and it's LNSTAT(8) โ section 8, sysadmin business, the one you run as root or with the right perms. no version number or date stamped on this page, just the section tag, so consider this your cute lil sign-off. go forth and lnstat -d, you got this ๐
โจ๐ฆ
๐ฆ where this page comes from
- alpine 3.24: iproute2-doc 7.0.0-r0 ยท GPL-2.0-or-later
- arch rolling: iproute2 7.2.0-1
- arch rolling: iproute2 7.3.0-1 ยท GPL-2.0-or-later
- centos-stream 10: iproute 7.0.0-2.el10 ยท GPL-2.0-or-later AND NIST-PD
- nixos 26.05: iproute2 7.0.0
- nixpkgs unstable: iproute2 7.2.0
- ubuntu stonking: iproute2 7.2.0-1ubuntu1 ยท GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms