Skip to contentSkip to conversation

Querry about contrack

DISCUSSION Dhirendra Pal Singh 2 participants 2 messages Jan 30, 2003

lore
Share & tools
lore
#0 lore raw

Hi All,

Is it possible to find

A) number of packets recived and send,

B) no of connections existing

on the basis of port no. ???

Does contrack keeps a track of it.. or something else...
I think somwehere in /proc contrack keeps a list of the active connections.. but I need the info to analyse it in my piece of c code.

Any ideas how can I do that..

Thanks in Advance
Dp

#1 lore raw
Quoted 9 lines · Dhirendra Pal Singh

Is it possible to find

A) number of packets recived and send,
B) no of connections existing
on the basis of port no. ???

Does contrack keeps a track of it.. or something else...
I think somwehere in /proc contrack keeps a list of the active connections.. but I need the info to analyse it in my piece of c code.

A simple "cat /proc/net/ip_conntrack | wc -l" will tell you how many
connections are currently being tracked. This does include possibly failed connections as well though ([UNREPLIED]), so some use of grep or perl on the output is probably a good idea.

As for the packets received/sent, you'd have to either set up
accounting targets per port (ick), or simply LOG every such packet and then count the matching lines in the syslog file(s). Ugh.

Maybe ULOG or similar can be of help with this.

-Ath

Signature · 4 lines
- Athanasius = Athanasius(at)miggy.org / http://www.miggy.org/
                  Finger athan(at)fysh.org for PGP key
	   "And it's me who is my enemy. Me who beats me up.
Me who makes the monsters. Me who strips my confidence." Paula Cole - ME