Lowering Latency

Please Note: This method is no longer all that effective given various instances/raids etc are run on different servers. You could still do this but it would require a SOCAT instance for each server. For this reason I’ve taken this site out of my main site and you’ve probably gotten here via a search engine or an old link.

The following write-up covers the steps for creating your own server to lower your ping. This is a great post on the wow forums: http://forums.worldofwarcraft.com/thread.html?topicId=3271071466&sid=1 which gave me the inspiriation to do this. If you think of some of the services like lowerping, this is exactly what they are doing.

Now I know this is a little more techy than what I normally post but it may be useful to some of you :D

In a nut shell the issue with high latency is due to a couple of things; 1 being our location in relation to the servers, 2 is the way in which packets are transmitted to the wow servers. When we send a packet (data) to the wow servers we wait for a response. Now this is not really needed but wow itself has been designed to work this way.

Paid services basically take your packets, send you a response quickly and then translate the packets into a better form and send it to the wow servers. Now this costs cash and also does change the source IP of the packet from a wow-server point of view, so the outlined technique is less risk.

What we are going to do is setup our own server that will run in VMWare to do this transformation and have it either running on your own PC or a PC on your network. I have VMWare Player installed on my laptop at home so I’ll be running it there.

Step 1 – VMWare Player & How the Infrastructure Looks

It was apparent that not everybody knew what the hell I was talking in regards to VMWare so this is a quick installation guide.

Firstly what is VMWare? Basically VMware allows you to build a virtual system that run inside your current OS. So in simple terms; You have Windows Box with VMWare installed, we can then create a Virtual Machine that runs in VMWare that has another operating system.

You have two options really;

  1. Install VMWare on your gaming box (if you’re low on resources this is not recommended as it can be a resource drain)
  2. Install VMWare on a second PC

Effectively with VMWare from a network point of view it will appear that you have another computer on the network although it will be utilising your Host OS for network connectivity. Is that simple enough?

  1. Go to http://www.vmware.com/download/player/
  2. Download the VMWare Player for your environment (you need to register but I rarely get any emails from them)
  3. Once downloaded install (next, next, next etc) and restart your PC

Now VMware is a pretty cool and I use it for my development/support projects quite a bit.

This is how my infrastructure looks at home now and how the routing will work;

socat

What this shows is I now have 3 unique network addresses, 1 for my wow pc, 1 for my vmware host, and 1 for the os hosted in vmware.

Packets from my wow pc that are on the specific port will be mapped through to my Socat server who will then transmit the (adjusted) packets to the wow server.

Alternatively you could have the VMWare Player installed on the same PC that’s running wow;

socat2

Step 2 – The OS

Now I have been a big fan of Debian for a few years and will be using this, for this purpose I am just taking a pre-built VMWare appliance and building onto it the things I need.

Big Security Warning: I am not building this for external/public use, no REAL firewall is being configured or anything!

Go here and download the Debian 5.0 Server from http://linhost.info/vmware/
The usernames and passwords are available there too.

Once that is downloaded we will set up our service;

  1. Turn on the VM and set the Network type to Bridged.
  2. Restart VM and login as root to the command line
  3. Type: apt-get install socat
    this will go through the installation process and jump back to the Command Line
  4. Type: ifconfig to get your new server IP address

Step 3 – Running & Testing Socat

  1. First thing we need to do is work out our server IP address, I found the one on wowwiki to be incorrect so start wow up and log into your server (select a toon and login), then ALT-TAB to Windows and run a command prompt and type netstat, you should see an IP address connecting to 3724
  2. then in the command line type this:socat -d -d -d TCP4-LISTEN:3724,nodelay,fork,reuseaddr,su=nobody TCP4:{WOWSERVERIP}:3724,nodelay
  3. Now you should get “listening on AF=2 xxxx:3724”
  4. hit CTRL + ALT to leave the VM and then open a command prompt on your wow PC
  5. Type: telnet {SOCATSERVERIP} 3724
  6. You should see the connection being made, this means it is ‘working’
  7. You can close both your Socat (CTRL + C should do it) and your telnet now.

Step 4 – Setting up Socat as a Debian Service (on startup)

Now we want this socat to run automatically when debian boots so we do the following;

  1. Enter the VM again
  2. Type: cd /etc/init.d
  3. Type: vi socat
  4. Hit “i” and add the following:

#! /sbin/sh
# UPYURSH SOCAT SERVICE SCRIPT
# http://www.upyursh.com

# make sure our iptables is in there
/sbin/iptables -t nat -A PREROUTING -p tcp -d {WOWSERVERIP} –dport 3724 -j REDIRECT –to-ports 3724

 

# start our service as a daemon
nohup socat -d -d -d TCP4-LISTEN:3724,nodelay,fork,reuseaddr,su=nobody TCP4: {WOWSERVERIP}:3724,nodelay > /dev/null &

# lets make sure we know our IP :D
ifconfig

  1. Hit ESC and “:wq”
  2. Make the script an exe that can be run by typing:chmod a+x socat
  3. Now to add it as a service type:update-rc.d –f socat defaults
  4. type shutdown –r now to start and check if the service started!
  5. When it restarts login and type: ps –ef | more
  6. You should see socat –d –d –d ….. in the list
  7. That’s it! You don’t actually need to login for the service to be running but I do encourage you to login and shutdown properly every time so keep your OS healthy usingshutdown -h now

Step 5 – Routing Traffic to your new Box

