Neverwinter Nights Portmapper
nwnmap.zip download
nwnmap works around a Neverwinter Nights Linux game server bug where the server
does not allow connections from more than a single network adapter. On
Linux gateways with two NICs, generally the private LAN NIC is chosen,
making it impossible for public WAN (internet) clients to connect. This
script maps the ports from the internal NIC to the external NIC.
See this forum thread for more details.
See this How can I play through a Firewall FAQ for information on which ports must be filtered.
And, here is the netfilter HOWTO describing the core technique used in the script.
Here is an overview of what the script does:
- ip address add 192.168.0.2 dev eth1
Create an IP alias on the private LAN adapter (ex. eth1) that the game
is being hosted upon. This command is necessary to bind an address
(ex. 192.168.0.2) to the private LAN adapter that the game is hosted on.
Without it,the Network Address Translation (NAT) done by netfilter will
change the address, but not bind to the game server expected adapter.
- iptables -t nat -I PREROUTING -i ppp0 -p udp --dport 5121 -j DNAT --to-destination 192.168.0.2:5121 (for each port 5120-5xxx)
Any game packet inbound from the Internet (public interface ex.
ppp0) has its destination translated to the private IP alias (ex.
192.168.0.2). This effectively translates the packet into a
private LAN adapter (ex. eth1) packet that the game server will
accept. Also notice that the game server is completely UDP based
(no TCP).
- iptables -I INPUT -i ppp0 -p udp --dport 5121 -j ACCEPT
iptables -I FORWARD -p udp -d 192.168.0.2 --dport 5121 -j ACCEPT (for each port 5120-5xxx)
If a firewall is present (there is right? right??), let game
packets be accepted and forwarded to the private IP alias.
- iptables -I INPUT -i eth1 -p udp --dport 5121 -j ACCEPT (for each port 5120-5xxx)
Although LAN game clients cannot use the public IP to connect
(not on public adapter), they can still connect via the LAN IP
for the game server (like 192.168.0.1).
Hope this helps!
All materials Copyright ©2000-2009 Brent Schwan.
All rights reserved.