Page 1 of 8 123 ... LastLast
Showing results 1 to 20 of 151

Thread: How to play SC with friends behind same router: NO VPN Needed!!

  1. #1
    Arbiter Senior Member
    Retired Staff Member

    Blessed
    TheTempest's Avatar
    Join Date
    Apr 2004
    Posts
    2,086

    Default How to play SC with friends behind same router: NO VPN Needed!!

    Howdy,

    So I finally learned how to program my router this weekend so I could test a theory I had about making SC work from behind the same router, without having the need for a VPN. I tested my theory this weekend with some friends of mine, and WALA! ****ing works =D

    I have gotten two computers behind the same router to work in the same starcraft game with NO LAG! The solution to this problem is simple, have the router do NAT (Network Address Translation) for starcraft (since SC doesn't do it on it's own, like wc3).

    DISCLAIMER:
    Upgrading your firmware on your router is not something to be taken lightly. Please read all directions on OpenWRT (or where ever you get your bin from) for installation instructions. This is all at your own risk. I take no responsibility for anything. Please, if you don't understand this article...please do not attempt this without professional help.
    Ok, that being said, I've flashed my router 6 times in the last 3 days, with different version from linksys, hyperwrt and openwrt. I can read directions, and therefore...no problem :-)

    The problem:
    Here's the deal, when two of you are in the same game, you both are comming from the same address...so when that information comes back and it's then up for the router to deliver that information to both of you, since you both are on the same WAN IP and same port number, the router doesnt know how to distuinguish between the two of you. So only one of you ends up getting the data, the other player is left in the dark (ie. gets NO information). Thus, the lag...

    The solution:
    NAT is simple. It basicly uses a port number to ID each computer behind the router so the router knows who to deliver the information to. You can think of this like WC3, going in the game settings and setting your port to 6114 (Computer A) and 6115 (Computer B) then all you have to do is tell the router, ok, if you see port 6114, you know that belongs to computer A, so forward the information there. Starcraft is a little more tricky than WC3, but it's simple:

    Basicly, you give each IP address behind your router a SPECIAL # for a port (make up a nice high number like 64000-65535), and when you send packets from your network going to the WAN (Internet), you have the router change make it look like the packet came from the router. This way, the information comes back to the router. Now, all you have to do is change the port number so you can identify which computer sent the information. Then, once your router gets information that's on that speical port number, it knows which computer it's ment for...so all you have to do, is deliever it to that computer by chaning it's DESTINATION Address to match the local IP of your computer (ie. 192.168.1.1).


    Maybe not that easy
    Ok, there is one catch. You need to be able to program your router. No, I'm not talking about the ****ing http web gui (ie. port forwarding and triggering). You need to be able to login to the router with remote access (ie. telnet, ssh, etc...)

    Ok, how do I do that:
    Take your routers' make and model and look at openwrt. If they dont support your model (rare) then put your routers information into a google search. Then look for articles that are related to telnet, ssd (some good key words are: "root 192.168.1.(what ever your last number is for the router).

    If you have any questions, and i have some free time, post up your modelnumber/router and I'll see if I can find you some way to do that.

    Easiest Way:
    Goto openWRT and see if they have a version for your router. Just use your version number. Simply download the correct *.bin file. Then use the linksys firmware update mechinism (you need to login to the router via http). Once the router returns. You'll be able to ssh to the router (use putty if your on windows). In putty, simply put: "[email protected]" for your username, the pass will be what ever you set the pass to be once the firmware update is complete.

    Setup NAT for SC:
    Once you got that all setup. Use putty (ssh) to login to the router. rembemer this is just like telnet (ie. having a remote DOS prompt), except it's linux. once in the router, do the following commands:

    Code:
    cd /etc
    cp firewall.user firewall.user.bak
    vi firewall.user
    Ok, at this point, you should have the file open in VI (a linux text editor). Use wiki on vi to find out how to use it, it's really amazing, just kinda hard to start using. basicly, you move around using the keys on the keyboard. Once you find a place where you want to start typing, push 'i' on the keyboard, this turns vi into TEXT_INSERT mode. Once your done typing and you want to move around again. Just push ESC once. Then you can move around. Once your done making all your changes, simply press ESC a few times, to make sure your not in edit mode. Then type ":wq<enter>" This saves and exits. Now, all that's left to do, is put in the text that will make SC work:

    Ok, 1.2.3.4 is the WAN address for your network (to get this, goto myipaddress.com, use what ever number is there). The other information is about LOCAL address (to get this information, use ipconfig). Each computer should have something different, ie. 192.168.1.4 for computer A, and 192.168.1.5 for computer B).

    Put this into the end of the firewall.user file on the router:
    remember: 1.2.3.4 needs to be replaced by your WAN address, see above
    Also, 64001 == portNUMBER for 192.168.1.4 and 64002 == 192.168.1.5 (i picked those two numbers 64001,64002 to ID each computer)
    Code:
    #NAT for client1
    iptables -t nat -I PREROUTING -p udp -d 1.2.3.4 --dport 64001 -j DNAT --to-destination 192.168.1.4:6112
    iptables -t nat -I POSTROUTING -p udp -s 192.168.1.4 --sport 6112 -j SNAT --to-source 1.2.3.4:64001
    
    #NAT for client2
    iptables -t nat -I PREROUTING -p udp -d 1.2.3.4 --dport 64002 -j DNAT --to-destination 192.168.1.5:6112
    iptables -t nat -I POSTROUTING -p udp -s 192.168.1.5 --sport 6112 -j SNAT --to-source 1.2.3.4:64002
    That code makes any 6112 udp traffic comming from 192.168.1.4 or 192.168.1.5 "look" to everyone on the internet that it's comming from your router, so they reply to the router. The router then checks incomming information to see if it matches that speical port number, if it does, it knows that information is suposed to be routed to an internal computer, and so it changes the destination IP accordingly.

    Post up here, if you have any REAL questions. ie. read up on google for a bit, then ask.

    Also, please post some feedback.

    Thanks.
    TT

    As Requested - Screenshots:
    1) putty open with login information for a linksys router
    2) this is what you should see after you have already gone to the web interface (ie. http://192.168.1.1) and clicked on system (this asks you to set the password)
    3) this is what happens after you enter the correct password
    4) this is the command to change directories to were the firewall.user file is stored (which is what you need to edit). For directions, see my 1st post in this thread.
    5) this shows you how to restart the firewall (you do this after you've made your changes to the firewall.user file correctly).
    Attached Images Attached Images      

    My signature is back!! Hell YES!

    Click the link, I DEMAND YOU! :-D
    http://www.bwhacks.com/forums/showthread.php?t=24873

  2. #2
    Senior Member
    Gold Member

    High Priest
    YonderKnight's Avatar
    Join Date
    Sep 2004
    Location
    USA, California
    Posts
    1,442

    Default

    O.o
    Very nice TT!! Nice to see you still around! Wow, I never thought anyone could solve this problem =p.

    I have a question that might be kind of dumb =p. If your router is using a "special port" for one of your computers, the other clients can still connect using that special port instead of the default one?

    Also, it seems like this is a pretty "dangerous" process, maybe you should put a disclaimer or something. Instead of VI'ing firewall.user, would it be possible to do an ssh file transfer and edit it with windows? I think that would make things a tiny bit easier.

  3. #3

    Disciple
    AriZonaT's Avatar
    Join Date
    Apr 2007
    Location
    Vancouver, B.C.
    Posts
    394

    Default

    I have got to try this, sounds very interesting thanks for posting xD

  4. #4
    Arbiter Senior Member
    Retired Staff Member

    Blessed
    TheTempest's Avatar
    Join Date
    Apr 2004
    Posts
    2,086

    Default

    I don't exactly understand your question.

    What clients are you talking about? Perhaps this might help, any UDP traffic comming in from the internet on, going to destination port 64001 will be routed to 192.168.1.4:6112 (that means that 64001 is reserved for SC traffic)...This should never cause a problem, unless you tried running a UDP server on port 64001. In that case, simply change the port number in the router ie. 64001 -> (one of these 1024-65535)

    edit:
    added disclaimer...thanks!

    My signature is back!! Hell YES!

    Click the link, I DEMAND YOU! :-D
    http://www.bwhacks.com/forums/showthread.php?t=24873

  5. #5
    Senior Member
    Gold Member

    High Priest
    YonderKnight's Avatar
    Join Date
    Sep 2004
    Location
    USA, California
    Posts
    1,442

    Default

    Sorry, I don't know much about networking stuff =p.

    I meant like, the other players in the game. Aren't they designed to use port 6112 or whatever? How does that work?

    Do you want us to talk about your thread in here or in the actual thread? =p

  6. #6
    Arbiter Senior Member
    Retired Staff Member

    Blessed
    TheTempest's Avatar
    Join Date
    Apr 2004
    Posts
    2,086

    Default

    Quote Originally Posted by AriZonaT View Post
    I have got to try this, sounds very interesting thanks for posting xD
    Just curious, do you have any networking experience?

    My signature is back!! Hell YES!

    Click the link, I DEMAND YOU! :-D
    http://www.bwhacks.com/forums/showthread.php?t=24873

  7. #7
    Retired Staff Member

    Blessed

    Join Date
    Mar 2004
    Location
    Phoenix
    Posts
    2,116

    Default

    I remember a while back I just changed the port number in the registry on one of the computers and it worked flawlessly.

    Anyways, good information.
    lol

  8. #8
    Ereetu. Senior Member
    Developer

    High Priest
    Zephyrix's Avatar
    Join Date
    Oct 2005
    Location
    xor 1D27,1337
    Posts
    1,618

    Default

    LLGW. +rep.


  9. #9
    Arbiter Senior Member
    Retired Staff Member

    Blessed
    TheTempest's Avatar
    Join Date
    Apr 2004
    Posts
    2,086

    Default

    actually, in the thread would be fine. i'll move these posts over when i get back from school...but to answer your question.

    when the packet is comming from the internet on that funny port 64001 or w/e it gets translated back to 6112, like starcraft expects once it hits the router before it gets to your computer.

    I hope that helps

    My signature is back!! Hell YES!

    Click the link, I DEMAND YOU! :-D
    http://www.bwhacks.com/forums/showthread.php?t=24873

  10. #10
    Senior Member
    Gold Member

    High Priest
    YonderKnight's Avatar
    Join Date
    Sep 2004
    Location
    USA, California
    Posts
    1,442

    Default

    Okay, I mean like this:

    You have two computers on your LAN. Comps A and B. Each of them are using ports 6112. When you send out a packet on comp A, it hits the router and gets translated to port 64001, and when you send a packet with comp B, it stays on port 6112.

    Now, a remote computer, comp C sees two active ports from the same IP, ports 64001 and ports 6112. If comp C wants to send a packet to comp A, it has to send the packet to your router on port 64001. Can it do this? (I'm guessing it can because your method works =p). I thought SC was only designed to use port 6112 though, how is it that comp C can send packets to port 64001?

    Thanks =p.

  11. #11
    Senior Member
    Retired Staff Member

    Inquisitor
    SC_Modder's Avatar
    Join Date
    Nov 2004
    Posts
    4,836

    Default

    I'll have to consider doing this. I have had OpenWRT on my WRTSL54GS for a while now and really like it.

    TT: Any other cool tricks for your router? Sooner or later I'm going to install a fan and overclock my router, mostly for the hell of it, Lol.

  12. #12
    Senior Member
    Retired Staff Member

    Celestial Entity
    gamepin126's Avatar
    Join Date
    Oct 2004
    Posts
    20,794

    Default

    Quote Originally Posted by SC_Modder View Post
    TT: Any other cool tricks for your router? Sooner or later I'm going to install a fan and overclock my router, mostly for the hell of it, Lol.
    haha do et
    "A Responsible Citizen Not Only Shares Culture, But Destroys The Copyright Industries"

    "Elegance is not a dispensable luxury but a quality that decides between success and failure. "
    "It Don't Mean a Thing (If It Ain't Got That Swing)"
    “Absence of evidence is not evidence of absence.”

  13. #13
    Arbiter Senior Member
    Retired Staff Member

    Blessed
    TheTempest's Avatar
    Join Date
    Apr 2004
    Posts
    2,086

    Default

    ok. To answer your question, it works.

    SC is designed to use port 6112, and as far as SC knows, that's all that's being used. Because, when the packets are being created/recvd by your localmachine (ie. 192.168.1.xxx) the router has already translated the information.

    Let me show you what's happening:

    you send info from your LAN to someone on the internet. When the packet leaves, the following is the case:

    Message leaving your computer going to the internet
    Code:
    Source IP: 192.168.1.100
    Dest IP: some internet address
    Source Port: 6112
    Dest Port: 6112
    Now, when that gets to the router the router goes, oh, I need to translate the source port (because when the target gets the message, it sends to the message back to the "sender" ie. source port).

    So now it looks like this:
    Code:
    Source IP: WAN Address (same ip as "myipaddress.com")
    Dest IP: some internet address
    Source Port: 64001
    Dest Port: 6112
    Notice, the dest port is still 6112, so it gets to the target running SC correctly. Now, when they respond to your message, they will reply to the "source port" ie. the address of the sender (remember UDP has nothing to do with IP).

    So when they reply it looks like this:
    Code:
    Source IP: some internet address
    Dest IP: Your WAN Address
    Source Port: 6112
    Dest Port: 64001
    The router gets the message (because your WAN is the address of your router on the internet) and sees that the dest port is 64001. So now it translates the dest address including the port (so instead of being your router, the router sets the destination ip address to 192.168.100:6112 and then forwards the packet to you).

    So on your computer you get:
    Code:
    Source IP: some internet address
    Dest IP: Your WAN Address
    Source Port: 6112
    Dest Port: 6112

    My signature is back!! Hell YES!

    Click the link, I DEMAND YOU! :-D
    http://www.bwhacks.com/forums/showthread.php?t=24873

  14. #14
    You're all idiots. Retired Staff Member

    Inquisitor
    Mystic Videl's Avatar
    Join Date
    Aug 2006
    Location
    lol
    Posts
    4,829

    Default

    Cisco 2800, I have no worries about any of this. But it looks like a very good guide!
    whats up friends

  15. #15
    Arbiter Senior Member
    Retired Staff Member

    Blessed
    TheTempest's Avatar
    Join Date
    Apr 2004
    Posts
    2,086

    Default

    Quote Originally Posted by rum View Post
    I remember a while back I just changed the port number in the registry on one of the computers and it worked flawlessly.

    Anyways, good information.
    ya, blizzard stopped looking at the registry...probably because they didn't want you messing with that stuff??? (i dunno)

    I remember the good ol days =)

    Now you have to ****ing program the router, lol

    My signature is back!! Hell YES!

    Click the link, I DEMAND YOU! :-D
    http://www.bwhacks.com/forums/showthread.php?t=24873

  16. #16

    Default

    cool i might use ! thanks

  17. #17
    Retired Staff Member

    Blessed

    Join Date
    Mar 2004
    Location
    Phoenix
    Posts
    2,116

    Default

    Quote Originally Posted by TheTempest View Post
    ya, blizzard stopped looking at the registry...probably because they didn't want you messing with that stuff??? (i dunno)

    I remember the good ol days =)

    Now you have to ****ing program the router, lol
    Well, a friend and I did it again a month or two ago.
    lol

  18. #18
    Director of the Thought Police Senior Member

    Zealot
    ComradeSlavic's Avatar
    Join Date
    Apr 2004
    Location
    NY
    Posts
    723

    Default

    Damn, I have DD-WRT v23. Do you have any experience with that Temp?
    * WAR IS PEACE
    * FREEDOM IS SLAVERY
    * IGNORANCE IS STRENGTH

    "The Party seeks power entirely for its own sake...We are different from all the oligarchies of the past, in that we know what we are doing. All the others, even those who resembled ourselves, were cowards and hypocrites."

    "And if all others accepted the lie which the party imposed-if all records told the same tale-then the lie passed into history and became the truth."



    "excellent work sir. i personally have never gone down after blowin the load. what's the point? i got mine ho, see ya"
    -ston3rpimp69

  19. #19

    Default

    totaly lost.......

  20. #20

    Deviant
    *eXpliCiT.'s Avatar
    Join Date
    Jun 2007
    Location
    Det, MI.
    Posts
    61

    Default

    Quote Originally Posted by Aldin View Post
    totaly lost.......
    That should be expected, I'm sure a lot are.
    Thanks for the guide I'll bookmark this, saves me the money of calling my ISP and getting another IP address.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Common Router Ports
    By IversonAli3 in forum Hardware and Software
    Replies: 40
    Last Post: 07-29-2009, 06:13 PM
  2. Guide to Hosting w/ Router
    By SmashedPumpkins in forum Tips and Tricks
    Replies: 13
    Last Post: 02-27-2009, 08:17 PM
  3. Replies: 13
    Last Post: 07-16-2007, 10:22 AM
  4. Router Troubles?
    By Drunk-Snowball in forum Gaming
    Replies: 0
    Last Post: 06-07-2005, 02:43 PM
  5. Router Help
    By YonderKnight in forum Hardware and Software
    Replies: 1
    Last Post: 02-25-2005, 04:57 PM

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •