Skip to contentSkip to conversation

iptables and bnetd (game server) very slow...how to ?

DISCUSSION Thai DANG 1 participant 1 message May 31, 2002

lore
Share & tools
lore

Thai DANG

author
#0 lore raw

Hi,
I have 2 PC in a LAN connected to an internet gateway (ADSL). My bnetd server is on the gateway. All connections are OK but there is a big pb : it is very slow. The computers are goods and the connections too. I think it is a pb in my iptables rules. I join my script, could tell me what is wrong ?

note : if you have the same architecture than me, you can use that script but it is slow :o(

#!/bin/sh

iptables -t nat --flush
modprobe iptable_filter
modprobe iptable_nat
modprobe ipt_MASQUERADE
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

# Activate forwarding
echo "1" > /proc/sys/net/ipv4/ip_forward

# variables
GTW_EXT=217.128.99.54
GTW_INT=10.0.0.2
# inside
iptables -A PREROUTING -t nat -d $GTW_EXT -j DNAT --to-destination $GTW_INT
# outgoing
for i in 1 3 4 5
do
iptables -A POSTROUTING -t nat -s 10.0.0.$i --protocol udp --destination-port 6112  -j SNAT --to-source $GTW_EXT:888$i
iptables -A POSTROUTING -t nat -s 10.0.0.$i --protocol tcp --destination-port 6112 -j SNAT --to-source $GTW_EXT:888$i
done
# incoming
for i in 1 3 4 5
do
iptables -A PREROUTING -t nat -d $GTW_INT --protocol udp --destination-port 888$i -j DNAT --to-destination 10.0.0.$i:6112
iptables -A PREROUTING -t nat -d $GTW_INT --protocol tcp --destination-port 888$i -j DNAT --to-destination 10.0.0.$i:6112
iptables -A OUTPUT -t nat -d $GTW_INT --protocol udp --destination-port 888$i -j DNAT --to-destination 10.0.0.$i:6112
iptables -A OUTPUT -t nat -d $GTW_INT --protocol tcp --destination-port 888$i -j DNAT --to-destination 10.0.0.$i:6112
done
# update bnetd gametrans file
echo "" > /usr/local/etc/gametrans

for i in 1 2 3 4 5
do
echo ": 10.0.0.$i $GTW_EXT:888$i 10.0.0.0/24 " >> /usr/local/etc/gametrans done

# display LOGS
echo "============================="
cat /usr/local/etc/gametrans

echo "============================="
iptables -L -v -t nat