Guest User

traffic-statistics

a guest
Dec 15th, 2014
205
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. iptables -N TIAGO
  2. iptables -I FORWARD -j TIAGO
  3. iptables -I TIAGO -d 192.168.1.40 ! -s 192.168.1.0/24 -i eth0 -m state --state ESTABLISHED -j RETURN
  4. iptables -I TIAGO -s 192.168.1.40 ! -d 192.168.1.0/24 -o eth0 -m state --state ESTABLISHED -j RETURN
  5. iptables -I TIAGO -d 192.168.1.40 ! -s 192.168.1.0/24 -i eth0 -m state --state NEW -j RETURN
  6. iptables -I TIAGO -s 192.168.1.40 ! -d 192.168.1.0/24 -o eth0 -m state --state NEW -j RETURN
  7. iptables -I TIAGO -d 192.168.1.40 ! -s 192.168.1.0/24 -i eth0 -m state --state RELATED -j RETURN
  8. iptables -I TIAGO -s 192.168.1.40 ! -d 192.168.1.0/24 -o eth0 -m state --state RELATED -j RETURN
  9. iptables -I TIAGO -d 192.168.1.40 ! -s 192.168.1.0/24 -i eth0 -m state --state INVALID -j RETURN
  10. iptables -I TIAGO -s 192.168.1.40 ! -d 192.168.1.0/24 -o eth0 -m state --state INVALID -j RETURN
  11. iptables -I TIAGO -d 192.168.1.40 ! -s 192.168.1.0/24 -i eth0 -m state --state UNTRACKED -j RETURN
  12. iptables -I TIAGO -s 192.168.1.40 ! -d 192.168.1.0/24 -o eth0 -m state --state UNTRACKED -j RETURN
  13. while :; do echo -en '\ec'; A=$(iptables -vnxL TIAGO); X=$(echo "$A" | md5sum); if [ "$X" != "$O" ]; then O=$X; fgrep '192.168.1.40' /proc/net/ip_conntrack >> LOG; fi; echo "$A"; sleep 2; done
  14. # Here you could press Ctrl+C and check the result by cat LOG
  15.  
  16. # To undo:
  17. for A in 0 0 0 0 0 0 0 0 0 0; do iptables -D TIAGO 1; done
  18. iptables -L FORWARD | grep TIAGO
  19. iptables -D FORWARD -j TIAGO
  20. iptables -L FORWARD | grep TIAGO
  21. iptables -X TIAGO && echo OK
RAW Paste Data