IFTop & IPTables Backup & Restore

Go down

IFTop & IPTables Backup & Restore Empty IFTop & IPTables Backup & Restore

Post by jamied_uk on 9th June 2018, 20:55






IFTop

Code:
sudo apt install -y iftop




Code:
#!/bin/bash
# (c) J~Net 2018
#
# jnet.forumotion.com/t1632-iftop-for-linux#2512
#
# Example ./iftop.sh enp0s3
#
#
#
#
myvar="$1"
#
if [ -z "$1" ]
  then
    echo "Enter Network To Monitor For Example:"
    echo "enp0s3 or eth0 or tun0 Or wlan0"
    read myvar
fi



sudo iftop -i "$myvar"


Watch Script


Code:
#!/bin/bash
# (c) J~Net 2018
#
# jnet.forumotion.com/t1632-iftop-for-linux#2512
#
# Example ./logs.sh
#
#
#
#
# tail -n 50 -f whatever.log
# watch -b whatever.log
#
#
# watch -n 10 -d ls -l /var/adm/messages
sudo watch -b /var/log/apache2/access.log
# cat /var/log/apache2/access.log | grep HTTP
# ls /var/log/
#
#
# sudo watch -b /var/log/gufw.log
# cat /var/log/gufw.log | grep HTTP

Backup IP Tables


Code:
#!/bin/bash
# (C) J~Net 2018
#
#Example:
#
# ./backup.sh
#
# With suitable privilege
#
sudo iptables-save
sudo modprobe iptable_filter
sudo iptables-save
sudo iptables-save > /home/jay/Documents/Scripts/IPTables-Backup/iptables-backup.txt
#
# will save your iptables configuration to /some/file
#
# and
#
# sudo iptables-restore iptables-backup.txt
#
# will restore your saved configuration from /some/file

Restore IP Tables


Code:
#!/bin/bash
# (C) J~Net 2018
#
#Example:
#
# ./restore.sh
#
# With suitable privilege
#
# sudo iptables-save iptables-backup.txt
#
# will save your iptables configuration to /some/file
#
# and
#
# sudo iptables-restore iptables-backup.txt
#
sudo iptables-restore < iptables-backup.txt
#
# will restore your saved configuration from /some/file
jamied_uk
jamied_uk
Admin

Posts : 2471
Join date : 2010-05-09
Age : 36
Location : UK

http://address-shortner.co.uk

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum