Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 01-19-2009, 05:16 AM   #1
LQ Newbie
Registered: Sep 2008
Posts: 14

Rep: Reputation: 0
iptables help

hello. i have iptables rules on my home linux router and i want to do a statistic from it.

is it posible to send variables from iptables to web server and then work with this variables?

when i type iptables -nvL on my router, this come up:

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

446K 91M ACCEPT all -- * *

it say, that 91Mbyt has passed through my linux router to my PC. and i want to send value 91M to my web server and make statistic from it...

Old 01-19-2009, 07:16 AM   #2
LQ 5k Club
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
You can use mrtg to create statistics from the router ( if the router support this)
Old 01-19-2009, 08:57 AM   #3
Registered: May 2005
Location: St. Louis, MO
Distribution: CentOS7
Posts: 267

Rep: Reputation: 58
You might try:
BYTES_IN=$(/sbin/iptables -nvL INPUT | grep -m1 "ACCEPT all" | cut -b 7-11); echo $BYTES_IN > /tmp/bytesin

and refer to /tmp/bytesin on a web page. You could set a root cron to run the above every couple of minutes to have updated information in /tmp/bytesin


Last edited by david1941; 01-19-2009 at 06:22 PM. Reason: cut statement to use -b 7-11 as field size changes
Old 01-20-2009, 03:46 AM   #4
LQ Newbie
Registered: Sep 2008
Posts: 14

Original Poster
Rep: Reputation: 0
Originally Posted by repo View Post
You can use mrtg to create statistics from the router ( if the router support this)
but when i want to monitor two PC behind router, mrtg can not help me

david1941: thanks, this ist the right way


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables v1.2.9: Unknown arg `/sbin/iptables' Try `iptables -h' or 'iptables --help' Niceman2005 Linux - Security 4 12-29-2005 09:20 PM
Iptables - Couldn't load target `ACCPET':/lib/iptables/ z00t Linux - Security 3 01-26-2004 03:24 AM
IPtables Log Analyzer from brainlego Linux - Software 0 08-11-2003 07:08 AM
iptables book wich one can you pll recomment to be an iptables expert? linuxownt Linux - General 2 06-26-2003 05:38 PM
My iptables script is /etc/sysconfig/iptables. How do i make this baby execute on boo ForumKid Linux - General 3 01-22-2002 08:36 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:06 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration