IP Accounting with IP Tables
Hi security folks ;) I hope i dont reinvent the wheel with this or that it is a faq: The company I work for will connect some servers via a S-DSL line. We have 16 IP adresses and the setup is like that -sdsl-line->(ext:SDSLRouter:int)<->(eth0:LinuxFW:eth1-4)<->DMZ1-4 Since i can't not (well i could via the unpassworded serial port ;) ) configure/monitor the router, i want to setup traffic accounting on my linux firewall. For now this should only allow me to monitor if the monthly traffic limit is reached, so it will suffice to count all bytes that enter/leave through the external interface of the firewall (missing traffic that is directed directly to the router and adding traffic that is only between the firewall and the router, but thats ok). I did the following (eth0 is the ext interface of the fw): iptables -t mangle -N acc_traffic iptables -t mangle -I acc_traffic -j RETURN iptables -t mangle -I PREROUTING -i eth0 -j acc_traffic iptables -t mangle -A POSTROUTING -o eth0 -j acc_traffic now i can get the ip traffic byte summary that enters and leaves via eth0 to SDSL by calling iptables -t mangle -vx -L acc_traffic a script that is started when the firewall goes up / down and run by cron every hour can generate and save the used ip traffic. my short question is: will in effect the performance of the firewall in a bad way if all packets that enter / leave via eth0 have to pass through my accounting chain? is my solution totally dumb (i tried ipac-ng, but was not happy with its configuration, means i was to dumb to get it to work properly)? peace, Tom p.s.: sorry for my whacky english but it got 33 degree celsius in this room :p
On Aug 6, Thomas Seliger <CRJLJAKTJORB@spammotel.com> wrote:
I hope i dont reinvent the wheel with this or that it is a faq: [...] i want to setup traffic accounting on my linux firewall. Use ipac-ng (ip accounting). You can find it on freshmeat and it does exactly what you need (and a little more with nearly no effort).
my short question is: will in effect the performance of the firewall in a bad way if all packets that enter / leave via eth0 have to pass through my accounting chain? I'm using ipac on my P120 router machine and it doesn't have any bad effect.
is my solution totally dumb (i tried ipac-ng, but was not happy with its configuration, means i was to dumb to get it to work properly)? Look into it again, many people like mrtg, but I was too stupid to configure it. Ipac-ng did the job for me. I may also send you my config file if you need it.
Markus -- __________________ /"\ Markus Gaugusch \ / ASCII Ribbon Campaign markus@gaugusch.at X Against HTML Mail / \
* Markus Gaugusch wrote on Thu, Aug 07, 2003 at 16:53 +0200:
On Aug 6, Thomas Seliger <CRJLJAKTJORB@spammotel.com> wrote:
my short question is: will in effect the performance of the firewall in a bad way if all packets that enter / leave via eth0 have to pass through my accounting chain? I'm using ipac on my P120 router machine and it doesn't have any bad effect.
I would say the same. I have a P120 firewall with 600 rules or so, this delays packets by 1 ms IIRC. Behind there I have just an T1; this can be easily handled. I guess the throughput for 100M lines may be reduced, but I never tested it (there are P1000 CPUs out there :-)).
is my solution totally dumb (i tried ipac-ng, but was not happy with its configuration, means i was to dumb to get it to work properly)? Look into it again, many people like mrtg, but I was too stupid to configure it. Ipac-ng did the job for me. I may also send you my config file if you need it.
Well, I use mrtg and like it, but for security reasons SNMP might not be the best solution. However, it is a powerful information supplier. With mrtg I poll the interface packet counters every few minutes which is a different kind of information: I know the used total bandwidth but not more. Of course you could use iptables values for calculating mrtg graphics. oki, Steffen -- Dieses Schreiben wurde maschinell erstellt, es trägt daher weder Unterschrift noch Siegel.
participants (3)
-
Markus Gaugusch
-
Steffen Dettmer
-
Thomas Seliger