Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
iptables - battle.net / sc&bw
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
59729
Apprentice
Apprentice


Joined: 21 Jun 2004
Posts: 279

PostPosted: Fri Jul 02, 2004 1:56 am    Post subject: iptables - battle.net / sc&bw Reply with quote

iptables server: 192.168.0.1
starcraft client1: 192.168.0.2 (using port 6302 for sc)
starcraft client2: 192.168.0.3 (using port 6303 for sc)

I am able to create a game on battle.net and let people from withing my firewall/network join games, but as soon as people outside the network from another computer tries to join, they get a 'latency to high, unable to join error' Any suggestions?

Code:

#!/bin/bash

iptables -t nat -F
iptables -F

#xxx.xxx.xxx.xxx is my external ip, internet
for i in 1 2 3
do
iptables -t nat -A PREROUTING -p udp -d xxx.xxx.xxx.xxx --dport 630$i -j DNAT --t$

iptables -t nat -A POSTROUTING -p udp -s 192.168.0.$i --sport 6112 -j SNAT --to$
done

iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

echo "1" >/proc/sys/net/ipv4/ip_forward
echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
Back to top
View user's profile Send private message
SZwarts
l33t
l33t


Joined: 13 Oct 2003
Posts: 629
Location: Sydney, NSW, Australia

PostPosted: Fri Jul 02, 2004 4:57 am    Post subject: Reply with quote

I don't know if it is the same with starcraft, but I had the same problems with Age of Empires, and Age of King. Wat happened over there was that the outgoing UDP packets where handled fine by ip_tables, but there is a problem with incoming UDP packets if you're NATed. Because nobody knows to whom these should be sent.

Anyway, you're not the only one with the problem, and some guys from a "Mid-Pacific Linux User's Group" claim they have a solution, although after a protocol change it only "sorta" works as they decribe it.

And another solutions comes from hawaii and it is in base64 which decoded gives:

Code:

#!/bin/bash
# Written by Myles Uyema; khisanth at uyema d0t net
#
# This is a script to allow Starcraft games to be hosted behind
# a Linux IPTables firewall.
# Tested with Starcraft and 2 machines behind the firewall.
# This may work for other Battle.Net RTS games as well... YMMV

# My Internet IP address
CABLEIP=12.93.33.58

# My PRIVATE LAN Network
# This script assumes Class C network
PRIVLAN=192.168.5

# Battle.Net port usually 6112
BNETPORT=6112

# Enter the last dotted quad IP address of each PC
# We're assuming all the PCs are in a Class C private LAN
# Also, if you have more than 7 PCs, why do you want to get on Battle.net?
# So if my IP address is 192.168.5.5, PC1=5
PC1=5
PC2=98
PC3=
PC4=
PC5=
PC6=
PC7=
PC8=

export CABLEIP PRIVLAN
export PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8

case "$1" in
   start)
      iptables -t nat -F SC-OUT || iptables -t nat -N SC-OUT
      iptables -t nat -F SC-IN || iptables -t nat -N SC-IN

      iptables -t nat -I POSTROUTING -p udp -s ${PRIVLAN}.0/24 --sport $BNETPORT -j SC-OUT

      for i in $PC1 $PC2 $PC3 $PC4 $PC5 $PC6 $PC7 $PC8
         do
            if [ $i -gt 0 ] ; then
               iptables -t nat -I SC-OUT -s ${PRIVLAN}.${i} -p udp -j SNAT --to ${CABLEIP}:$((9000+$i))
               iptables -t nat -I PREROUTING -p udp --dport $((9000+$i)) -j SC-IN
          iptables -t nat -I SC-IN -d ${CABLEIP} -p udp --dport $((9000+$i)) -j DNAT --to ${PRIVLAN}.${i}:${BNETPORT}
            fi
    done
      ;;

   stop)
      iptables -t nat -F SC-OUT || exit 0
      iptables -t nat -F SC-IN || exit 0
      iptables -t nat -D POSTROUTING -p udp -s ${PRIVLAN}.0/24 --sport $BNETPORT -j SC-OUT

      for i in $PC1 $PC2 $PC3 $PC4 $PC5 $PC6 $PC7 $PC8
         do
            if [ $i -gt 0 ] ; then
               iptables -t nat -D PREROUTING -p udp --dport $((9000+$i)) -j SC-IN
            fi
         done
      iptables -t nat -X SC-OUT
      iptables -t nat -X SC-IN
      ;;

   *)
      echo "Usage: $0 {start|stop}"
      ;;
esac


Well my knowledge more or less ends with why it does not work, and I have no idea if it actually works, nor any firewall-starcraft-combo to try it out... So good luck, or wait for someone else to drop by here...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum