顯示具有 FreeBSD 標籤的文章。 顯示所有文章
顯示具有 FreeBSD 標籤的文章。 顯示所有文章

2009年10月13日 星期二

即時網路流量

Linux


從 /proc/net/dev 去截取資料來運算。


[root@ip069 ~]# cat /proc/net/dev


Inter-| Receive | Transmit


face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed


lo:55684135 25897 0 0 0 0 0 0 55684135 25897 0 0 0 0 0 0


eth0:1439346272 9461893 0 0 82 0 0 0 904668828 3744265 0 0 0 0 0 0


eth1: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0


sit0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0


virbr0: 0 0 0 0 0 0 0 0 9208 42 0 0 0 0 0 0


FreeBSD 監看即時流量可用以下指令:


# netstat -ibd -I bce0 1


input (bce0) output


packets errs bytes packets errs bytes colls drops


9 0 894 3 0 1486 0 0


11 0 942 2 0 388 0 0


5 0 879 2 0 356 0 0


2009年9月22日 星期二

FreeBSD ipfw 欄位

FreeBSD ipfw column.



ipfw show



Index Packets Bytes Rule


----- ------- -------- ----------------------------------------------------------


00050 464266 61021795 count udp from any to any via 192.168.1.99


00051 56582 79785701 count tcp from 192.168.1.99 80 to any via 192.168.1.99


65533 3 144 count tcp from 192.168.1.95 to 192.168.1.99 dst-port 23 in



  • Packets: How many packets counted.

  • Bytes: How many bytes counted. (e.g. The index 65533, 20bytes(IP)+28bytes(TCP)=48bytes, 48*3=144bytes)