- 论坛徽章:
- 0
|
在网上找到了设置的一种方法,能够统计流量,作如下设置:- $ iptables -I FORWARD -s 192.168.1.100 -j ACCEPT
- $ iptables -I FORWARD -d 192.168.1.100 -j ACCEPT
复制代码 查看其流量:- # iptables -nvx -L
- Chain INPUT (policy DROP 115 packets, 15878 bytes)
- pkts bytes target prot opt in out source destination
- 2887 291743 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
- 0 0 DROP tcp -- eth1 * 0.0.0.0/0 172.30.31.107 tcp dpt:80
- 0 0 ACCEPT udp -- eth1 * 0.0.0.0/0 0.0.0.0/0 udp dpt:68
- 0 0 DROP icmp -- eth1 * 0.0.0.0/0 172.30.31.107 icmp type 8
- 0 0 ACCEPT 2 -- eth1 * 0.0.0.0/0 0.0.0.0/0
- 2167 127046 ACCEPT all -- br0 * 0.0.0.0/0 0.0.0.0/0
- 0 0 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
- Chain FORWARD (policy DROP 0 packets, 0 bytes)
- pkts bytes target prot opt in out source destination
- 1691 1116807 ACCEPT all -- * * 0.0.0.0/0 192.168.1.100
- 1835 380824 ACCEPT all -- * * 192.168.1.100 0.0.0.0/0
- 2233 131496 TCPMSS tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x06/0x02 TCPMSS clamp to PMTU
- 0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp spt:1701
- 0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:1701
- 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:1723
- 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:1723
- 0 0 ACCEPT 47 -- * * 0.0.0.0/0 0.0.0.0/0
- 0 0 ACCEPT udp -- eth1 * 0.0.0.0/0 224.0.0.0/4 udp
- 12903 2242279 ACCEPT all -- br0 * 0.0.0.0/0 0.0.0.0/0
- 0 0 ACCEPT udp -- eth1 br0 0.0.0.0/0 0.0.0.0/0 udp dpt:500
- 0 0 ACCEPT udp -- eth1 * 0.0.0.0/0 224.0.0.0/4 udp
- 0 0 ACCEPT esp -- eth1 br0 0.0.0.0/0 0.0.0.0/0
- 13092 10655061 ACCEPT all -- eth1 * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
- Chain OUTPUT (policy ACCEPT 4413 packets, 2452299 bytes)
- pkts bytes target prot opt in out source destination
复制代码 以下的一小部分即是我所需要的信息:- Chain FORWARD (policy DROP 0 packets, 0 bytes)
- pkts bytes target prot opt in out source destination
- 1691 1116807 ACCEPT all -- * * 0.0.0.0/0 192.168.1.100
- 1835 380824 ACCEPT all -- * * 192.168.1.100 0.0.0.0/0
复制代码 |
|