Upgrading to Gigabit and Testing it with netcat
When I setup the network connection to the room in my apartment I bought a 100
Mbps
switch, choosing not to spend the extra $20 for gigabit. Today I’m
upgrading to a gigabit switch, having realized that the 100 Mbps
switch is
what’s limiting local traffic between my desktop and server.
The other part of my motivation comes from setting up a new ZFS mirror on my desktop and wanting to transfer data off my sever to the mirror over the network. I then plan on streaming media from the desktop to the server, which is being repurposed to a HTPC (with a much smaller SSD instead of the failing 2TB drive in it now).
Before I swapped in the new switch I wanted to test the network transfer speeds, something I have never really done before, just so I can see the speed increase associated with the new switch.
I found this guide helpful, and we’re basically following along here.
Netcat
To test the 100 Mbps
connection we’ll use netcat
. I am testing from my
desktop to my server. We’ll need netcat on both computers we want to test. On
the server (which runs Ubuntu 12.04) we’ll need to install the
netcat-traditional
package:
We’ll also need netcat on the desktop (running Arch linux). The package is
called gnu-netcat
:
100 Mbps Test
To start we’ll need to setup the listening part of the connection on the server:
The flags here get us a very verbose output (the two -v
options), -l
sets
up listen mode, -n
tells us we want to user numeric-only IP addresses, not
DNS, and -p 2222
tells netcat to listen on port 2222. > /dev/null
redirects
all the traffic we send to /dev/null
.
Then, on the desktop, we can send some traffic to the server:
This uses time
to track how long we send traffic for. You’ll want to stop
this after about 10 seconds by hitting ctrl+c
. (If you don’t it’s no big
deal, you might just actually wrap the integer count on received traffic,
making it more difficult to calculate speeds.) On the server we’ll see a
message like this:
Now we just need to calculate our resulting speeds. You’ll notice in the sent
traffic the units are bytes. So we’ll take our 110498864 bytes
and multiply
by 8 bits/byte
and divide by the 9.398s
to get 94061599.5 bytes/s
, or 94
Mbps
.
This is in line with the 100 Mbps
switch that I have right now. Let’s swap in
the Gpbs switch.
1000 Mbps Test
The switch I got was this Netgear 5 Port Gigabit switch from Newegg. They were running a deal for $19.99 with mail in rebate, so I jumped on it.
The switch indicates that both lights surrounding the ports will illuminate with gigabit traffic, and upon plugging everything in, they are both blinking, so I expect to see gigabit speeds.
Running a test we get the following results:
A solid 687.9 Mbps
, much better than our previous 94 Mbps
. Not exactly
1000 Mbps
that the switch can do, but I’m much happier with it. Perhaps
something else is limiting me now, though I’m not sure what it is, as the
router is also gigabit wired.
Repeatability
Just to check repeatability I tried the 100 Mbps switch connection a day after this first test, below are the results:
So a pretty repeatable 94 Mbps
.
On the gigabit switch I get some more variability, repeating the test a week or
so after installing it I got as much as 728 Mbps
, which makes me suspect
other network traffic on the router is limiting what I can get, though I don’t
know enough about a router handles traffic to all it’s ports to know if that’s
a true statement.
Conclusions
I have put a lot of traffic over the new switch in the past week since I installed it. I’m definitely appreciating the upgrade in speed. If you know your switch is limiting your speeds and want a cheap upgrade to boost your local network speeds I can’t recommend a gigabit switch enough, and Netgear products have always done well for me.