Hamachi and UDP Broadcast Games

I was recently trying to play some old game (Starcraft, Warcraft 3, and others) in LAN with some friends through the hamachi VPN system. All attempts were unsucessful due to the fact that the broadcasted UDP packet weren’t sent over the VPN interface but only in the local LAN.

To solve this we just had to manipulate the routing table of the systems.
After connecting to the hamachi VPN just do these commands as root user

OS X: as long hamachi uses 5.x.x.x for his nodes
route add -net 255.255.255.255 5.255.255.255

Linux: where ham0 is the hamachi interface. There are 2 options available, test it out that works for you
route add -net 255.255.255.255 netmask 255.255.255.255 dev ham0

sudo route add -n 5.255.255.255 gw 5.0.0.1 dev ham0
as suggested from Blake Lightly

This will redirect all the broadcast packets, maybe it can interfere with some other program, but as long as you want some time off to play it works great. To clear the modification to the routing table we didn’t do anything else then disconnecting from the hamachi VPN, the system handles the disappareance of the interface removing every involved route.

Summing up*

Game Linux MacOS
Warcraft 3 play host
Starcraft host host
Delta Force host untested

* Linux has no other setup then just starting hamachi. This all was tested between a Mac and a Linux systems

If someone can test other games and maybe help on the linux problem that would be great.

Hope this helps!
[last update 2 May 2010]

Advertisements

, , , , , , , , ,

  1. #1 by Clarke on June 30, 2009 - 12:22 pm

    Hi, sorry for posting a comment to this post, I have not found any contact form on your blog.

    I’ve been reading your blog for quite awhile, and maybe you can answer my question regarding rtorrent.

    Do you know how to make rtorrent shutdown a computer or at least shutdown itself once all torrents are downloaded?

    Thanks in advance

    Clarke.

    • #2 by Dario Meloni on June 30, 2009 - 12:39 pm

      I haven’t left the mail visible. Posting a comment is alright, but at least post a comment on a rtorrent related post…
      Anyway, there is no easy solution. rtorrent is not supposed to work this way, it is designed to work as a demon, you should use Transmission or similar for jobs like that.

      The solution would be to write a ruby script that checks that every download is in closed state (if you want to shutdown after seeding) or after the download is completed (if you only want to download).

  2. #3 by Clarke on July 1, 2009 - 4:27 pm

    Hi, thank you for reply

  3. #4 by Clarke on July 5, 2009 - 12:47 pm

    Goog blog and interesting scripts. I’ve added it to my blogroll on http://www.clarke.org.ru (Russian).

    CLarke

  4. #5 by gophK on July 10, 2009 - 8:08 am

    Hello,

    I’ve tried ‘route add -net 255.255.255.255 5.255.255.255’ but it doesn’t seem to work. I can’t see anyone’s SC games. Other people see my games for a little while, but it doesn’t work (‘unable to join game’).

    I can ping other WinXP users, and they can ping me just fine too. Is there some other way to redirect the packets to Hamachi?

    • #6 by Dario Meloni on July 10, 2009 - 8:13 am

      Unfortunately i’ve found myself that it doesn’t work, and really i can’t understand why, even tracking the packets flowing through the various interfaces…
      I can’t really say if it is a hamachi bug or not, i’m going to try with some other vpn software to test it (such as OpenVPN)

  5. #7 by Mack on July 14, 2009 - 11:17 am

    Hi folk!

    This tip: where ham0 is the hamachi interface
    route add -net 255.255.255.255 netmask 255.255.255.255 dev ham0

    work for me on Linux Gentoo!

    • #8 by Dario Meloni on July 14, 2009 - 11:19 am

      You can host games? which games?

      • #9 by Mack on July 14, 2009 - 11:56 am

        This morning I try it on delta force black hawk down first as a client at last as a server. As soon as (when I can do) I’ll try it on starcraft.

  6. #10 by Ryan on August 11, 2009 - 10:28 pm

    In case you want some tips for when you try it with openvpn:

    I’ve been using openvpn to host wc3 games. I’ve had some issues with that. First, I have it set up in bridged mode, and even with the client-to-client clients can only see games if I host them. If anyone on the VPN hosts, I can see them, but nobody else can (I’m on the same lan as my vpn server)

    I’ve tried tweaking some different settings.

    If I either push a “redirect-gateway” or have a client add “redirect-gateway” to their setting (causing all traffic to go through the vpn) then it behaves as if they are on the same lan as me (they can host / see other games etc) – I’m going to try later to push a route down to the clients that perhaps will fix it… if not, its at least workable to have one person host all the games and use redirect-gateway and have everyone join that persons games.

  7. #11 by rogerdpack on December 14, 2009 - 9:55 pm

    how did you run these windows games on linux? How can hamachi be made to work in doze? anybody? :)
    -r

    • #12 by Dario Meloni on December 18, 2009 - 12:23 pm

      wine let’s windows app run in linux

  8. #13 by Jonas Wielicki on February 3, 2010 - 12:24 pm

    Thanks to your tip with the route-command, I was able to find other StarCraft games in the hamachi network on Fedora 12 (x86_64) with wine 1.1.36.

    The trick is, that the one who wants to *join* needs to run this command apparently. Strange. It took us some time to find that out.

    best regards

  9. #14 by Blake Lightly on May 2, 2010 - 7:28 am

    Update your article… I figured it out in ubuntu!

    sudo route add -n 5.255.255.255 gw 5.0.0.1 dev ham0

    booyah!!!!!!!!!!!!!!!!!!!!!!111!!!!!!!!1

    • #15 by Jonas Wielicki on May 2, 2010 - 10:58 am

      Actually, it worked for me with the original command (on the joining machine). It also works for my friend with ubuntu…

      Strange?

      • #16 by Dario on May 2, 2010 - 11:13 am

        I’ll keep them both on the page

  10. #17 by JMRR on May 8, 2010 - 12:27 am

    how can i had a route to use hamachi+bhd, but in windows ??the players are im the same hamachi room, but cant find server???

    • #18 by Dario Meloni on May 8, 2010 - 1:20 pm

      i don’t know windows at all

  11. #19 by luckyyou on June 8, 2011 - 3:24 pm

    for windows XP u can try “route add 5.0.0.0 mask 255.255.0.0 5.0.0.1” at your ms-dos
    after that user “route print” to check your route
    good luck =)

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

%d bloggers like this: