路流量 1. 利 OSS Open Source Software 路流量 行 2. Linux ntop http://www.ntop.org Iptraf http://iptraf.seul.org Sniffit http://reptile.rug.ac.be/~coder/sniffit/sniffit.html 3. 料 ntop ntop 利 Pisa Luca Deri 1997 年 GNU GPL 精神 路 路 理 ntop 路 狀 unix top 令 狀 top 見 錄 路 理 路流量 路 路流量 1. 料 不 IP 料量 數量 2. IP multicast 錄 量 數量 3. TCP 連 錄 立 路連 流量 料 4. UDP 料 量 5. TCP UDP 6. IP 7. 率 ntop 路 流量 行 類 列 流量 路 路 路 路 1
路 路流量 IP IP 類 路 料 類 料 量 路 路 路 理 路 理 ntop 流量 列 1. IP 2. 路 路 3. 路 例 outlook ntop 浪 4. 路 濫 例 proxy 行 HTTP FTP 5. 不 例 Novell IPX 6. 度 例 Iptraf Iptraf Linux console 錄 路 TCP/UDP 錄 連 狀 錄 路 狀 Fedora Linux 裡 了 行 [root@net122 root]#wget ftp://linux.sinica.edu.tw/fedora/linux/core/1/i386/os/fedora/rpms/iptraf-2.7.0-8.i386. rpm [root@net122 root]rpm -ivh iptraf-2.7.0-8.i386.rpm Iptraf IP 路 列 來 了 TCP ICMP 錄 OSPF 路 IP TCP UDP ICMP non-ip IP 錄 了 IP checksum errors interface activity packet size counts 錄 了 TCP UDP 錄 路 2
濾 TCP UDP 列 來 理 錄 Ethernet FDDI ISDN SLIP PPP loopback 利 Linux 路 Iptraf Iptraf 了 IP TCP UDP ICMP IGMP IGP IGRP OSPF ARP RARP 令 來 行 錄 iptraf { [ -f ] [ -q ] [ { -i iface -g -d iface -s iface -z iface -l iface } [ -t timeout ] [ -B [ -L logfile ] ] ] [ -h ] } -i iface Iptraf 來 路 -i all 來 路 -g Iptraf 易 數量 -d iface Iptraf 數量 -s iface Iptraf 數 類來 類 -z iface 來 行 類 -l iface -i 不 利 MAC 來 行 -t timout Iptraf -B /dev/null 行 3
-L logifle 錄 detail 易 general 路 來 /var/log/iptraf 錄 -f 數 參數 來 復 -h 令 Sniffit Sniffit 利 來 shareware TCP/IP 不 行 TCP/IP 行 兩 錄 來 行 sniffit 行 句 說 sniffit 來 行 不 4. ntop 列 ntop http://sourceforge.net/ search net-snmp-5.0.9.tar.gz ntop-2.2-0.i386.rpm rrdtool-1.0.41-1.8.0.ntop.i386.rpm [root@net122 root]# wget 4
http://heanet.dl.sourceforge.net/sourceforge/net-snmp/net-snmp-5.0.9.tar.gz [root@net122 root]# wget http://heanet.dl.sourceforge.net/sourceforge/ntop/rrdtool-1.0.41-1.8.0.ntop.i386.rpm [root@net122 root]# wget http://heanet.dl.sourceforge.net/sourceforge/ntop/ntop-2.2-0.i386.rpm net-snmp [root@net122 root]#tar xvfz net-snmp-5.0.9.tar.gz [root@net122 root]# cd net-snmp-5.0.9 [root@net122 net-snmp-5.0.9]#./configure ; make; make install rrdtool ntop [root@net122 root]#rpm -ivh --nodeps rrdtool-1.0.41-1.8.0.ntop.i386.rpm [root@net122 root]#rpm -ivh --nodeps ntop-2.2-0.i386.rpm [root@net122 root]# ln -sf /lib/libssl.so.0.9.7a /lib/libssl.so.2 [root@net122 root]# ln -sf /lib/libcrypto.so.0.9.7a /lib/libcrypto.so.2 [root@net122 root]# mkdir /var/ntop [root@net122 root]#/usr/bin/ntop @/etc/ntop.conf -A 理 web 料 理 admin Please enter the password for the admin user: xxxxxxx Please enter the password again: xxxxxxx 17/Feb/2004 14:59:09 Admin user password has been set ntop [root@net122 init.d]# /etc/rc.d/init.d/ntop restart http://<your_ip>:3000 ntop port 3000 若 SSL 連 /etc/ntop.conf ntop port 3001 SSL 5
連 http://192.192.73.122:3000 行連 ntop 連 ntop ntop /etc/ntop.conf 錄 6
# ntop 行 Sets the user that ntop runs as. # 來說都 ntop --user ntop # ntop 錄 --db-file-path /usr/share/ntop # 路 eth0 若 NAT eth1 # ip 流量 #--interface eth0 # port mirroring SPAN ntop 不 MAC #--no-mac # syslog 錄 #--use-syslog # ntop Hub #--track-local-hosts # HTTP webserver 連 port port 3000 --http-server 3000 # HTTPS webserver 連 port http https 來連 --https-server 3001 # 路 #--local-subnets xx.xx.xx.xx/yy # domain. #--domain mydomain.com # rrd # --reuse-rrd-graphics # ntop daemon 行 --daemon 7
ntop Total All Protocol 列 路 流量 192.192.73.0/24 ee.oit.edu.tw /etc/ntop.conf interface eth0 狀 列 Host Domain Data TCP UDP ICMP DLC IPX Decnet (R)ARP AppleTalk OSPF NetBios IGMP OSI IPv6 STP Other /etc/ntop.conf interface eth1 狀 IP 兩 192.168.1.119 192.168.1.254 8
濾 ntop 列 串 流量 filter expression 濾 Admin ChangeFilter 裡 user admin net 192.192.73.0/24 列 net 192.192.73.0/24 流量 濾 參 tcpdump filter expression host 192.192.73.122 列 192.192.73.122 流量 net 192.192.73.0/24 列 192.192.73.0/24 流量 port ftp-data 列 ftp 流量 9
數 了 不 什 不 192.192.73.0/24 連 列 來 192.192.73.119 ftp.nsysu.edu.tw FTP 料 38.2MB 192.192.73.119 Host 192.192.73.119 更 狀 說 狀 狀 率 10
率 Throughput 192.192.73.119 ftp.nsysu.edu.tw 率 11
數 來 度 550 Kbps Host Domain Data Packets Current Avg Peak Current Avg Peak 192.192.73.119 9.2 Kbps 550.5 Kbps 5.4 Mbps 6.8 Pkts/sec 76.2 Pkts/sec 778.1 Pkts/sec ftp.nsysu.edu.tw 0.0 bps 541.8 Kbps 5.4 Mbps 0.0 Pkts/sec 72.5 Pkts/sec 756.4 Pkts/sec Host Activity 流量 狀 來 狀 狀 Status Traffic 數 TTL 路 狀 12
路 Status Network Load 類 MRTG 流量 00:57~01:07 01:29~01:27 兩 路流量 192.192.73.119 ftp.nsysu.edu.tw ISO 來 流量 13
流量 錄 Admin Reset Stats 流量 零 ntop 了 路流量 了 流量 連 http 料 ftp 都 錄 例 192.192.73.120 連 digital.oit.edu.tw ftp baym-gw33.msgr.hotmail.com http 連 MSN 14
行 Iptraf 料 都 說 來 行 iptraf 令 [root@net122 /]# iptraf 數 IP traffic monitor All interfaces 15
易 路 流 General interface statistics 16
流 Detailed interface statistics eth0 來 行 類 Statistical breakdowns... By packet size 17
來 行 類 Statistical breakdowns... By TCP/UDP port 18
若 MAC Address 來 LAN station monitor 19
Filters... 192.192.73.122 TCP 立 TCP Define new filter... IP test 來 Enter CTRL + X Apply filter... test 了 來 都 192.192.73.122 20
TCP 都 192.192.73.122 UDP 來 行 Configure... TCP/UDP service names TCP UDP Logging 行 錄 行 都 21
Activity mode kbytes/s kbits/s Timers Iptraf Additional ports... Delete port/range... 1024 port 狀 Iptraf Iptraf 不 路 路 理 了 路 流量 連 狀 不 了 Sniffit sniffit Freshmeat http://freshmeat.net/ 連 http://reptile.rug.ac.be/~coder/sniffit/sniffit.html 來 sniffit 令 [root@net122 root]#wget http://reptile.rug.ac.be/~coder/sniffit/files/sniffit.0.3.7.beta.tar.gz [root@net122 root]# tar zxvf sniffit.0.3.7.beta.tar.gz sniffit.0.3.7.beta 錄 錄 都 了 sniffit 令來 sniffit [root@net122 sniffit.0.3.7.beta]#./configure sn_structs.h 行 _32_bit short source_port, destination_port; short 離 32_bit source_port, destination_port; 22
來 行 make 令 [root@net122 sniffit.0.3.7.beta]#make sniffit 行 令 來 sniffit -v -t <IP nr/name> 行 sniffit IP -i -c <File> 來 sniffit -F <device> sniffit 路 -n ARP RARP 不 IP 來 來 令 -i 參數 -d 16 -a ASCII -A <char> 不 識 <char> -P protocol TCP IP TCP ICMP UDP -p <port> port 0 -l 300bytes 行 來 行 例 例./sniffit -p 21 -t 61.62.103.105 說 連 61.62.103.105 ftp port 行 來 錄 [root@net122 sniffit.0.3.7.beta]# less 192.192.73.122.35989-61.62.103.105.21 USER linul PASS 123456 SYST 例 23
./sniffit -p 22 -l 1000-t 61.62.103.105 說 連 61.62.103.105 ssh port 行 1000bytes 來 錄 [root@net122 sniffit.0.3.7.beta]# less 192.192.73.122.35990-61.62.103.105.22 "192.192.73.122.35990-61.62.103.105.22" may be a binary file. See it anyway? SSH-2.0-OpenSSH_3.5p1 ^@^@^B^\ ^T? z) ^A?G@^@^@=diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1 ^@^@^@^Ossh-rsa,ssh-dss^@^@^@f aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndae l-cbc@lysator.liu.se^@^@^@faes128-cbc,3des-cbc,blo wfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se^@ @^@Uhmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd1 60@openssh.com,hmac-sha1-96,hmac-md5- ssh 行 亂 例./sniffit -p 21 -d -t 61.62.103.105 說 連 61.62.103.105 ftp port 行連 狀 連 行 sniffit 來 行 令./sifferit -c 24
select from host 192.192.73.2 select to host 192.192.73.120 select both port 22 192.192.73.2 192.192.73.120 22 port 錄 來 錄 192.192.73.2 192.192.73.120 port22 讀 README.FIRST 行 sniffit -i 令 [root@net122 sniffit.0.3.7.beta]#./sniffit -i 路 IP 了 port 令 列 q: 離 r: 連 n: TCP IP ICMP UDP 流量 25
g: F1: 來 IP ALL F2: IP ALL F3: 來 port ALL F4: port ALL 5. 論 1. 利 ntop 來 2. 參 24 ntop 3000,3001 3. ntop MRTG 異 4. Iptraf 料 5. Snffit 料 6. 流量 26