1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Configuring Tomato to get rid of lag in games

Discussion in 'Tomato Firmware' started by alien3456, Dec 16, 2008.

  1. alien3456

    alien3456 Addicted to LI Member

    I've been very happy with Tomato ever since I got my WRT54GL last week. I have 3 computers on this network; myself and 2 roommates. One of my roommates just browses the net and is barely a blip on the connection. The other is a mass-torrent user. I like to play games, and his torrenting makes online games a headache. The download rate is fine, but the upload lags out for a few seconds fairly often which makes games like Quake 3 impossible to enjoy. I've tried many different settings with the QoS to make it so that the torrenter's upload traffic is reduced to almost nothing, but I still get the serious lag problems. To test whether it's the connection or just his torrents, I turned his connection off for a while and enjoyed lag-free gaming. Turned it back on and it's back to laggy. I'm wired to the router and he uses wireless.

    I was wondering if anyone else here is in a similar situation and knows how to configure Tomato in a way that greatly reduces torrent traffic when gaming, and brings it to a normal state when I'm not gaming. I don't want to completely cripple his connection, but I'd like to be able to have complete upload priority when I'm playing games.

    Here are screenshots of my QoS settings (The classification page has more entries below it, I only included the relevant entires):

    [​IMG]
    [​IMG]
     
  2. rhester72

    rhester72 Network Guru Member

    You have two gaming items there configured for class E, which is actually lower than "lowest".

    Rodney
     
  3. alien3456

    alien3456 Addicted to LI Member

    I had the E-class ones on Highest before but was still getting lag, so I changed E to be higher bandwidth than highest specifically for games. Kind of a dumb move in retrospect.

    Okay, I changed the E-class ones back to Highest. Anything else I can do?
     
  4. kardzzz

    kardzzz Addicted to LI Member

    try configuring your 'basic settings' to the below and use your own in/out bandwidth limits.

    Default Class Lowest

    Outbound limit
    Highest 12%-100%
    High 10%-93%
    Medium 5%-90%
    Low 3%-45%
    Lowest 2%-25%
    A 1%-23%
    B 1%-22%
    C 1%-21%
    D 1%-20%
    E 1!-20%

    Inbound Limit
    Highest None
    High 98%
    Medium 95%
    Low 93%
    Lowest 85%
    A 60%
    B 40%
    C 40%
    D 40%
    E 40%

    Then for your classification re-order so the highest priority is top then work downwards. I suggest Quake is classed as 'high'.

    Let us know how it works.

    Rgds
     
  5. lwf-

    lwf- Network Guru Member

    Tell your roommate to configure his bittorrent-client with proper upload and download limits and not a too high number of connections. It’s the only way to make it work well.

    You also only class his outgoing connections as lowest, if he got a forwarded port, manually or with upnp, he will get incoming connections as well. It’s better if you just class his connections by his MAC address. On a side note, there is no reason at all why you would give priority to IRC, its just bulk traffic. Just try to limit his stuff and leave everything else at the default settings, if that does not work then QoS is not enough to fix it for you.
     
  6. alien3456

    alien3456 Addicted to LI Member

    kardzzz: I'm using those settings now and they helped a bit, but the sudden lag problem in games hasn't gone away.

    lwf-: Well, I was basically forced to buy a new router so I could try and control his bandwidth myself. I've asked him to lower his settings in utorrent, but he doesn't really know what I mean, and won't let me do it myself (he's very protective of his laptop and belongings).

    I gave him a permanent local IP based on his MAC address, and everything in the "Class A" is his torrent traffic (easy to identify the ports through the qos charts). Here's a shot of how his traffic dominates to give you an idea:
    [​IMG]

    I guess I'll have to try and get him to limit his utorrent connections again. More than 600 is far too many... and I guess QoS can't alter the amount of connections he is making from his computer.
     
  7. ntest7

    ntest7 Network Guru Member

  8. Mastec

    Mastec Network Guru Member

    As lwf- mentioned, have your roommate configure his client. I have found that my upload limit set to 10 while downloading and 15 while seeding produces no lag making online gaming very doable. You do that and you won't even need to use QOS. Good Luck
     
  9. kardzzz

    kardzzz Addicted to LI Member

    alien, which version of Tomato are you using?
    I have pfifo and TCP vegas switched on. Playing COD4 i get very little lag with torrents running.
    You should capp your roommates UDP and TCP limits. Try the following (ensure your roommate is always assigned a static IP that falls in the capp range and get a IP that falls outside for yourself). Limt = 50 & 250 respectively, but play around with those numbers to see if it improves.

    In your 'scripts>firewall' add the following

    #Enable pfifo
    nvram set qos_pfifo=1

    #Limit UDP connections per user
    iptables -I FORWARD -m iprange --src-range 192.168.1.10-192.168.1.170 -p ! tcp -m connlimit --connlimit-above 50 -j DROP

    #Limit max TCP connections per user
    iptables -I FORWARD -p tcp --syn -m iprange --src-range 192.168.1.10-192.168.1.170 -m connlimit --connlimit-above 250 -j DROP

    Save and reboot.
    If you're running ver 1.23 then switch on TCP vegas in the QoS settings and use 3,3,2 for Alpha, beta and gamma.

    I hope it works out!

    *Lookout for Victeks Test Mod for 1.23 which will have a GUI for the IP/Bandwidth capping, then you don't have to mess around with scripts.
     
  10. alien3456

    alien3456 Addicted to LI Member

    Thanks for clarifying with those scripts kardzzz. I'm using them now and it seems to be keeping his amount of connections down. He breaks above the limit sometimes but never goes too far above.

    I also got him to reduce his torrent usage a little bit. He complained that his net was going slow so I told him again to limit his amount of torrents and lower the settings. We'll see if that works out...

    I might need a new cable modem because it seems I get the random lag even when there's not any filesharing in the network at all.

    I'm using 1.23 and have the TCP settings to 3,3,2.
     
  11. kripz

    kripz LI Guru Member

    imo you cant get lag free games, you cant stop packets coming to you (or can you?). Currently im dowloading from FTP at my max inbound speed, i have QoS inbound limit set to 9999 to allow vegas to control it, i am still lagging in games (< 1kb/s is used for upload while downloading).

    The packets are being delayed somewhere and experience stuttering (its like playing with 15 fps), i have no delay whatsoever (my character responds instantly when i click shoot or something).
     
  12. az2008

    az2008 Addicted to LI Member

    TCP Vegas only affects outbound.

    Mark
     
  13. kripz

    kripz LI Guru Member

    Ah, i must of misread the vegas thread :)
     
  14. az2008

    az2008 Addicted to LI Member

    There are some (DD-WRT) people who set their outbound Max Bandwidth to unlimited, and felt TCP Vegas did a better job pacing the flow (as QoS gave priority to packets). Others felt TCP Vegas without any QoS was better.

    On the inbound side, Tomato's QoS isn't really QoS. But, it's been very effective for me. I suppose the downside is that I have to specify a conservative Max Bandwidth. My internet connection speed is relatively fixed. If it varied a lot (like cable's "speed boost", or cable's tendency to slow down during prime-time as people come home and go online), I'd miss out on those higher available maximums.

    It's too bad there isn't a better inbound solution. Something that can dynamically detect inbound speed like Vegas (instead of a hard-coded max value). And, the trickery of Tomato which seems to work well.

    Mark
     
  15. alien3456

    alien3456 Addicted to LI Member

    I don't think I have a problem with inbound. When I'm playing Quake for example, I get short 5-10 seconds of lag where I stop uploading completely, but I can still see the other players moving around, which means that I'm still downloading data fine. I've tried disabling QoS and only using Vegas, same thing. I've tried no QoS or Vegas and it's the same. I've tried disabling wireless so that it's only me connected to the internet and it still happens.

    This leads me to believe my modem might be acting up. I've had it for probably 5-6 years now, so the modem might be getting old. I still can't figure it out though.
     
  16. az2008

    az2008 Addicted to LI Member

    Not the initial packets. But, supposedly return traffic/acks can be delayed to perhaps cause the sender to slow down. Or, the packets thrown away, to cause the sender to slow down and resend.

    It's trickery. But, my personal experience with 1500kbs down is that it works pretty well. Not as good as outbound QoS. But, a lot better than doing nothing at all (when the inbound is saturated). With my VOIP, I tend to hear some stuttering when the the staturation begins, but it stops, or isn't too bad. With real outbound QoS, I don't even hear that. But, with inbound and no quasi-QoS, the voice almost completely drops out.

    I don't know much about these things. Just my own experience with VOIP. This guy mentioned prioritizing ICMP, etc.: http://www.linksysinfo.org/forums/showpost.php?p=337056&postcount=14

    Mark
     
  17. esaym

    esaym LI Guru Member

    Quake 3 is pure UDP. Give udp highest priority. The HTB qdisc used in tomato does not allow you to set the priority to different classes. Priority levels are a main feature of HTB. I think everything below A gets priority 7, the lowest.

    run
    tc -s class show dev vlan1
    and that will show you the class stats for qos and you can see the priorities of the classes and the amount of traffic each class is using. It will be hard to figure out what class your class is in since the web gui doesn't tell you. But I think it flows like 10, 20, 30, etc... from highest to lowest.

    sorry for the bland instructions, I don't have my box in front of me.
     
  18. slow

    slow Addicted to LI Member

    I had a similar problem playing Warcraft III. The easiest solution I found was to just limit outbound speed to like 80% of my max, but I wanted to use that extra 20% when I wasn't playing.

    So here's what I did.
    I put this in Administration->Scripts->Firewall
    Code:
    iptables -I FORWARD -p tcp --dport 6112 -s 192.168.1.2 -d 63.240.202.0/24 -j LOG --log-prefix="HELLO " --log-level 1 --tcp-flags SYN SYN
    iptables -I FORWARD -p tcp --dport 6112 -s 192.168.1.2 -d 63.240.202.0/24 -j LOG --log-prefix="GOODBYE " --log-level 1 --tcp-flags FIN FIN
    
    Whenever I enter/exit battle.net this logs it in /var/log/messages.

    And then I put this in Administration->Scripts->Init.
    Code:
    tail -n 0 -s 1 -f /var/log/messages | awk '{print $7}' | awk '/HELLO/ {print "nvram set qos_obw=1770";print "nvram set qos_irates=0,0,65,65,65,0,0,0,0,0";print "service qos restart"} /GOODBYE/ {print "nvram set qos_obw=2048";print "nvram set qos_irates=0,0,0,0,0,0,0,0,0,0";print "service qos restart"}' | sh &
    
    This monitors /var/log/messages for the enter/exit of battle.net and changes my outbound speed and inbound rates accordingly.

    Unfortunately the log file gets too big at 50kb and gets rotated. So I just clear it every 12 hours.
    I put this in Administration->Scheduler->Custom 1.
    Code:
    echo "" > /var/log/messages
    
    Finally, I put this in Administration->Scripts->WAN UP
    Code:
    if [ `nvram get qos_obw` -eq 1770 ]
    then
    nvram set qos_obw=2048
    nvram set qos_irates=0,0,0,0,0,0,0,0,0,0
    service qos restart
    fi
    
    This is just in case my connection drops, so my outbound speed and inbound rates go back to normal.

    This allows me to use my max speed of 2200 kbs normally and limit it to 1770 kbs when I'm playing.
     
  19. alien3456

    alien3456 Addicted to LI Member

    I got a new modem and it seems like all of my problems were fixed! Thanks to everyone who helped; it wasn't in vain. Now Tomato is configured much better.
     

Share This Page