Ben Stienstra

Linux, Unix, network, radio and more...

User Tools

Site Tools


nfsen_ubuntu

Ubuntu - NfSen

Install and configure NfSen on Ubuntu 16.04 LTS

  • NfSen 1.3.8
  • nfdump 1.6.13

Installation

  • Extract files.
    tar zxf nfdump-1.6.13.tar.gz
    tar zxf nfsen-1.3.7.tar.gz
  • Install development tools.
    apt-get update
    apt-get upgrade
    apt-get install build-essential
  • Install prerequisites.
    apt-get install autoconf rrdtool librrds-perl librrdp-perl librrd-dev libmailtools-perl apache2 libapache2-mod-php php bison flex libsocket6-perl liburi-perl libnet-idn-encode-perl
  • Create user netflow.
    useradd netflow
  • Add user netflow to apache group.
    usermod -G www-data netflow
  • Create seperate /opt filesystem (for lots of data).
  • Compile and install nfdump.
    cd nfdump-1.6.13
    ./configure --prefix=/opt/nfdump --enable-nfprofile
    autoreconf
    make
    make install
  • Install nfsen.
    cd nfsen-1.3.7
    cd etc
    cp nfsen-dist.conf nfsen.conf
    vi nfsen.conf
      $BASEDIR = "/opt/nfsen";
      $HTMLDIR = "/opt/nfsen/www/";
      $PREFIX  = '/opt/nfdump/bin';
      $WWWUSER  = "apache";
      $WWWGROUP = "apache";
    
      $MAIL_FROM   = 'nfsen@yourdomain.tld';
      $SMTP_SERVER = 'fqdn.mail.server';
      
      %sources = (
          'source1' => { 'port' => '9995', 'col' => '#0000ff', 'type' => 'netflow' },
          'source2' => { 'port' => '9996', 'col' => '#cc3333', 'type' => 'netflow' },
          'source3' => { 'port' => '9997', 'col' => '#99ff33', 'type' => 'netflow' },
      );
    
    cd ..
    sudo ./install.pl etc/nfsen.conf
  • Add apache config.
    <Directory "/opt/nfsen/www">
       AllowOverride None
       Require all granted
    </Directory>
    
    Alias /nfsen "/opt/nfsen/www"
  • Enable and start apache:
    systemctl enable apache2
    systemctl start apache2
  • Start nfsen.
    /opt/nfsen/bin/nfsen start

Auto start at boot

  • Create /etc/systemd/system/nfsen.service:
    [Unit]
    Description=NfSen Service
    After=network.target
    
    [Service]
    Type=forking
    PIDFile=/opt/nfsen/var/run/nfsend.pid
    ExecStart=/opt/nfsen/bin/nfsen start
    ExecStop=/opt/nfsen/bin/nfsen stop
    Restart=on-abort
    
    [Install]
    WantedBy=multi-user.target
  • Enable service:
    systemctl enable nfsen
    systemctl start nfsen
nfsen_ubuntu.txt · Last modified: 2017/10/14 09:38 by admin