Because of the amount of Support threads about port forwarding and connection issues I decided to make a tutorial about it with explanations of the basic things.
Port Forwarding
Port forwarding works different on every router, therefore there are different tutorials for (almost) every router.
There are several websites for that, the most known one is portforward.com
The tutorials on portforward.com are often missing required things you need to do so you can also try YouTube, type your router in search with the words port forwarding and you will often find video tutorials how to open ports in your router.
Incase it's not clear enough in the port forward tutorial you found for your router.
The IP you have to enter when you open the ports is your IPv4 address. You can find this by typing cmd in start -> search and type ipconfig.
The default gateway is the IP you have to enter in your internet browser to connect to your router.
For OTS you have to open 3 ports.
Port 7172 is the game port, to login from the character list ingame.
Port 80 is for your website, if port 80 is open, people can connect to your website.
Connection
1. I opened the ports but people still can't connect to my server/website
The (windows) firewall blocks the ports. So you can turn it off or open the ports in it.
If you are not sure how to do this, there are alot of tutorials about it on YouTube.
Other things that might block the ports are programs like virusscanners, so if you have one and the ports still aren't opened, you can try to turn off that aswell.
It's also possible that firewalls/viruscanners block the server, so you can add the server as exception or turn them off.
To test if the ports are opened you can use this site from @HalfAway.
http://www.************/index.php?portchecker
Make sure your server and website is online when you test it else it will say they are closed even when they are open.
You can also use other (not OT related) portcheck sites like www.canyouseeme.org, but it's possible that these sites show the ports as closed when they are actually open (depens on router settings).
So I would recommend to use the halfaway portchecker instead.
If port 80 is still not opened but the other ports are, it's possible your ISP is blocking it, so you can call them and ask to unblock it.
It's also possible the other ports are blocked this way, but it's less common.
2. Which IPs should be used
In config.lua you have to add your global ip or your domain/no-ip address.
If you don't know how to set up a free domain, you can follow this tutorial.
People also have to use this IP to connect to your server and website.
If you used your domain in config.lua and people can't login, test with your global ip to make sure there is nothing wrong with your domain.
If people can connect with your global ip, try to create a new domain and use that.
3. I can't connect to my own server but other people can
It's normal if you can't connect with your global ip to your server or website if you connect from the computer that hosts the server/website.
There are other IPs you can use instead.
You can try to use 127.0.0.1, your IPv4 address or add your domain to hosts and use your domain to connect: https://otland.net/threads/help-with-my-webpage.223416/#post-2146872
For further explanation:
Open your hosts file (C:/Windows/system32/drivers/etc/hosts in Windows).
I recommend to use notepad++ to do this incase you accidentally do save as which will turn the hosts file in a .txt file when you use text edit programs like the default windows notepad and then it won't work.
If you can't save the hosts file, make sure it's only opened once and run notepad++ as administrator.
In the hosts file write your IPv4 address and next to that your domain.
Then add your domain in config.lua and use your domain in your IP Changer to connect to your server.
When you have the same problem when you connect from a different computer from the same network, you can do the same thing there, with the IPv4 address of the host pc.
Note: This workaround doesn't work for some older (Crying Damson) versions, for these versions use your global ip in config.lua and your IPv4 address in your IP Changer.
4. Port 80 is opened but people are connected to my router page instead of my website
Sometimes port 80 is already opened to be able to acces your router from a different network.
The portchecker tools will show that port 80 is opened, but when people write your global ip/domain, they will see your router page instead of your website.
In that case you can just open port 80 the same way as 7171 and 7172, so with your IPv4 address, this way people will connect to your website.
5. My ports were opened before and now they are closed
It's possible that your IPv4 address changes when you restart your computer, if that happens you have to set up a Static IP Address.
If you don't know how to do that, you can use these tutorials from portforward.com: http://portforward.com/networking/staticip.htm
You can also find alot of tutorials about it on YouTube.
6. How to connect from different computers from the same network without port forwarding
If you can't open your ports and just want to play for example with friends or family in your house, then you can use the IPv4 address of the host pc in config.lua and in the IP Changer, also from other pcs you have to use the IPv4 address from the host pc in the IP Changer.
7. I can't connect at all to my server, not even on localhost
There can be all kinds of things wrong besides port, firewall/virusscanner or wrong IP related issues.
Look in your console if it shows errors, it is usually related to config.lua values, the database or login.lua (or an other creaturescript with type login).
login.lua
When the problem is with a login creaturescript, it will show that script in the error.
If you don't know how to solve this error you can ask for help in Support.
Database
Database errors that cause the character from not being able to login can be because of wrong character values in the database, such as not existing group ids.
For that error you can look in data/XML/groups.xml what the groups are in your datapack and change it in your database (or add more groups to your groups.xml).
If you can't connect to your server because the password is incorrect, then your server is probable using sha1 encryption for passwords while your password in the database is plain.
To change the plain password to sha1 you can use websites or a query.
config.lua
If you get errors such as these.
It can be solved by setting bindOnlyGlobalAddress (or something similar since it's not called the same in every server) in config.lua to false/"no".
Other config related issues can be caused if you use a config.lua from a different server, which means some variables will be missing or set to wrong values.
Which can result in into client errors such as "Disconnected from server".
So make sure you use the config.lua that was made for your server version.
Also outdated IP Changers can cause connection issues, so you can try to use the latest OTLand IP Changer.
Port Forwarding
Port forwarding works different on every router, therefore there are different tutorials for (almost) every router.
There are several websites for that, the most known one is portforward.com
The tutorials on portforward.com are often missing required things you need to do so you can also try YouTube, type your router in search with the words port forwarding and you will often find video tutorials how to open ports in your router.
Incase it's not clear enough in the port forward tutorial you found for your router.
The IP you have to enter when you open the ports is your IPv4 address. You can find this by typing cmd in start -> search and type ipconfig.
The default gateway is the IP you have to enter in your internet browser to connect to your router.
For OTS you have to open 3 ports.
- 7171
- 7172
- 80
Port 7172 is the game port, to login from the character list ingame.
Port 80 is for your website, if port 80 is open, people can connect to your website.
Connection
1. I opened the ports but people still can't connect to my server/website
The (windows) firewall blocks the ports. So you can turn it off or open the ports in it.
If you are not sure how to do this, there are alot of tutorials about it on YouTube.
Other things that might block the ports are programs like virusscanners, so if you have one and the ports still aren't opened, you can try to turn off that aswell.
It's also possible that firewalls/viruscanners block the server, so you can add the server as exception or turn them off.
To test if the ports are opened you can use this site from @HalfAway.
http://www.************/index.php?portchecker
Make sure your server and website is online when you test it else it will say they are closed even when they are open.
You can also use other (not OT related) portcheck sites like www.canyouseeme.org, but it's possible that these sites show the ports as closed when they are actually open (depens on router settings).
So I would recommend to use the halfaway portchecker instead.
If port 80 is still not opened but the other ports are, it's possible your ISP is blocking it, so you can call them and ask to unblock it.
It's also possible the other ports are blocked this way, but it's less common.
2. Which IPs should be used
In config.lua you have to add your global ip or your domain/no-ip address.
If you don't know how to set up a free domain, you can follow this tutorial.
If you used your domain in config.lua and people can't login, test with your global ip to make sure there is nothing wrong with your domain.
If people can connect with your global ip, try to create a new domain and use that.
3. I can't connect to my own server but other people can
It's normal if you can't connect with your global ip to your server or website if you connect from the computer that hosts the server/website.
There are other IPs you can use instead.
You can try to use 127.0.0.1, your IPv4 address or add your domain to hosts and use your domain to connect: https://otland.net/threads/help-with-my-webpage.223416/#post-2146872
For further explanation:
Open your hosts file (C:/Windows/system32/drivers/etc/hosts in Windows).
I recommend to use notepad++ to do this incase you accidentally do save as which will turn the hosts file in a .txt file when you use text edit programs like the default windows notepad and then it won't work.
If you can't save the hosts file, make sure it's only opened once and run notepad++ as administrator.
In the hosts file write your IPv4 address and next to that your domain.
Then add your domain in config.lua and use your domain in your IP Changer to connect to your server.
When you have the same problem when you connect from a different computer from the same network, you can do the same thing there, with the IPv4 address of the host pc.
Note: This workaround doesn't work for some older (Crying Damson) versions, for these versions use your global ip in config.lua and your IPv4 address in your IP Changer.
4. Port 80 is opened but people are connected to my router page instead of my website
Sometimes port 80 is already opened to be able to acces your router from a different network.
The portchecker tools will show that port 80 is opened, but when people write your global ip/domain, they will see your router page instead of your website.
In that case you can just open port 80 the same way as 7171 and 7172, so with your IPv4 address, this way people will connect to your website.
5. My ports were opened before and now they are closed
It's possible that your IPv4 address changes when you restart your computer, if that happens you have to set up a Static IP Address.
If you don't know how to do that, you can use these tutorials from portforward.com: http://portforward.com/networking/staticip.htm
You can also find alot of tutorials about it on YouTube.
6. How to connect from different computers from the same network without port forwarding
If you can't open your ports and just want to play for example with friends or family in your house, then you can use the IPv4 address of the host pc in config.lua and in the IP Changer, also from other pcs you have to use the IPv4 address from the host pc in the IP Changer.
7. I can't connect at all to my server, not even on localhost
There can be all kinds of things wrong besides port, firewall/virusscanner or wrong IP related issues.
Look in your console if it shows errors, it is usually related to config.lua values, the database or login.lua (or an other creaturescript with type login).
login.lua
When the problem is with a login creaturescript, it will show that script in the error.
If you don't know how to solve this error you can ask for help in Support.
Database
Database errors that cause the character from not being able to login can be because of wrong character values in the database, such as not existing group ids.
For that error you can look in data/XML/groups.xml what the groups are in your datapack and change it in your database (or add more groups to your groups.xml).
If you can't connect to your server because the password is incorrect, then your server is probable using sha1 encryption for passwords while your password in the database is plain.
To change the plain password to sha1 you can use websites or a query.
config.lua
If you get errors such as these.
Code:
[ServicePort::open] Error: bind: The requested address is not valid in its context
[ServicePort::open] Error: An invalid argument was supplied
Other config related issues can be caused if you use a config.lua from a different server, which means some variables will be missing or set to wrong values.
Which can result in into client errors such as "Disconnected from server".
So make sure you use the config.lua that was made for your server version.
Also outdated IP Changers can cause connection issues, so you can try to use the latest OTLand IP Changer.
Last edited: