
Expert
•
9.4K Messages
How To Measure Your Internet Usage Using VLANs and MRTG
With all the talk of the possible upcoming internet usage caps, I was wondering if there was a way that I could measure my own internet usage. Although it looks like AT&T will provide us a usage meter that we can check to see the total usage on our own accounts, I wanted to see if I could measure my own usage myself as a cross-check on AT&T.
Some people have suggested downloading and installing a personal internet usage meter on your computer. While this works well in single-computer environments, it doesn't solve the problem when there is more than one computer on your network. You need a measurement system that can measure all internet traffic from all computers and internet devices.
A while back, I came up with a method that could measure the RG's total bandwidth usage using MRTG. (See this thread over at UverseUsers). However, this only showed total bandwidth, without regard to what bandwidth was being consumed by TV and what was being used by computers. Since the proposed internet usage limits would be on computer use only, I needed a method to split the bandwidth usage statistics into IPTV and Internet.
To do this, I split up my network using VLAN-capable switches, and then used MRTG to measure only the computer bandwidth portion.
The switches I'm using are Netgear GS-108T switches, which can be had for only $79.00 each for an 8-port Gigabit managed switch -- a really good bargain. The following is a diagram of my home network -- all connections throughout my network are Cat5e (no coax is used):
The trick is that the main switch (Switch 1) is uplinked to the RG twice. Port 1 is a member of VLAN 1, which is carrying all Internet traffic, and port 2 is a member of VLAN 2, carrying IPTV traffic. This enables MRTG to query port 1 of the switch to get traffic counters for only Internet traffic. All IPTV traffic travels to/from the RG through port 2, so that traffic is not included in the port 1 counters.
The green lines on the diagram are Cat5e links that are carrying 802.1q VLAN-tagged frames. These Ethernet frames have an additional header on them that tells the switch what VLAN they belong to. When they get to the switch on the other end, that switch strips off the VLAN tag, and switches the packet only to the ports allowed by that VLAN. What this essentially means is that the only place in the network where packets can go from VLAN 1 to VLAN 2 (or vice versa) is through the RG. So, if Desktop 1 tries to ping the Office STB, the ping packet will travel all the way up to the RG and back to reach the Office STB.
The reason that switch 1 is uplinked to the RG twice is because the RG is not VLAN-aware. To the RG, it looks like all 3 STBs are on port 2, and all computer hardware is on port 1. The RG doesn't know that the network is actually mixed together.
The computer labeled as the video server actually runs MRTG. It queries both the RG (for total VDSL statistics, error counts, and line sync rate/capacity) and switch 1 (to get traffic counters for IPTV and Internet off ports 1 and 2). These parameters are graphed on the MRTG summary page (available here).
The final graph on that page, which shows the total Internet data transferred for the last 30 days, is generated on the fly from the MRTG log files. If anyone is interested and wants to set this up themselves, I'll provide the source code for that (it's VBscript/ASP).
Here's some other examples of how data flows through the network for various functions:
1. Watching a live TV program on the Office STB. Note that this traffic doesn't get counted as Internet traffic because it goes through port 2 of switch 1 (only traffic through port 1 of switch 1 gets counted by MRTG):
2. Watching a DVD from the Video Server on the Living Room XBox Media Center. Note that this traffic doesn't get counted anywhere by MRTG because it doesn't traverse port 1 of switch 1:
3. Downloading a file from the Internet to Desktop 2. This gets counted as Internet traffic since it flows through switch 1 port 1:
4. Now the really cool one. Watching a recorded program from the DVR, using THDVR, from a remote location using the Slingbox. This will get counted as Internet traffic in the upload direction as it traverses switch 1 port 1:
Now, here are some problems you may run into with the above setup:
1. Coax devices cannot get their traffic counted. Now, this isn't a problem if you're only interested in counting Internet traffic. However, if you have used the trick where you have an STB connected via coax, and then have used the Cat5e port on the STB as a bridge to a computing device, you won't be able to count the traffic from that computing device.
2. You cannot use the RG's built-in wireless if you want to count that traffic. You must use an external 802.11g/n wireless access point connected to the Internet VLAN to get wireless devices' traffic counted. This is why I have shown a wireless access point in my diagrams (I haven't installed that yet).
3. MRTG runs as a service, so it's required to be installed on a computer that runs 24/7.
I know this setup goes beyond what many people may want to do, but I hope it gives you some ideas of what you might want to try with your network.
Accepted Solution
Official Solution
SomeJoe7777
Expert
•
9.4K Messages
12 years ago
The graphics from the first post were lost in the forum move a few months ago, so I'm reposting them here.
Master diagram:
1. Watching a live TV program on the Office STB. Note that this traffic doesn't get counted as Internet traffic because it goes through port 2 of switch 1 (only traffic through port 1 of switch 1 gets counted by MRTG):
2. Watching a DVD from the Video Server on the Living Room XBox Media Center. Note that this traffic doesn't get counted anywhere by MRTG because it doesn't traverse port 1 of switch 1:
3. Downloading a file from the Internet to Desktop 2. This gets counted as Internet traffic since it flows through switch 1 port 1:
4. Now the really cool one.
Watching a recorded program from the DVR, using THDVR, from a remote location using the Slingbox. This will get counted as Internet traffic in the upload direction as it traverses switch 1 port 1:
0
0
SkykingUSA_1
Mentor
•
69 Messages
15 years ago
0
0
CGI_1
Guru
•
397 Messages
15 years ago
0
0
SomeJoe7777
Expert
•
9.4K Messages
15 years ago
I thought about using Visio, but I just whipped these up in Photoshop. Basically each element is in its own layer so I could move them around while making the diagram. If you want to downlaod the Photoshop document, it's available here.
0
0
Escapee
Employee
•
3.9K Messages
15 years ago
0
0
Computer_Joe
Master
•
5.9K Messages
15 years ago
0
0
SkykingUSA_1
Mentor
•
69 Messages
15 years ago
Thanks, that's great.
Also thanks to the other Joe for posting the link to the Console.
0
0
Computer_Joe
Master
•
5.9K Messages
15 years ago
Holy cow, I had a T2 tech call my network "scary" because I had more than one switch in my setup. The poor guy they sent to you must have crapped his pants and jumpped out the window
0
0
spd2demun
Expert
•
24.3K Messages
15 years ago
0
0
Jvinz
Teacher
•
23 Messages
15 years ago
Kudos given!
Nice diagram. Nobody can done it better.
0
0