Create two bat files on the box where you run Wow. If you’re using Vista or 7 you may need to run them as Administrator :)

  1. Route to Debian Box
    1. Create a file called “CreateWowRoute.bat”
    2. Add this: route -p ADD {WOWSERVERIP} MASK 255.255.255.255 {SOCATSERVERIP}
  1. Remove the rout to Debian Box (for using wow without socat)
    1. Create a file called “DeleteWowRoute.bat”
    2. Add this: route -p DELETE {WOWSERVERIP}

If you want to run wow without your linux box remove the route first :)

  1. brian lockner
    October 13th, 2009 at 03:31 | #1
     

    You say to 'log in as root to the command line' ... how the heck do I do this? you are writing this for non-users (at least i'm one) ... i've tried several slash commands none of them get me to the root directory. Please advise...

  2. Jorge Mario
    December 22nd, 2009 at 03:50 | #2
     

    Just finished my configuration and it works, reducing my latency by almost -50 (still very high but this really helps). Thanks.

    The script doesn't work for me the very first time. Throw an error like "invalid interpreter", so I changed the first line from #!/sbin/sh to #!/bin/sh (minus the first s) and that fixed my issue.

    Brian: to log in as root just execute the command "su" and the default password is "user".

  3. Kwiat
    December 22nd, 2009 at 21:29 | #3
     

    I had problem with loging in too, but password is in the site you have downloaded debian
    Login:root
    password:user

    I have a question, can it be done using nat network connection?

  4. December 23rd, 2009 at 09:48 | #4
     

    @Jorge Mario
    thanks for that Jorge, glad to see you're getting some positive results :)

    @Kwiat
    Yes Nat will work. The communication between the VM and wow servers is affectively as normal, its just that your game client is getting a response from the VM rather that wow servers so the latency drops :)

  5. Druidious
    January 18th, 2010 at 08:15 | #5
     

    Great idea, Would this kind of reduction in latency still occur with
    three WoW pc's on my network and would all pc's need to be setup up
    accordingly considering we all play on the same server??
    Am i better off investing in a dedicated server/storage box maybe?

  6. SMP
    January 22nd, 2010 at 13:11 | #6
     

    @Druidious
    I'd be interested to see an answer to this too. We have a family of 4 WoW addicts and latency can be an issue. We've tried all the other tricks and fixes... no luck.

  7. SMP
    January 25th, 2010 at 01:14 | #7
     

    @SMP
    Just found a great fix for this. Easy for the non-techno types. Leatrix Latency Fix. We went from 400+ latency to 118 to 130. Easy to install, takes about 30 seconds and a restart and voila, you have the tcp-ack-frequency fix with no hassles. Works with Win 7 and Vista too.

  8. Druidious
    January 28th, 2010 at 11:10 | #8
     

    @SMP
    Whoa, i will definetley give this bad boy a try tonite when i get home!!
    That kind of latency reduction would make my life as a healer a great deal easier. The idea behind it seems so simple im amazed no-one has done it earlier???
    Now, how to get out of work early today?? ;p

  9. Druidious
    January 28th, 2010 at 11:22 | #9
     

    I guess the next question will be if we used both methods would they work in harmony and provide almost nil latency?
    Ie, Home Server for lowering ping + Leatrix for increasing the frequency of TCP traffic???
    Hmmm Lets nut this out together!! KGO

  10. January 28th, 2010 at 11:34 | #10
     

    @Druidious
    There should not be any reason why it wouldnt work having 2 PCs connected to wow, but you will have to try it, I dont have 2 wow accounts so hard for me too :)

    If you wanted to be connecting to different servers you would need to create multiple socat instances, one for each server.

    @SMP
    I use this as well, it works well.

    @Druidious
    You will never get NO latency, if you understand what these fixes are doing you are not actually reducing the connection time to the server. But what you are doing is telling windows to not wait for the response prior to sending the next. You will always have the latency especially when running in Australia etc.

    I have had better results using my unix solution simply because the unix Network Stack is much more efficient than windows but whatever works for you :)

    Upy

  11. Druidious
    January 28th, 2010 at 12:04 | #11
     

    @upyursh
    Thanks mate, looks like i have a fun weekend ahead of me trying it all out!!

  12. Amairgin
    October 17th, 2010 at 19:01 | #12
     

    Hail South Aussie up river Victorian here,

    I've been using this method for at least 12 months but patch 4.0 seems to have broken it? None of my friends bother with this technique. Can I ask if it still works correctly for you? Or has blizzard changed ports/realm ip's on us without our knowledge. btw your guide is the best one - the startup scripts make everything just that little bit easier - pro work!

  13. October 18th, 2010 at 08:50 | #13
     

    @Amairgin
    It looks like Bliz has changed some ports etc :( I was looking last night and was connecting of port 1900. If this was happening to you then the forwarding wouldnt be occuring. Run your command prompt (in admin on Win7) and type

    netstat -b

    Check what port wow is connecting to the server on

    Upy

  14. Amairgin
    October 18th, 2010 at 12:06 | #14
     

    Thanks for the replay Upy. Seems as though mine is using port 1119 now and the previous Fail(Dread)Maul server IP of 12.129.254.152 is now either .150 or .153. I'm coming to the thought that it might just be easier to forward all the wow ports to my linux box. IPtables should handle that ok. I've never multi instanced SOCAT before - so I'll give that a crack tonight. AmA

  15. Tarvitz
    January 22nd, 2011 at 06:02 | #15
     

    So well, it seems blizzard changed something around thier protocols. WoW data is now broadcasting via multiply address range and ports.
    For example we could get the connecton on x.x.x.177:3724 and after restarting on x.x.x.x.175:4000 and so on.

    Socat method as it was describe above is broken, but it realy helps within single server ip.

  1. No trackbacks yet.

CommentLuv badge