{"id":414,"date":"2011-11-07T06:05:33","date_gmt":"2011-11-07T06:05:33","guid":{"rendered":"http:\/\/www.ubuntupirates.com\/?p=414"},"modified":"2011-11-07T06:05:33","modified_gmt":"2011-11-07T06:05:33","slug":"how-to-monitor-network-traffic-with-vnstat-in-ubuntu","status":"publish","type":"post","link":"https:\/\/www.jameseduard.com\/?p=414","title":{"rendered":"How to Monitor Network Traffic with vnStat in Ubuntu"},"content":{"rendered":"<p><strong>vnStat<\/strong> is an open source network monitoring tool and network traffic logger for any selected network interface (eth0, wlan0, etc.). It allows to sniff and gather data from multiple interfaces at the same time by avoiding the abuse of system resources.<br \/>\n<strong>vnStat<\/strong> can be easily installed in a Linux-based system and it requires at least kernel 2.2 to run. This tool can be used with or without root privileges.<br \/>\n<strong>vnStat Installation (Console Mode)<\/strong><br \/>\nTo install vnStat on Ubuntu, run this command:<\/p>\n<pre>sudo apt-get install vnstat libgd2-xpm<\/pre>\n<p>Let&#8217;s now create the database where traffic data will be stored into (For my part, I will monitor my wired network connection: &#8220;eth0&#8221;, but you can change it to your own network interface &#8212;&gt; eth1, eth2, etc.):<\/p>\n<pre>sudo vnstat -u -i eth0<\/pre>\n<p>For wireless connections, use this command (wlan0, wlan1, etc.):<\/p>\n<pre>sudo  vnstat -u -i wlan0<\/pre>\n<p>Wait now at least five minutes while network traffic data are being gathered, then run this command to start monitoring:<\/p>\n<pre>vnstat<\/pre>\n<p><strong>vnStat Installation (Graphic Mode)<\/strong><br \/>\nTo use vnStat via a graphical interface, then follow these steps:<br \/>\n1. Open the Terminal and install first PHP5 and Apache2 using these commands:<\/p>\n<pre>sudo apt-get install php5\nsudo apt-get install apache2\nsudo \/etc\/init.d\/apache2 restart<\/pre>\n<p>2. Run now this command:<\/p>\n<pre>cd \/var\/www<\/pre>\n<p>3. Inside this folder (\/var\/www) run these commands to download and unpack the script files (root permissions required):<\/p>\n<pre>sudo wget http:\/\/www.sqweek.com\/sqweek\/files\/vnstat_php_frontend-1.4.1.tar.gz\nsudo tar xvzf vnstat_php_frontend-1.4.1.tar.gz\nsudo mv vnstat_php_frontend-1.4.1 vnstat<\/pre>\n<p>4. You can then access the web interface via one of these two links:<\/p>\n<pre>http:\/\/localhost\/vnstat\/\nor\nhttp:\/\/127.0.0.1\/vnstat\/<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>vnStat is an open source network monitoring tool and network traffic logger for any selected network interface (eth0, wlan0, etc.). It allows to sniff and gather data from multiple interfaces at the same time by avoiding the abuse of system resources. vnStat can be easily installed in a Linux-based system and it requires at least<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47,23,10],"tags":[223,43,44,224],"class_list":["post-414","post","type-post","status-publish","format-standard","hentry","category-how-tos","category-linux","category-networking","tag-internet-tool","tag-network-traffic","tag-networking","tag-vnstat"],"_links":{"self":[{"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=\/wp\/v2\/posts\/414","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=414"}],"version-history":[{"count":0,"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=\/wp\/v2\/posts\/414\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=414"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=414"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=414"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}