summaryrefslogtreecommitdiff
path: root/contrib/ipchains/ipchainacc.rules
diff options
context:
space:
mode:
authorbeatrice <beatrice@dangofactory.net>2026-11-22 20:00:14 +0900
committerbeatrice <beatrice@dangofactory.net>2026-11-22 20:00:14 +0900
commit8f68d02045982da8f00a559835b500caf3a1967d (patch)
treec8d0e92969b92e1b6559a0e032b6aa710a8ae2d9 /contrib/ipchains/ipchainacc.rules
parentbb5ff95073e5001be7dbf58ffce80d7926deff0b (diff)
downloadmrtg-master.tar.gz
mrtg-master.zip
Release tarball mrtg-2.17.7.tar.gz (dist-generated files / local differences from tag)HEADmaster
Diffstat (limited to 'contrib/ipchains/ipchainacc.rules')
-rwxr-xr-xcontrib/ipchains/ipchainacc.rules36
1 files changed, 36 insertions, 0 deletions
diff --git a/contrib/ipchains/ipchainacc.rules b/contrib/ipchains/ipchainacc.rules
new file mode 100755
index 0000000..3be5f63
--- /dev/null
+++ b/contrib/ipchains/ipchainacc.rules
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+#--- sample ipchains rules for accounting
+
+# Flush the rules in case they exist already
+/sbin/ipchains -F acctin
+/sbin/ipchains -F acctout
+
+# add the new rule chains
+/sbin/ipchains -N acctin
+/sbin/ipchains -N acctout
+
+# add empty rules to the new chains just for accounting
+/sbin/ipchains -A acctin
+/sbin/ipchains -A acctout
+
+# insert rules into the input and output streams.
+# Packets will first pass through these rules before
+# returning to the other rules in the chains
+# You might not want this if you are trying to
+# completely ignore certain hosts.
+/sbin/ipchains -I input -j acctin
+/sbin/ipchains -I output -j acctout
+
+# if you wanted to narrow the accouting to a single IP
+# you could do these lines instead of the above 2 (not tested)
+# (assuming your IP address was 192.168.1.1)
+#/sbin/ipchains -I input -d 192.168.1.1 -j acctin
+#/sbin/ipchains -I output -s 192.168.1.1 -j acctout
+
+# By changing the rules, you can make it filter only exactly
+# what you want as long as it jumps to acctin, or acctout.
+# Be careful not to double count packets though.
+
+#----------- end ---------------
+