By default your router should block incoming data. By port forwarding you allow incoming data on specific ports to pass through the router and to a computer on your network.
It is the responsibility of programs listening on a port to not be vulnerable. Most video games are safe. Open-source software with a decently large user base should be safe, since individuals can inspect the networking code and determine if vulnerabilities are present.
If you're unsure about the safety of hosting a server, consult the community for that software or a general software board. You should also be careful to properly configure services like SSH and FTP (which are hosted on ports 20 and 21) since these programs grant access outside access to your computer.
If you don't know the login name and password to your router, you can try these various approaches.
Keep the login name and password handy.
IPv4 addresses are used within a network. An IPv4 address looks like 192.168.1.1. (The numbers may be different.)
Run cmd.exe. Enter route print 0.0.0.0 into the prompt.
Look for "IPv4 Route Table", below should be "Active Routes". Under the "Network Destination" column, find the 0.0.0.0 entry.
The default gateway address and your IPv4 address are under the "Gateway" and "Interface" columns.
|On Mac OSX...||
Open the Terminal app. It should be under Utilities in your Applications directory. Enter route get default | grep interface into the prompt.
Now enter ifconfig, followed by a space and then the name of the interface found above. Look for a line with "inet" in the first column. Your computer's IPv4 address should be in the next column.
Open a terminal and enter ip route show default.
Next to "default via" is the default gateway address. Further into the line, next to "src", is your computer's IPv4 address.
Be warned that routers vary, these instructions may not match exactly to the tools your router has given you. Use some imagination when necessary.
Open a web browser and go to your default gateway address. At any point you may need to enter the login information from before. You have it.
If you can't log in even after trying defaults, consider resetting your router. On most routers, there is a pinhole on the backside. (It's also probably labeled as a reset button.) Try holding it pressed for a few seconds. Again, if you have the manual, you may want to read it if you can't find a reset button or you're not sure how the router will respond.
Remember that if you reset your router, your Wi-Fi password will likely change. Previous port forwarding would also be reset.
Navigate to Firewall, Firewall Rules, Port Forwarding, Forwarding, Virtual Servers, NAT, Applications, or a similarly named page. You may need to navigate through several pages or tabs. E.g. Applications can be under a Firewall category (some AT&T U-verse routers).
Common categorization includes Settings, Firewall, Security, plus combinations of these.
If given a list of computers, select the computer with the same address as your own. Or enter the address if that's an option. You may also recognize the computer's name.
Now look for a way to add a Rule, Application, or Virtual Server. If given an option to select a preset, select a general preset.
If you have this field, set it to "Any" (if you have a list of options), 0.0.0.0, an asterisk (*), or even leave it blank.
This field determines which remote addresses are permitted to send data through the forwarded port. If you set it to a specific address (not 0.0.0.0, that's the "Any" address), anyone who does not have that address will not be able to connect to your server, which is probably not what you want.
Save or apply changes as many times as necessary. Even after adding the rule etc., you may need to save the changes to the firewall etc. afterward.
Your router can change the addresses of computers on the network. But you can override this. Read about it here.
Your system may have a firewall that blocks incoming data too. Read about that here.