LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Fedora core 2 as a router and hosting warcraft 3 games? (https://www.linuxquestions.org/questions/linux-networking-3/fedora-core-2-as-a-router-and-hosting-warcraft-3-games-217001/)

Glus 08-13-2004 01:01 AM

Fedora core 2 as a router and hosting warcraft 3 games?
 
I am trying to set up some routing on my linux box. This linux box serves as a router mostly. I want to host battlenet games, and I got to the point where I can, but I have to apply some settings after I connect to bnet, otherwise I cannot connect to bnet at all. Here is what i have:

iptables -t nat -F
iptables -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
iptables -A FORWARD -j
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE
iptables --append FORWARD --in-interface eth1 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward

This above section allows me to connect to bnet and anythign else(from my windows box, and linux box), but I cannot host games, can only join games.

If I enter the following after I am already connected to battlenet, I can host:

iptables -t nat -A PREROUTING -p UDP --dport 6112 -j DNAT --to-destination 192.168.0.2:6112
iptables -t nat -A PREROUTING -p TCP --dport 6112 -j DNAT --to-destination 192.168.0.2:6112

But after I exit battlenet, I have to reenter the first section, or I cannot even connect to battlenet, and then to host a game again, I have to reenter the second section again, and so on.

My setup consists of:

192.168.0.2 static ip for windows 2000 box

192.168.0.1 for the linux box

linux box has ppp0 which is connected to one nic, and the other nic connects to the windows pc.

I want to combine these 2 sections, so they both work at same time, without me needing to enter second one after I am already connected and so on. Basically how do I make iptables permit all that is in those 2 files combined ? Because as it is now, the second set of commands overwrites somethign in first set of commands, and I want both sets of commands to be active at same time.

The linux box is fedora core 2 with 2.6.7-1.494.2.2 kernel, currently no firewall software running.

Thank you in advance.

Glus 08-13-2004 01:28 PM

Ok, I went through this stuff again and tried to clean it up a bit, The section that allows me connectivity to anything from my win2k box now looks like this:

iptables -t nat -F
iptables -F

iptables -A FORWARD -i eth1 -o eth0
iptables -A FORWARD -i eth0 -o eth1
iptables -A INPUT -i eth0 -j ACCEPT
iptables -A INPUT -i eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE

(I also edited /etc/sysctl.conf to have net.ipv4.ip_forward=1)

With just the above I can connect to battlenet and join games, but I cannot host.

Once I am connected to battlenet, I can run this:

iptables -t nat -A PREROUTING -p UDP --dport 6112 -j DNAT --to-destination
192.168.0.2:6112
iptables -t nat -A PREROUTING -p TCP --dport 6112 -j DNAT --to-destination
192.168.0.2:6112

And then I can host games as well as join games. But when I exit from battlenet, I cannot connect to it again, unless I rerun the first group of commands, and then once connected I cannot host games until i run the second group of commands.

How can I combine these 2 sections so I do not have to run anything while already connected to battlenet?


All times are GMT -5. The time now is 07:25 PM.