Skip to content

Instantly share code, notes, and snippets.

@tuxmartin
Last active November 14, 2018 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuxmartin/a4be301079495fc0e129a944f6b6c984 to your computer and use it in GitHub Desktop.
Save tuxmartin/a4be301079495fc0e129a944f6b6c984 to your computer and use it in GitHub Desktop.
iptables - pocitani prenesenych bajtu z definovane IP
root@cameras-lcd:/# iptables -nvL
Chain INPUT (policy ACCEPT 24808 packets, 26M bytes)
pkts bytes target prot opt in out source destination
16884 24M camera-line1 all -- * * 10.54.6.147 0.0.0.0/0
0 0 camera-line2 all -- * * 10.54.6.148 0.0.0.0/0
1528 1986K camera-line3 all -- * * 10.54.6.149 0.0.0.0/0
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 12533 packets, 17M bytes)
pkts bytes target prot opt in out source destination
Chain camera-line1 (1 references)
pkts bytes target prot opt in out source destination
16884 24M RETURN all -- * * 0.0.0.0/0 0.0.0.0/0
Chain camera-line2 (1 references)
pkts bytes target prot opt in out source destination
0 0 RETURN all -- * * 0.0.0.0/0 0.0.0.0/0
Chain camera-line3 (1 references)
pkts bytes target prot opt in out source destination
1525 1982K RETURN all -- * * 0.0.0.0/0 0.0.0.0/0
root@cameras-lcd:/#
root@cameras-lcd:/# iptables -nvL camera-line3 | tail -n1 | awk '{print $2}' # megabajty
2157K
root@cameras-lcd:/# iptables -nvxL camera-line3 | tail -n1 | awk '{print $2}' # bajty
2282352
root@cameras-lcd:/#
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -N camera-line1
iptables -A INPUT -s 10.54.6.147 -j camera-line1
iptables -A camera-line1 -j RETURN
iptables -N camera-line2
iptables -A INPUT -s 10.54.6.148 -j camera-line2
iptables -A camera-line2 -j RETURN
iptables -N camera-line3
iptables -A INPUT -s 10.54.6.149 -j camera-line3
iptables -A camera-line3 -j RETURN
iptables -nvL camera-line3 | tail -n1 | awk '{print $2}' # megabajty
iptables -nvxL camera-line3 | tail -n1 | awk '{print $2}' # bajty
iptables -nvL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment