OpenWrt Forum Archive

Topic: firewall.user and port fowarding

The content of this topic has been archived on 9 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

The default rules include an example for port forwarding to an individual machine, but what about adding an example to forward a certain port to the entire lan?  I've searched high and low on how to accomplish this, but am not much of an expert with iptables.

What I'm after is a simple way to host a Sea3D game from either of two Windows PC's, but neither at the same time.

I would think it should look something like this, but it doesn't work as expected:

iptables -t nat -A prerouting_wan -p tcp --dport 7176 -j ACCEPT
iptables        -A forwarding_wan -p tcp --dport 7176 -j ACCEPT

Is this even possible, or do I have to specify a server IP address?

What you want to do isn't possible. You have to specify the LAN IP address of the server to forward the packet.

If Sea3D supports UPnP or NAT-PMP, you could install that on your router, and the game could automatically configure the port forward on the fly.

The discussion might have continued from here.