A couple of products I work on, SQLFire is one of them, have WAN features for linking different datacenters together with asynchronous replication. Whenever I tell people about it the first thing they ask is what happens if the same data is updated in both datacenters at the same time. I don’t really know all that well, so I wanted to tool that would help me learn more about it, I needed a WAN emulator.

I looked at a couple of WAN simulators, specifically WANem and Dummy Cloud. WANem gave me a pretty bad impression, it’s text UI is extremely buggy and I didn’t even notice that it is supposed to be driven by its Web UI. Maybe the rest of the product is better but I’m looking for something as simple as possible. Dummy Cloud looks pretty good, and is loaded with features. Too many features actually, for what I want, and the free version doesn’t let you do really high latencies. So I decided to roll my own. I packaged the results as the WANatronic 10001 virtual appliance you can run on VMware Workstation, and probably ESX and Fusion as well.

Goals:

Can work with nothing but a laptop (no actual network required).

As small and lightweight as possible.

Simple, as close to zero configuration as possible.

Really cool name.

I think things turned out fairly well. Namely:

Traffic sent directly to WANatronic 10001 is sent right back to whatever host it originated from. If you ping WANatronic 10001 you’re actually pinging yourself. Same with SSH, etc.

Packaged as a VM needing 32MB and a download size of about 170MB, which unfortunately is small as far as virtual appliances go.

There are 4 things you can configure. If you’re lazy and don’t configure anything, WANatronic 10001 will still work.

That’s pronounced WAN-a-tron-ic ten-thousand-one in case you were wondering. Just try to forget that name. See? You can’t do it.

Using WANatronic 10001

Possibly the most interesting thing, and the thing I think I’ll use it most for, is simulating slow links on a single host. In this case there is nothing you need to do on your computer. In the screenshot above my WANatronic is at 10.24.0.13. Any traffic I send to that IP is sent right back to me. So if I have two processes on my host that I want talking slowly, let’s say one is on port 8000 and one is on port 9000, all I do is tell the first application that its peer is on 10.24.0.13:9000 and tell the second one its peer is on 10.24.0.13:8000. Done.

WANatronic can also function as a router-on-a-stick, all you need to do is route traffic through WANatronic. For example Google’s free DNS is located at 8.8.8.8. If you want to simulate being on a slow network between here and there run:

ip route add 8.8.8.8 via 10.24.0.13

Your IP address will be different from mine, check the console to see what it is. You may need to adjust that command based on your OS. With that set up, ping 8.8.8.8 to see the effect of latency and packet loss.

Last but not least, configuration is via the console since there is no way to remotely connect to WANatronic. Changes are automatically saved and applied.

Technical Mumbo Jumbo

WANatronic uses Ubuntu 8.04 JEOS as a base. I used this older distro to cut down on the size of the virtual appliance, which unfortunately is still huge. For the most part WANatronic is a very basic use of the iptables and tc utilities. The WANatronic source code is hosted on GitHub.

There is one exception that required a little bit of science. I really wanted any traffic sent to WANatronic to be NATted directly back to me. Without this I would need to use multiple network interfaces which I wanted to avoid. As far as I can tell there’s no way to do that with iptables, so I made a custom version of the iptables NETMAP target that would replace the packet’s destination address with its source address in PREROUTING. After that the packet is NATted so it appears to originate from WANatronic. This is the magic that lets you talk to yourself on what appears to be a very crappy link. Perfect for a demo that needs to reside completely on a single laptop.

Stuff It Doesn’t Do

Plenty of things really but things that come to my mind include:

Static IPs (seems useful)

Routing stuff like OSPF (not going to happen)

Remote management (not sure it’s worth it)

IPv6 (does anybody actually use that)

Really fancy stuff like packet reordering (not likely)

If you’ve got comments or would like to see something let me know.

In case you scrolled to the bottom for a download link here it is again: WANatronic 10001.

38 Responses to 'WANatronic 10001: An extremely simple WAN emulator'

Subscribe to comments with RSS
or TrackBack to 'WANatronic 10001: An extremely simple WAN emulator'.

[...] After some searching and tweeting around he has decided to build an appliance on his own. WANatronic uses Ubuntu 8.04 JEOS, RC tools and IP tables. I’ve recorded a short video about what you can do [...]

This reminds me of the 90′s when I had a C program set up to redirect anything that came to certain ports back to its source. Times of IRC warfare and personalized exploits to get peoples machines off the net. Picking on my IP was a lesson with reflection.

Now to shrink this .. where’s @lynxbat ? You up for an UberWANatronic 10001 ?

Running into a strange situation and I wonder how to interperted this. I have a notebook set up with VMware Workstation. A VM is running behind NAT, WANatronic is also behind NAT. I added a route locally to the VM through the WANatronic and I’ve set the packet delay on the WANatronic to 500ms. When I ping from local to the VM I get a delay of 1000ms. At the same time, when I ping from the VM to the local VM, the delay is 500ms. Why is this?

Any traffic sent to the WANatronic is NATted back to its sender. In your case you are pinging yourself. So the ICMP PING packet goes out, and WANatronic delays it by 500ms then sends it to your laptop. Your laptop sends an ICMP REPLY to the WANatronic (it thinks the packet originated from there). This packet is also delayed 500ms. Finally the circle is complete.

In the second case, have you logged into the WANatronic and are pinging out from the console? In that case probably the traffic shaping is only being applied to one of the ICMP packets.

Good day, I am really impressed with your writing skills and also with the layout on your weblog. Is this a paid theme or did you customize it yourself? Either way keep up the excellent quality writing, it is rare to see a great blog site like this one nowadays.. P.S., if you would like to earn money from every single visitors you receive to the links in your blog posts, AdTrim is an ads network that offers you to shorten links so that when anyone clicks on the links, they will be shown an advertisement and you will earn $44 per 10k visitors. At this time the site is paying on time. I made over $1500 With AdTr.im within a month’s time. They do not ask for you to upgrade or purchase anything. Earning money is easy for each visitor to your blog with this url shortener. Cheers.

Hi admin do you need unlimited articles for your blog ?
What if you could copy content from other sites, make it pass copyscape test
and publish on your page – i know the right tool for you, just
search in google:
loimqua’s article tool