Build an In Line Network Bandwidth Monitor

netTap1

[Kurt] likes to know what’s going on with his network. He already uses bandwidth checking software on his DD-WRT capable router, but he wanted a second opinion. So he built his own network monitor. [Kurt] started by building a passive Ethernet tap. He then needed a network interface chip that would serve his purposes. The common Wiznet chips used with Arduinos didn’t allow enough manipulation of raw packet data, so he switched to a Microchip ENC624J600 (PDF). The Microchip controller allowed him to count the bytes in the raw Ethernet packets.

With the Ethernet interface complete, [Kurt] turned his attention to a microcontroller to run the show. He started with an Arduino, but the lack of debugging quickly sent him to an Atmega128 in Atmel Studio. After getting the basic circuit working, [Kurt] switched over to a PIC24F chip. With data finally coming out of the circuit, he was able to tell that his original back-of-the-napkin calculations for bandwidth were wrong. [Kurt] created a PCB to hold the microcontroller, then wrote a Python program to plot the data output from his circuit. The bandwidth plot matched up well with the plot from DD-WRT. Now he just needs a giant LED matrix to show off his current network stats!

Comments

  1. tekkieneet says:

    Thanks for the heads up for this ENC624J600 (10/100) chip.

    This is an interesting way of looking at the stats, he would only get
    either the transmitted or the received stats as he could only have 1
    receiver on the chip to snoop data.

    Ethernet switches inside the routers usually have (hardware) statistics
    on packet counts and byte counts on received/transmitted data on each of
    its ports. The router firmware could also be keeping its own stats while
    it is routing. Very unlikely the router is wrong as lots of people
    relies on that on parts of the world that have Internet usage quotas.

  2. brekk says:

    <3 my Kurg!

  3. voxnulla says:

    I’d like to see a comparison between the router data and the dedicated monitor’s data. Also, why go serial? The router is right there? A simple ethernet interface and you can collect your data from inside your LAN.

    • bonafidegeek says:

      I have a comparision with the DD-WRT plots here: https://www.bonafidegeek.com/media/bw_meter_plot_labels.png

      The goal for this project was to have a stand-alone device that wouldn’t require any special software or a specific router. I wanted to make a device that anyone could plug in between their router and cable modem and get data. I should not that the Python plot in the link above is temporary, I’d ultimately like to use something like an analog gauge or as hackaday recommened, a giant LED matrix.

      • voxnulla says:

        Yes, I commented to soon, I did come across them just now. Pretty good match that.

        For the readout, I meant an additional ethernet port with a service behind it that reports back the data when queried. Plug in in the LAN part and it would be out of the loop itself.

  4. m1ndtr1p says:

    He didn’t actually build the LAN tap, you can buy the exact same ones shown in the pic above over at: http://hakshop.myshopify.com/

  5. Tom says:

    In case anyone else wonders why a “lack” of debugging capability necessitates the need to move from the ATmega 328 chips, It doesn’t. The 328’s do indeed have debugging capability!

    It appears his programmer (Olimex AVR-JTAG-USB-A) only supports JTAG programming and debug methods, not the debugWire protocol offered by the ATMEGA 328.

  6. David says:

    It’s a neat setup, especially if you like fiddling with ethernet chips and microcontrollers. I considered a similar setup for my own bandwidth monitoring purposes. But ultimately, I settled on putting an old hub between my modem and my router, then connecting it to my PC running Wireshark. A single port can capture upload and download in that case, as well.

  7. Infidellic says:

    Being a pedant won’t this technically measure the traffic between the router and the modem (I’m assuming you don’t have CAT5 to your ISP)? The modem could add its own extra overheads

    • Infidellic says:

      Being a pedant on my own post – replace CAT5 with Ethernet

    • Greenaum says:

      That’s just data between his modem and the one at the other end. It’s a certain amount of overhead on top of the data, but who needs to know that? Between the modems they aren’t speaking Ethernet anyway. It’s the domain of modem makers and the people who maintain the copper wire. Irrelevant overhead. The “Internet” as it is spoken starts at his modem’s link socket to the network, which is where the tap is.

      • CAhrens says:

        I was working a project a few years back to tap into the cable side of the modem, primarily because I wanted to see what exactly was going over the wire. It drives me insane that despite owning the device, there is a small chunk of the board controlled purely by the ISP (some firmware that controls communication to the CMTS, performs rate-limiting and can disable your connection, amongst other things)

        I stopped working on it due to some extreme cost over-runs with the high cost of 5.8-Ghz RF components, a 5.8 Ghz Oscilloscope and a microcontroller that can handle the load of decoding the signal properly. I might pick this project up again now that I got my hands on a Zync-7000 dev kit and the prices on RF components has dropped significantly in the past few years.

  8. krinkleneck says:

    This is a great little device for excellent plotting. This keeps a good track on network usage. There is just one problem. Well, this is throughput… not bandwidth. He did mention the frequencies for a bit, but then he went on to check the throughput. Maybe I’m wrong, but this is a bit more significant problem than the baud vs bps confusion. Anyways this is an excellent development, and I look forward to future posts.

  9. KleenexCommando says:

    Every time I see where someone finds the limitations of ardunio and moves to a PIC, which smokes arduino in just about every respect, I feel a little more hope for humanity :D

  10. elmaragiah says:

    Reblogged this on Science and Technology Today.

  11. Jessie Wan says:

    Bandwith is the area of frequency used by a radio signal being transmitted. Say 14.100.005 Hz to 14.099.996 Hz giving a 10 Hz spread or width.
    What you describe is a network speed recording device and has nothing to do with bandwidth . Why do people insist on improperly using this term ? And this from someone who has been recently educated at a University and should know better?

  12. bonafidegeek says:

    @adamfabio Thanks for the LED matrix idea, it’s not giant, but it looks pretty cool.

    https://www.bonafidegeek.com/Bandwidth/#LED%20Matrix

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 96,421 other followers