Portal Home > Knowledgebase > Articles Database > Keeping iptables data and restore in the event of a crash


Keeping iptables data and restore in the event of a crash




Posted by stuartornum, 05-24-2007, 05:11 PM
Hi all, You may remember me asking if there was a way to monitor traffioc usage by IP address on WHT a while ago. Well finally I have managed to do it !! Here is what is displays... I have just one final question.... In the event of a crash, will all the data that has been accumulated using iptables, be lost? If so is there a way to store the values in a file, say every 5 mins? Thanks

Posted by ryan1918, 05-24-2007, 05:31 PM
You could run a crontab.. and then use, iptables-save > file.txt That would save the current rules in your current directory under "files.txt" Then you could make another crontab restore it using. iptables-restore < file.txt

Posted by stuartornum, 05-24-2007, 05:35 PM
hi ryan 1918, Thanks for your reply. I did think a crontab would be the way forward, but to be honest I have never used crontabs some am slightly in the dark on what to do with it. I know thats it is in /etc/crontab and thats it ! Sorry for the lack of knowledge. Thanks again

Posted by ryan1918, 05-24-2007, 09:20 PM
Login into ssh type > env EDITOR=nano crontab -e or just type crontab -e */5 * * * * iptables-save > file.txt if you want it saved in a particular directory then do like.. /home/directory/here/file.txt Then save the file and close it. That should do it every 5 minutes, I hope this helps.

Posted by stuartornum, 05-25-2007, 06:05 AM
Thanks ryan1918, I have used the command iptables-save > file.txt as you said above, this is what I get.. However as you can see the traffic usage per IP address is not on there? is there a parameter I need to use? Thanks again



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Cloud Reseller (Views: 484)