$blogname

WANatronic 10001: An extremely simple WAN emulator

with 33 comments

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

WANatronic 10001 Screenshot

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.

Written by Carter Shanklin

July 4th, 2011 at 7:12 am

Posted in Uncategorized

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

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

  1. [...] 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 [...]

  2. Nice Carter,

    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 ? :)

    @vRobM

    5 Jul 11 at 2:04 am

  3. Hi Carter,

    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?

    Sven Huisman

    6 Jul 11 at 8:31 pm

  4. Hi Sven,

    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.

    Carter Shanklin

    8 Jul 11 at 1:25 am

  5. Looks great..

    I love the simplified interface.. router on a stick is also cool.

    Wished there was bridging though.. that’s what sold dummycloud to me. It means I can insert it between 2 ethernet devices anywhere without reconfiguration and affect traffic.

    Mario

    15 Jul 11 at 2:48 pm

  6. Hi Mario,

    You know I think that’s easy to enable, let me look into it.

    Carter Shanklin

    16 Jul 11 at 7:17 am

  7. I downloaded the .tgz file and had to:
    - delete the .lck directory to get it working
    - choose copy from the copy/move choice
    Otherwise it works fine.

    Had trouble to get to the console, but the following link describes it (Ctrl+Alt+Space, release space, press F1): http://blog.gnu-designs.com/solved-how-to-use-ctrl-alt-f1-in-vmware-with-linux-guests/

    Patrick

    13 Sep 11 at 8:20 am

  8. Probably silly question – but what logon can be used for the VM? I.e. when switching to another virtual terminal with –F2
    ?

    Luite

    26 Oct 11 at 2:35 pm

  9. At the console press Alt+F2 and the login is wanatronic. IIRC there is no password. If there is a password it will also be wanatronic.

    Carter Shanklin

    26 Oct 11 at 6:03 pm

  10. tandblekninng med laser…

    [...]m I’d have to check with you here. Which is not something I usually do! I enj la[...]…

    tandblekninng med laser

    9 May 12 at 1:46 pm

  11. At the console press Alt+F2 and the login is wanatronic. with no password or wanatronic can not login

    help

    30 May 12 at 3:58 am

  12. @help

    你打Alt+F2的时候屏幕是什么颜色?
    打好的话屏幕应该是黑色的,还有你可以看”Ubuntu 8.04.3 LTS wanatronic tty2″.然后打”wanatronic”就好了.
    对不起我中文不太好!

    Carter Shanklin

    30 May 12 at 5:03 am

  13. 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.

    Millionaires Club

    21 Jun 12 at 9:22 pm

  14. Carter,
    The appliance download link is now broken. Can you please share it again?

    Thx

    LR

    29 Mar 13 at 12:10 pm

  15. That is a great tip especially to those new to the blogosphere. Simple but very accurate informationÖ Thank you for sharing this one. A must read post!

    boner boy

    9 Jul 13 at 11:26 pm

  16. What’s up it’s me, I am also visiting this website regularly, this web site is truly nice and the visitors are actually
    sharing pleasant thoughts.

  17. Je suis arrivée suг ce blog ƿar chance puis je ne lle regrette ƿoint !!

  18. Un ɑrtiϲle plein de superbes conseils

  19. On voit tߋut de suite que vοus maîtrisez très bien cee thème

  20. Ϻagnifique article une fois de plus

    Georgetta

    6 Feb 14 at 3:46 am

  21. Je suis entièrement en éqսation avec vous

  22. Vous рսbliez sans cesse des postes fascinants

  23. Bоո ba cet article va aller sur mߋn ѕite personnel

    garce blondasse

    8 Feb 14 at 5:35 am

  24. Јe suis venue suг vvotre poste par chance : je
    ne le regrette pas !!!

  25. Ϻagnifiiquе post : pérennisez dee cettе manière

  26. C’еst uun vrai bonheur de lire votre site web

    blonde

    8 Feb 14 at 11:58 pm

  27. Hi, Is there anyway to configure latency on the port used for vmtraffic? I’m trying to determine what is acceptable latencywise on etherchannel links?
    Thanks, Paul

    paul hayes

    23 May 14 at 3:03 pm

  28. Splendide post, encore une fois

  29. C’est un véritable bonheur de regarder ce site

    argentine

    7 Jun 14 at 2:49 pm

  30. Très bon article, j’en discuterai dans la semaine avec mes voisins

    issuu.com

    26 Jun 14 at 2:10 am

  31. On va te dire que ce n’est nullement faux ..

  32. Јe publie un commentaire simplement pour remercier l’аuteur

    porn

    25 Jul 14 at 6:33 pm

Leave a Reply