¦w¸ËNfsen
¦w¸ËNfsen©Ò»Ý¬ÛÃö®M¥ó¡C
apt-get install nfdump apache2 libapache2-mod-php5 php5-common rrdtool librrds-perl librrdp-perl librrd-dev libmailtools-perl libio-socket-ssl-perl
¤U¸ü¸ÑÀ£Nfsen¡C
cd /usr/src/
wget http://sourceforge.net/projects/nfsen/files/stable/nfsen-1.3.6p1/nfsen-1.3.6p1.tar.gz
tar zvxf nfsen-1.3.6p1.tar.gz
cd nfsen-1.3.6p1
¦w¸ËSocket6 perl¼Ò²Õ¡C
perl -MCPAN -e 'install Socket6'
µM«á½Æ»sNfsen³]©wÀÉ nfsen-dist.conf ¨ì¨t²Î¥Ø¿ý¤U¡C
cp /usr/src/nfsen-1.3.6p1/etc/nfsen-dist.conf /etc/nfsen.conf
±µµÛ½s¿è¨t²Î¥Ø¿ý¤UªºNfsen³]©wÀÉ /etc/nfsen.conf¡C
vim /etc/nfsen.conf
##ì³]©wÀɤº®e
$BASEDIR = "/data/nfsen";
$HTMLDIR = "/var/www/nfsen/";
$PREFIX = '/usr/local/bin';
...
$USER = "netflow";
$WWWUSER = "www";
$WWWGROUP = "www";
...
%sources = (
'upstream1' => { 'port' => '9995', 'col' => '#0000ff', 'type' => 'netflow' },
'peer1' => { 'port' => '9996', 'IP' => '172.16.17.18' },
'peer2' => { 'port' => '9996', 'IP' => '172.16.17.19' },
);
##Åܧó«á¤º®e
$BASEDIR = "/usr/local/nfsen";
$HTMLDIR = "/var/www/html/nfsen/";
$PREFIX = '/usr/bin/';
...
$USER = "www-data";
$WWWUSER = "www-data";
$WWWGROUP = "www-data";
...
%sources = (
'MyRouter' => { 'port' => '9995', 'col' => '#0000ff', 'type' => 'netflow' },
);
½Ðª`·N³]©w¤¤Àɤ¤ªº°Ñ¼Æ $BASEDIR,
¦¹°Ñ¼Æ¹ïÀ³ªº¸ô®|¤w§ï¬° /usr/local/nfsen¡A¦¹¥Ø¿ý¨Ã¤£¦s¦b¡A©Ò¥Hn·s«Ø¦¹¤@¥Ø¿ý¡C
mkdir -p /usr/local/nfsen
¥t¥~1.3.6p1ªº¦w¸ËÀɦ³¤@Ó Socket6 ªºbugn³B²z¡A
½Ðקï¸ÑÀ£«á libexec ¥Ø¿ý¤Uªº AbuseWhois.pm ¤Î Lookup.pm ¨âÓÀɮסC
±N
use Socket6;
§ï¬°
Socket6->import(qw(pack_sockaddr_in6 unpack_sockaddr_in6 inet_pton getaddrinfo));
³o¼Ë±µ¤U¨Ó¦w¸Ë¤~¯à¶¶§Q¦w¸Ë§¹¦¨¡A¤£µM·|¥X²{¦p¤Uªº¿ù»~¡I
Subroutine Lookup::pack_sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm line 67.
at /var/nfsen/libexec/Lookup.pm line 43
Subroutine Lookup::unpack_sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm line 67.
at /var/nfsen/libexec/Lookup.pm line 43
Subroutine Lookup::sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm line 67.
at /var/nfsen/libexec/Lookup.pm line 43
Subroutine AbuseWhois::pack_sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm line 67.
at /var/nfsen/libexec/AbuseWhois.pm line 42
Subroutine AbuseWhois::unpack_sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm line 67.
at /var/nfsen/libexec/AbuseWhois.pm line 42
Subroutine AbuseWhois::sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm line 67.
at /var/nfsen/libexec/AbuseWhois.pm line 42
Subroutine AbuseWhois::pack_sockaddr_in6 redefined at /var/nfsen/libexec/AbuseWhois.pm line 44
Subroutine AbuseWhois::unpack_sockaddr_in6 redefined at /var/nfsen/libexec/AbuseWhois.pm line 44
Subroutine AbuseWhois::sockaddr_in6 redefined at /var/nfsen/libexec/AbuseWhois.pm line 44
קï¦n«á°õ¦æ¥Ø«e©Ò¦b¸ô®| /src/usr/nfsen-1.3.6p1 ùتº install.pl¡A¦õ¥H°Ñ¼ÆÀÉ /etc/nfsen.conf ùتº°Ñ¼Æ©w¸q¨Ó¦w¸ËNfsen¡C
./install.pl /etc/nfsen.conf
²Ä¤@¦¸¦w¸Ë·|µ²§ô¦b¦p¤Uªº¿ù»~°T®§¡A
Profile live: spool directories:
Creating: mkdir /usr/local/nfsen/profiles-data/live/MyRouter
MyRouter
Rename gif RRDfiles ... done.
Create profile info for profile 'live'
Can not get semaphore: at libexec/Nfsync.pm line 48.
¤£nºò¡A¦A°õ¦æ¤@¦¸´N¥i¥H¶¶§Q¹LÃö¡I
§¹¦¨«á¡A¤Á´«¨ì /usr/local/nfsen/bin ¸ô®|¤U±Ò°ÊNfsen¡ANfsenªº¦w¸Ë°ò¥»¤W´N§¹¦¨¤F¡ã
cd /usr/local/nfsen/bin
./nfsen start
³z¹Ltarball¦w¸Ë¦nªºNfsen¹w³]¬O¤£·|¦Û°Ê±Ò°Êªº¡A
§Ṳ́]¥i¥H§ânfsen«Ø¥ß¤@Ó³sµ²¨ì±Ò°Ê¥Ø¿ý /etc/init.d ¤¤¡AµM«á¥[¤JUbuntuªº¦Û°Ê±Ò°Ê¶µ¥ØùØ¡A
³o¼Ë§Y«K¬O«¶}¾÷Nfsen¤]·|ÀH¤§¦Û°Ê±Ò°Ê¡C
ln -s /usr/local/nfsen/bin/nfsen /etc/init.d/nfsen
update-rc.d nfsen defaults
¦w¸ËPortTracker´¡¥ó
½Ð¥ý¦b /usr/local/nfsen ¸ê®Æ§¨¤¤·s«Ø¤@Ó¸ê®Æ§¨ ports-db¡A¨Ã½á¤©Apache¨Ï¥ÎªÌwww-data°õ¦æÅv¡C
mkdir /usr/local/nfsen/ports-db
chown -R www-data:www-data /usr/local/nfsen/ports-db/
±µµÛ¤Á´«¨ì¦w¸ËÀɤ¤ contrib ¸ô®|¤U¡Aקï PortTracker.pm ³oÓÀɮסC
cd /usr/src/nfsen-1.3.6p1/contrib/PortTracker/
vim PortTracker.pm
±N $PORTSDBDIR ¸ô®|«ü¦V /usr/local/nfsen/ports-db¡C
my $PORTSDBDIR = "/usr/local/nfsen/ports-db";
µM«á½Æ»s PortTracker.pm »P PortTracker.php ³o¨âÓÀɮרì¹ïÀ³¥Ø¿ý¤¤¡C
cp PortTracker.pm /usr/local/nfsen/plugins/
cp PortTracker.php /var/www/html/nfsen/plugins/
¤§«á¦AקïNfsenªº¤º®e¡A§ä¨ì @plugins ¥[¤J PortTracker ³oÓ´¡¥ó¡C
vim /usr/local/nfsen/etc/nfsen.conf
@plugins = (
[ 'live', 'PortTracker'],
);
³Ì«á¦A½á¤©PortTracker¸ê®Æ§¨ ports-db ªº¾Ö¦³Åvµ¹apache¨Ï¥ÎªÌwww-data¡C
chown -R www-data:www-data /usr/local/nfsen/ports-db
µM«á¦A¥Hwww-data¨¥÷°õ¦æ nftrack ¨Ã±N¸ê®Æ²£¥Í¦b ports-db ¸ô®|¤§¤¤¡C
sudo -u www-data /usr/bin/nftrack -I -d /usr/local/nfsen/ports-db
³oÓ¶¥¬q·|ªá¤@ÂI®É¶¡²£¥Í¤j¶q¸ê®Æ¡AµwºÐªÅ¶¡·|¥Ñì¨Óªº 1.6G ¼É¼W¨ì 9.8G¡I
§¹¦¨«á¡A«Øij«¶}¾÷¡F
«¶}¾÷«áNfsen´N¯à¥¿±`¹B§@¤F¡ã