{"id":5,"date":"2019-02-19T21:33:39","date_gmt":"2019-02-19T21:33:39","guid":{"rendered":"http:\/\/wordpress.aliendave.uk\/?p=5"},"modified":"2019-02-21T14:07:51","modified_gmt":"2019-02-21T14:07:51","slug":"raspberry-pi-ntopng-network-monitor","status":"publish","type":"post","link":"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/","title":{"rendered":"Raspberry Pi + Ntopng Network Monitor"},"content":{"rendered":"\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"654\" src=\"http:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/live-1024x654.png\" alt=\"\" class=\"wp-image-132\" srcset=\"https:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/live-1024x654.png 1024w, https:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/live-300x192.png 300w, https:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/live-768x491.png 768w, https:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/live.png 1152w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-gallery columns-2 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"533\" src=\"http:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/Applications-1024x533.png\" alt=\"\" data-id=\"131\" data-link=\"http:\/\/wordpress.aliendave.uk\/applications\/\" class=\"wp-image-131\" srcset=\"https:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/Applications-1024x533.png 1024w, https:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/Applications-300x156.png 300w, https:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/Applications-768x400.png 768w, https:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/Applications.png 1338w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"758\" height=\"365\" src=\"http:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/traffic.png\" alt=\"\" data-id=\"130\" data-link=\"http:\/\/wordpress.aliendave.uk\/traffic\/\" class=\"wp-image-130\" srcset=\"https:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/traffic.png 758w, https:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/traffic-300x144.png 300w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure><\/li><\/ul>\n\n\n\n<p>As most broadband routers don&#8217;t actually give you a lot of information about your network traffic I thought I would try and see what I could do with my Raspberry <g class=\"gr_ gr_7 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace\" id=\"7\" data-gr-id=\"7\">pi<\/g>. Quite a lot as it turns out.<br>This guide takes some inspiration from <a href=\"http:\/\/blog.ronenb.com\/2016\/08\/20\/network-traffic-analyzer-with-raspberrypi\/\">Ronem Baram&#8217;s<\/a> solution. The main difference here is that we are using <g class=\"gr_ gr_8 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling\" id=\"8\" data-gr-id=\"8\">ntop<\/g>&nbsp;rather than his script for network analysis and <g class=\"gr_ gr_58 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace\" id=\"58\" data-gr-id=\"58\">dnsmasq<\/g> to handle DNS and DHCP.<\/p>\n\n\n\n<p><strong>Requirements:<\/strong><br>Rasbian (Stretch)<br><a href=\"https:\/\/www.ntop.org\/\">Ntopng<\/a> <br>Raspberry Pi 3B+ (Lower specs work but <g class=\"gr_ gr_7 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling\" id=\"7\" data-gr-id=\"7\">ntopng<\/g> is quite CPU intensive)<br><a href=\"http:\/\/www.thekelleys.org.uk\/dnsmasq\/doc.html\"><g class=\"gr_ gr_8 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling\" id=\"8\" data-gr-id=\"8\">dnsmasq<\/g><\/a><br>A working <g class=\"gr_ gr_57 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace\" id=\"57\" data-gr-id=\"57\">iptables<\/g> configurati<\/p>\n\n\n\n<p>Essential what we are going to do is use dnsmasq to set the default gateway on client devices so that all traffic is routed via the pi. The pi then forwards on the traffic to you broadband router. This works for both wired and wifi clients.  Bear in mind that if you have superfast broadband ie over 150Mbs this is going to create a bottleneck and slow down your connection to the internet. If that were the case I would suggest a different SoC board with true GbE rather than the Pi. Local traffic will not be affected (or monitored) as it is on the same subnet and will not route via the Pi<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/Untitled-Diagram-1.png\" alt=\"\" class=\"wp-image-113\" width=\"286\" height=\"321\" srcset=\"https:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/Untitled-Diagram-1.png 482w, https:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/Untitled-Diagram-1-267x300.png 267w\" sizes=\"auto, (max-width: 286px) 100vw, 286px\" \/><\/figure>\n\n\n\n<p>Installing Ntop:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo su<br>wget http:\/\/packages.ntop.org\/apt\/ntop.key<br>apt-key add ntop.keyRaspbian Stretch (9.x) [Active]echo \"deb http:\/\/apt.ntop.org\/stretch_pi armhf\/\" &gt; \/etc\/apt\/sources.list.d\/ntop.list<br>echo \"deb http:\/\/apt.ntop.org\/stretch_pi all\/\" &gt;&gt; \/etc\/apt\/sources.list.d\/ntop.list<br>apt-get update<br>apt-get install ntopng nprobe<br><\/pre>\n\n\n\n<p>Installing dnsmasq:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt-get install dnsmasq<\/pre>\n\n\n\n<p>Configure <g class=\"gr_ gr_9 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling\" id=\"9\" data-gr-id=\"9\">dnsmasq<\/g>.  Assuming your pi&#8217;s address is 192.168.0.2 edit \/etc\/dnsmasq.cof&nbsp;as&nbsp;follows <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> # Remote DNS server<br> server=8.8.8.8<br> dhcp-range=192.168.0.50,192.168.0.99,12h<br> #subnet mask<br> dhcp-option=1,255.255.255.0<br> #gateway<br> dhcp-option=3,192.168.0.2<br> #dns<br> dhcp-option=6,192.168.0.2<br> log-dhcp<br> dhcp-authoritative<\/pre>\n\n\n\n<p> Enable routing\/IP forwarding :<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> sysctl -w net.ipv4.ip_forward=1 <\/pre>\n\n\n\n<p>This will be temporary so edit  \/etc\/sysctl.conf  and add or un-comment the line below to make the change permanent.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">net.ipv4.ip_forward = 1 <\/pre>\n\n\n\n<p>Add an appropriate rule to your IP tables script and restart IP tables.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">-A POSTROUTING -o eth0 -j MASQUERADE<\/pre>\n\n\n\n<p>You should now be able view your netowrk traffic via:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">http:\/\/&lt;your\u00a0Pi IP>:3000\/ <\/pre>\n\n\n\n<p>Ntopng really gives you loads of info. I have only really just scratched the surface of using it. Enjoy<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As most broadband routers don&#8217;t actually give you a lot of information about your network traffic I thought I would try and see what I could do with my Raspberry pi. Quite a lot as it turns out.This guide takes some inspiration from Ronem Baram&#8217;s solution. The main difference here is that we are using &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Raspberry Pi + Ntopng Network Monitor&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-5","post","type-post","status-publish","format-standard","hentry","category-tech"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Raspberry Pi + Ntopng Network Monitor - Alien @ Home<\/title>\n<meta name=\"description\" content=\"Analyse your home network traffic utilising as raspberry pi and ntop.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Raspberry Pi + Ntopng Network Monitor - Alien @ Home\" \/>\n<meta property=\"og:description\" content=\"Analyse your home network traffic utilising as raspberry pi and ntop.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/\" \/>\n<meta property=\"og:site_name\" content=\"Alien @ Home\" \/>\n<meta property=\"article:published_time\" content=\"2019-02-19T21:33:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-02-21T14:07:51+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/live-1024x654.png\" \/>\n<meta name=\"author\" content=\"davekp\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"davekp\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/\",\"url\":\"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/\",\"name\":\"Raspberry Pi + Ntopng Network Monitor - Alien @ Home\",\"isPartOf\":{\"@id\":\"https:\/\/wordpress.aliendave.uk\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/live-1024x654.png\",\"datePublished\":\"2019-02-19T21:33:39+00:00\",\"dateModified\":\"2019-02-21T14:07:51+00:00\",\"author\":{\"@id\":\"https:\/\/wordpress.aliendave.uk\/#\/schema\/person\/db81f255b38f625f947d54df5c626a87\"},\"description\":\"Analyse your home network traffic utilising as raspberry pi and ntop.\",\"breadcrumb\":{\"@id\":\"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/#primaryimage\",\"url\":\"http:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/live-1024x654.png\",\"contentUrl\":\"http:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/live-1024x654.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/wordpress.aliendave.uk\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Raspberry Pi + Ntopng Network Monitor\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/wordpress.aliendave.uk\/#website\",\"url\":\"https:\/\/wordpress.aliendave.uk\/\",\"name\":\"Alien @ Home\",\"description\":\"A few random things\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/wordpress.aliendave.uk\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/wordpress.aliendave.uk\/#\/schema\/person\/db81f255b38f625f947d54df5c626a87\",\"name\":\"davekp\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wordpress.aliendave.uk\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/75d25da0d0ec7062dfce82d383e2c97c42645fed67a2852332e69c25b13a7d9c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/75d25da0d0ec7062dfce82d383e2c97c42645fed67a2852332e69c25b13a7d9c?s=96&d=mm&r=g\",\"caption\":\"davekp\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Raspberry Pi + Ntopng Network Monitor - Alien @ Home","description":"Analyse your home network traffic utilising as raspberry pi and ntop.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/","og_locale":"en_US","og_type":"article","og_title":"Raspberry Pi + Ntopng Network Monitor - Alien @ Home","og_description":"Analyse your home network traffic utilising as raspberry pi and ntop.","og_url":"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/","og_site_name":"Alien @ Home","article_published_time":"2019-02-19T21:33:39+00:00","article_modified_time":"2019-02-21T14:07:51+00:00","og_image":[{"url":"http:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/live-1024x654.png","type":"","width":"","height":""}],"author":"davekp","twitter_card":"summary_large_image","twitter_misc":{"Written by":"davekp","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/","url":"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/","name":"Raspberry Pi + Ntopng Network Monitor - Alien @ Home","isPartOf":{"@id":"https:\/\/wordpress.aliendave.uk\/#website"},"primaryImageOfPage":{"@id":"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/#primaryimage"},"image":{"@id":"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/#primaryimage"},"thumbnailUrl":"http:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/live-1024x654.png","datePublished":"2019-02-19T21:33:39+00:00","dateModified":"2019-02-21T14:07:51+00:00","author":{"@id":"https:\/\/wordpress.aliendave.uk\/#\/schema\/person\/db81f255b38f625f947d54df5c626a87"},"description":"Analyse your home network traffic utilising as raspberry pi and ntop.","breadcrumb":{"@id":"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/#primaryimage","url":"http:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/live-1024x654.png","contentUrl":"http:\/\/wordpress.aliendave.uk\/wp-content\/uploads\/2019\/02\/live-1024x654.png"},{"@type":"BreadcrumbList","@id":"https:\/\/wordpress.aliendave.uk\/index.php\/2019\/02\/19\/raspberry-pi-ntopng-network-monitor\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wordpress.aliendave.uk\/"},{"@type":"ListItem","position":2,"name":"Raspberry Pi + Ntopng Network Monitor"}]},{"@type":"WebSite","@id":"https:\/\/wordpress.aliendave.uk\/#website","url":"https:\/\/wordpress.aliendave.uk\/","name":"Alien @ Home","description":"A few random things","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wordpress.aliendave.uk\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/wordpress.aliendave.uk\/#\/schema\/person\/db81f255b38f625f947d54df5c626a87","name":"davekp","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wordpress.aliendave.uk\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/75d25da0d0ec7062dfce82d383e2c97c42645fed67a2852332e69c25b13a7d9c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/75d25da0d0ec7062dfce82d383e2c97c42645fed67a2852332e69c25b13a7d9c?s=96&d=mm&r=g","caption":"davekp"}}]}},"_links":{"self":[{"href":"https:\/\/wordpress.aliendave.uk\/index.php\/wp-json\/wp\/v2\/posts\/5","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.aliendave.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.aliendave.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.aliendave.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.aliendave.uk\/index.php\/wp-json\/wp\/v2\/comments?post=5"}],"version-history":[{"count":40,"href":"https:\/\/wordpress.aliendave.uk\/index.php\/wp-json\/wp\/v2\/posts\/5\/revisions"}],"predecessor-version":[{"id":177,"href":"https:\/\/wordpress.aliendave.uk\/index.php\/wp-json\/wp\/v2\/posts\/5\/revisions\/177"}],"wp:attachment":[{"href":"https:\/\/wordpress.aliendave.uk\/index.php\/wp-json\/wp\/v2\/media?parent=5"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.aliendave.uk\/index.php\/wp-json\/wp\/v2\/categories?post=5"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.aliendave.uk\/index.php\/wp-json\/wp\/v2\/tags?post=5"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}