Changes

Jump to: navigation, search

Traffic accounting with iptables

653 bytes added, 18:26, 19 November 2006
Scripting
first a small script to get all vz id's for later on
<pre>
host2:~/bin# cat vz-all-running
vzlist |grep run|tr -s [:blank:]|cut -d' ' -f2
</pre>
second a small script witch get all ip's of running vz's
<pre>
host2:~/bin# cat vz-all-running-ip
for i in `./vz-all-running`; do vzctl exec $i ifconfig |grep 'venet0:0' -A1|tail -n1|cut -d':' -f2|cut -d' ' -f1; done
</pre>
and a small script to set all the iptable rules<pre>host2:~/bin# cat vz-iptables-create-rulesfor i in `./vz-all-running-ip`; do iptables -D FORWARD -s $i; iptables -D FORWARD -d $i; done >/dev/null 2>/dev/nullfor i in `./vz-all-running-ip`; do iptables -A FORWARD -s $i; iptables -A FORWARD -d $i; done >/dev/null 2>/dev/null</pre>
22
edits

Navigation menu