

![]() |
![]() |
|
|||||||
![]() |
![]() |
| Starcraft / Broodwar Gaming Topics relating to typical Starcraft gaming. |
![]() |
|
|
LinkBack | Thread Tools |
![]() |
![]() |
|
|
#1 (permalink) |
|
Arbiter
Senior Member
Retired Staff Member ![]() ![]() ![]() Blessed Join Date: Apr 2004
Posts: 2,092
![]() ![]() ![]() |
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: "root@192.168.1.1" 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, 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 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).
__________________
![]() My signature is back!! Hell YES! Click the link, I DEMAND YOU! :-D http://www.bwhacks.com/forums/showthread.php?t=24873 |
|
|
|
![]() |
![]() |
|
Advertisement
|
|
![]() |
![]() |
|
|
#2 (permalink) |
|
Senior Member
Gold Member ![]() Evangelist |
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. |
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#4 (permalink) |
|
Arbiter
Senior Member
Retired Staff Member ![]() ![]() ![]() Blessed Join Date: Apr 2004
Posts: 2,092
![]() ![]() ![]() |
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 (permalink) |
|
Senior Member
Gold Member ![]() Evangelist |
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 (permalink) |
|
Arbiter
Senior Member
Retired Staff Member ![]() ![]() ![]() Blessed Join Date: Apr 2004
Posts: 2,092
![]() ![]() ![]() |
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 |
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#9 (permalink) |
|
Arbiter
Senior Member
Retired Staff Member ![]() ![]() ![]() Blessed Join Date: Apr 2004
Posts: 2,092
![]() ![]() ![]() |
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 (permalink) |
|
Senior Member
Gold Member ![]() Evangelist |
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 (permalink) |
|
Loading javascript...
Senior Member
Moderator ![]() Inquisitor |
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. |
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#13 (permalink) |
|
Arbiter
Senior Member
Retired Staff Member ![]() ![]() ![]() Blessed Join Date: Apr 2004
Posts: 2,092
![]() ![]() ![]() |
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 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 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 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 |
|
|
|
![]() |
![]() |