I wrote a little tutorial on port forwarding...
Many people get errors saying they have to configure their firewalls or NAT systems properly when they try to run a Teeworlds server. As a result of that, their server won't show up in the server list and (almost) no one will be able to connect to it. It's quite easy to get rid of this problem, if you know what's wrong. This tutorial is meant to teach you what a NAT is, how it works and, at the end, fix your problem.
A lot of people in Europe connect to the internet either via optic fibre or DSL. Especially the latter one, DSL, tends to require a router, otherwise you'll be limited to one computer per household. Each household/home usually gets one public IP address. It can be in the form of 18.104.22.168 or 22.214.171.124. You have probably seen an IP address before. Because each computer needs an unique IP address, but you only get one IP per household, it needs to be divided up into many IP addresses. This is where NAT comes in. NAT stands for Network Address Translation and its primary function is to allow several devices to connect to the internet from a single public IP.
It's done by using so-called “internal IP addresses”. They usually begin with 192.168 or 10, and they cannot be reached from outside your household. An example of a valid, internal, IP address is 192.168.1.3. You can see your own internal IP address by opening a command prompt and typing “ipconfig”. It'll look something like this:
On the picture above you'll see that my internal IP address is 10.97.64.67.
How does this work?
When you connect your computer either via a cable or via a wireless network, it will connect your computer to your router. A router is a small device with one or several antennas on the top. It's the link between your home and the internet. The router is the only device in your house that “holds” or uses the public IP. When you connect, the router will give you one of its internal IP addresses. It's either in the form of 192.168.x.x or 10.x.x.x. See the picture above for a graphical example.
Each computer has around 65 000 ports. Each port can be used by one application. For instance, Teeworlds uses ports 8303 for servers and 8300 for master servers. Web servers (HTTP) use 80 and 443 and ICQ uses 5190. As stated previously, you cannot reach computers with internal IP addresses from the public internet. In order to allow access, you need to setup “port forwarding” in your router. Because the actual router doesn't run any Teeworlds server, it won't know what to do. Imagine if the router got a message on port 8303 (the Teeworlds port) saying “connect me to the Teeworlds server”. Because there are more than one computer connected to your router from inside your household, it can't possibly know where to send this connection request. So it'll just ignore it.
By setting up port forwarding rules, your router will know where to send the message, within the local network. In that way, you can have one Teeworlds server running from your laptop, on port 8303, and another one from your desktop computer on port 8304. Because of the nature of the system, you cannot run two servers on the same port on different computers (or even the same computer).
The actual port forwarding differentiates depending on your router model. A good site which describes how port forwarding works is www.portforward.com. Select your router model (or a similar one if you can't find the one you have) in the list and the follow the “Default guide” and make sure to forward port 8303/UDP. It may be a bit tricky, but give it a try.