From the original 'Read Me ' file that came with the game.
Firewall Information
--------------------
If you are trying to connect to a Neverwinter Nights server through a
firewall, NAT, or router, here is some information for you to help you get
connected. First, please read the manual that came with your firewall or
router.
Neverwinter Nights uses UDP, not TCP for its connections.
If you think that your firewall is preventing you from connecting to the
game servers, please make sure that the following ports are open:
Ports 5120 through 5300
If you are wanting to make sure that your NAT is set up to allow the game
to play here are some details:
Outgoing packets:
Source port: 5120-5129
Destination port: 5121-5300
Incoming packets:
Source port: 5121-5300
Destination port: 5120-5129
On the Game Client side, you can select what port your client uses. Go to
your nwnplayer.ini file in your NWN Client Beta install directory. Find the
following section:
[Profile]
Client Port=5120
Change this number if you need to force Neverwinter Nights to connect as a
client on a different port.
Gamespy
-------
If you want to get a server listing via GameSpy, you’ll need additional
ports to be open: 6667, 80, 27900, 28900, 29900, 29901, 13139, 6500