Click to See Complete Forum and Search --> : overwhelmed


McBoon
06-25-2002, 08:05 PM
I have been wrestling with iptables for about 4 months now and I still can't get it to the way I want. LInux is the firewall and windows is behind it. I can't receive or send files on many clients. I can't host games either.

Linux is also a webserver.

What I'm trying to do is have any requests to the webserver go to the webserver. If it is anything else, go to my windows computer. Basically have it so my clients / games don't know that it's going through a firewall.


I can't seem to understand iptables and it's getting really frustrating.


Any suggestions? Here's my current code.


# $INAM is internet name (eth1)
# $INET is internet IP
# $LNAM is LAN name (eth0)
# $LNET is LAN IP


iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain

iptables -t nat -A PREROUTING -p TCP -i $INAM -d $LNET --dport ! 80 -j DNAT --to-destination $LNET
iptables --table nat --append POSTROUTING --out-interface eth1 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT

mychl
06-26-2002, 08:46 AM
Mick... have a look at my iptables script, it has some pretty good commenting so you should be able to figure out what you need to do. Also, for your game hosting, figure out what port number the games need, then you can forward that port number to your windows machine. Lets say you are hosting 3 different games on 3 different machines, you can specify what port game one runs on to forward to the right machine, likewise with other games.

Here's my setup iptables (http://mychl717.com/linked/iptables)

Good luck

McBoon
06-26-2002, 10:55 AM
Hmmm... I think I understand that script.

Now for forwarding, I think That's what I didn't understand before. Lets say Unreal Tournament which uses Ports 7777-7779 and 27900 i believe.

How would I do that?

It has to be so the internet can initiate the connection.

mychl
06-26-2002, 02:40 PM
Well basically, you would say anything coming to eth1 on port 27900 should be sent the internal ipaddress of the game server.


iptables -t nat -A PREROUTING -p tcp --dport 27900 -j DNAT --to
ip.addy.of.gamemachine


Try that for each port you need ...

HTH...

and I found that source with google (http://www.google.com/search?sourceid=navclient&q=iptables+port+forward)

;)

mychl
06-27-2002, 11:43 PM
Did you get it working???