How to Port Forward a Minecraft Server on Linux, Windows, and macOS
Creating your own Minecraft world on a local server can be exciting. However, it will only be visible to you, and playing alone can become tedious after a while.
With the help of port forwarding, you can provide a modded Minecraft server for anyone to connect and play.
This tutorial will show you how to port forward a server on Windows, macOS, and Linux and discuss the required configuration for this process.
What Is Port Forwarding?
If a user has a game server running locally on their machine and wants to play together with friends, connecting via an internal IP address, like 192.168.0.1, won’t work as it is a local IP address.
Port forwarding allows remote computers to connect your router and local network by using specific TCP and UDP ports. Usually, the port forwarding feature is available on most routers and can be accessed by logging in via the default router gateway.
How to Port Forward Minecraft?
To make a Minecraft server visible publicly, you will need to find the default server port, allow it through a firewall, and tinker with your router configuration.
Important! Before using the port forward feature, you should set up a Minecraft server.
Step 1 – Set the Port on Minecraft Configuration
To ensure your Minecraft server communicates correctly with your players, you need to set the appropriate port in the server configuration. Here are the default port numbers for Minecraft:
- 25565 – for Java Edition.
- 19132-19133 – TCP and UDP ports for Bedrock Edition.
For instance, if you set up a Minecraft server on Windows, follow these steps to configure the port:
- Open the Minecraft server directory and locate the server.properties file.
- Right-click on it and open it with a text editor of your choice, such as Notepad.
- Within the text editor, find the line that says server-port.
- Modify the server-port value to any number within the range from 1 to 65535. However, it’s advisable to stick to the default port unless you have a specific reason to change it.
- Save the changes in the text editor and close the file.
- Restart your Minecraft server to apply the changes.
Step 2 – Allow the Port on Your Firewall
To ensure that the server works correctly, you will need to allow the Minecraft port number via your system’s firewall.
In this section, we will go over the process for Windows, macOS, and Linux.
Firewall Management on Windows
- Open Windows Defender Firewall with Advanced Security.
- Click on Inbound Rules and select New Rule.
- Choose Port and click Next.
- Select TCP, and enter the Minecraft port number. In this case, it’s 25565. Once done, click Next.
- Select Allow connection and keep clicking Next until you reach the final step. Before hitting Finish, don’t forget to give your rule a name.
- After you have created the rule, make a new one using the same configuration, but this time for UDP.
Firewall Management on macOS
- Go to System Settings and select Network.
- Choose Firewall and click Options.
- Click the Add button, find the installed Java application, and confirm the selection. Make sure that the Allow incoming connections option is selected. Hit OK.
Firewall Management on Linux
Unlike Windows or Mac, Linux is equipped with a more sophisticated firewall. We recommend checking out our tutorial on how to configure your Ubuntu firewall.
Step 3 – Forward the Port on the Router
With the firewall set up and incoming network requests taken care of, proceed to create a port forward rule on your router. Even though each router has a different interface, the steps should be nearly identical.
- Find your default gateway IP address. It will be used to log in to the router.
- Set up a static IP address.
- Open the port forwarding settings.
- Specify which TCP and UDP ports to forward.
Finding Your Router Address and Setting up a Static IP on Windows
Press Windows+R and enter CMD to open the command prompt. Run the following command:
ipconfig
The router’s IP address will be shown next to the Default Gateway line.
To set up a static IP address, press Windows+R again and enter ncpa.cpl.
Right-click your network connection, select Properties, locate Internet Protocol Version 4 (TCP/IP), and hit Properties again:
Specify the preferred static IP address, subnet mask (255.255.255.0), and the router IP you acquired earlier.
Once done, click OK to save the changes.
Finding the Router Address and Setting up a Static IP on macOS
- Go to System Settings and select Network.
- Find the network you’re using and click Details.
- Go to the TCP/IP tab. The Router line will contain your router’s IP address.
Alternatively, open Terminal and use the following command to check the router IP address:
netstat -nr|grep default
To set up a static local IP address, go back to the TCP/IP section, choose Using DHCP with manual address, and specify the IP you would like to use. We recommend adding a 0 as the router IP.
Click OK to save the changes.
Finding the Router Address and Setting up a Static IP on Linux
To check the router IP on Linux-based systems, open Terminal and enter the following command:
route -n | grep "^0.0.0.0" | cut -d ' ' -f 10
To set up a static IP, you will need to edit the primary network configuration file. For example, the Ubuntu 22.04 configuration can be accessed by pasting this command into the Terminal and pressing Enter:
sudo nano /etc/netplan/01-netcfg.yaml
Here’s an example configuration where gateway4 is your router IP, and addresses refers to your preferred static IPv4 address:
# This file describes the network interfaces available on your system # For more information, see netplan(5). network: version: 2 renderer: networkd ethernets: ens33: dhcp4: no dhcp6: no addresses: [192.168.2.10/24] gateway4: 192.168.2.1 nameservers: addresses: [1.1.1.1,1.0.0.1]
Once done, save the changes made to the 01-netcfg.yaml file.
Logging in to the Router
Paste the router IP address to your web browser’s address bar and press Enter. A login pop-up will appear.
You will be asked for a username and password. If you are unsure where to find them, try checking the stickers on the bottom of your router.
Another option is to Google the router’s name and model number along with related keywords like default login credentials.
Expert Tip
If your router is still using the factory default credentials, change them immediately, as anyone could access your network.
Once logged in, look for options related to virtual server or port forwarding. In our example, we’ll use a D-Link router.
Check the Enabled option, give the forwarding rule a name, specify the local static IP address you’ve set previously, and enter the Minecraft server port. In this case, it’s 25565.
Don’t forget to apply these configurations for both TCP and UDP ports.
Once done, save your changes.
Pro Tip
If you are still unsure about the exact port forwarding procedure for your specific router, you can always Google the device name and look up the router’s manual.
Step 4 – Restart the Minecraft Server and Connect
For the port forwarding changes to apply, you will need to restart your Minecraft server. To do so, enter /stop in the server console and reinitialize the server.
Once the server has been restarted, open your preferred search engine and simply enter “what’s my ip”. You’ll be shown your public IP address that you’ll need to share with the people you wish to play with.
Expert Tip
Never share your public IP on the internet, as this can expose your physical location and make you a potential target for numerous cyber attacks.
Now, your players are finally able to join your server! Keep in mind that if the default server port 25565 was changed, users would need to connect using the 185.185.185.185:port syntax.
Alternatively, enter the IP address instead.
Looking for more Minecraft tutorials?
Conclusion
Having a local Minecraft server with port forwarding allows you to play with other people, making your gameplay experience more exciting and unique.
In this tutorial, we have covered the process of port forwarding a Minecraft server on Windows, macOS, and Linux systems. We’ve also shown how to allow an application through a firewall and navigate the router interface.
Should you have any questions, feel free to leave them in the comments section below.
Comments
August 23 2022
Java is not located in the Applications Folder in Mac OS Big Sur; where can I find it to turn it on in the Firewall?
August 25 2022
Hi! Java is not pre-installed with Mac OS X versions 10.7 and above, hence you would need to automatically install it for your current Mac. You can find more information on the official Java website ?
August 31 2022
I have try to open server on linux.When everything done,and try to connect. It show"Failed to connect to the server. Authentication servers are down. Please try again later, sorry! ". I'm not sure how to fix it.
September 02 2022
Hi! If you're getting this error while trying to join the server, you can check out this forum for a great solution! ?
May 29 2023
what do you mean by adding "port syntax" to the end of the ip?
June 02 2023
Hello there! We mean that when connecting to a Minecraft server you need to use this format: 185:185:185:185:1234 Where 185.185.185.185 is an example server IP and 1234 is an example server port.
August 06 2023
Hey! Ive been struggling with setting up port forwarding. I use the right port, setup port forwarding in the asus router with both protocol type, added the port in firewall, yet the port is still closed. Any tips?
August 11 2023
Hello there! Since each router software is different, I would highly suggest referring to their manual and making sure that everything is done correctly, also don't forget to reset the router afterward. As for firewall part depending on your system you can try to do this on a different computer. Lastly, for checking if setup is correct try this website.
January 21 2024
I've set up port forwarding successfully. I now want to only allow certain IP addresses to connect remotely. I tried adding "these IP addresses" under the Remote IP Addresses section of the Scope tab but still any external IP can connect. How do I allow only specific IP addresses in?
January 25 2024
Hi there! To ensure that only specific IP addresses can connect remotely after setting up port forwarding, double-check the entries in the "Remote IP Addresses" section on the Scope tab. Ensure the formatting is correct, and the designated IP addresses are accurately listed ?
May 12 2024
I'm using Quantum internet and It requires "WAN end and start" ports. It's wording is "Select protcol, then enter the WAN ports to forward." I don't understand what to put there
June 06 2024
Hello, To set up port forwarding for your Minecraft server, you will need to specify the WAN start and end ports. For Minecraft, the default port is 25565. This will forward traffic from the internet (WAN) to your Minecraft server ?
June 03 2024
how does this platform work?
June 06 2024
Hey there, This platform helps you set up port forwarding for your Minecraft server on different operating systems like Linux, Windows, and macOS. Port forwarding allows external devices to connect to your server over the internet ?
November 07 2024
The ip isn’t working after following all the steps, what can I do??
November 13 2024
Hey! It looks like you might want to double-check your port settings in both the Minecraft server and router. Also, make sure the firewall is allowing the right TCP and UDP ports. If your static IP isn’t matching up in both places, that could cause issues too. Don’t forget to restart everything – both the server and router. If it's still not working, try checking your router’s manual or reaching out to your ISP for more help. Hope that helps :D