To let friends outside your home join a server running on your PC, you forward TCP port 25565 on your router to that PC's local IP address, allow it through the firewall, and give friends your public IP. Below is every step, plus what to do when it still doesn't work because of CGNAT or double NAT.
Your router shares one public IP address between every device in your home. When a player connects to that public IP, the router doesn't know which device should get the connection, so it drops it. A port forward is a rule that says: "send anything that arrives on port 25565 to this computer". If you rent a server from a host, you do not need any of this. Port forwarding is only for servers at home. The full server setup is in how to make a Minecraft server.
The local IP is the address your router gives the PC that runs the server, usually starting with 192.168., 10. or 172.16. to 172.31..
ipconfig. Note the IPv4 Address and the Default Gateway of the adapter you use (Ethernet or Wi-Fi). The gateway is your router's address.ipconfig getifaddr en0 in Terminal (en0 is usually Wi-Fi on laptops).ip a for the address and ip route for the gateway (the address after default via).Routers hand out local addresses automatically and can give your PC a different one after a restart. If that happens, the port forward points to the wrong device and the server becomes unreachable. Fix it with a DHCP reservation (sometimes called "static lease" or "address reservation") in the router: pick your PC from the list of connected devices and reserve its current IP. This is easier and safer than setting a static IP by hand on the PC.
192.168.0.1 or 192.168.1.1) into your browser.The menu is called different things depending on the brand: Port Forwarding, Virtual Server, NAT, Applications or Gaming, often under Advanced. Create a rule like this:
| Field | Java Edition | Bedrock / Geyser |
|---|---|---|
| Name | Minecraft | Minecraft Bedrock |
| Protocol | TCP | UDP |
| External port | 25565 | 19132 |
| Internal port | 25565 | 19132 |
| Internal IP / device | your PC's local IP | your PC's local IP |
Save and, if the router asks, apply or restart. Only forward the Bedrock port if you run a Bedrock Dedicated Server or Geyser, and only forward ports you actually use. If you changed server-port in server.properties, forward that port instead.
Do not use DMZ or "expose host" as a shortcut. It sends every port to your PC, including ones you never meant to open.
The first time the server starts, Windows usually asks whether Java may communicate on networks. Allow it on private networks. If you missed the prompt, open Windows Defender Firewall with Advanced Security, choose Inbound Rules, then New Rule: Port, TCP, 25565, Allow the connection. Or run this in an administrator PowerShell window:
New-NetFirewallRule -DisplayName "Minecraft" -Direction Inbound -Protocol TCP -LocalPort 25565 -Action Allow
Add a second rule with -Protocol UDP -LocalPort 19132 if you need Bedrock. Third-party antivirus suites with their own firewall need the same exception.
If the macOS firewall is on (System Settings, Network, Firewall), it asks whether Java may accept incoming connections when the server starts. Click Allow. You can also add Java under the firewall's Options.
sudo ufw allow 25565/tcpsudo firewall-cmd --permanent --add-port=25565/tcp then sudo firewall-cmd --reloadDone.Testing your public IP from inside your own network often fails even when everything is correct, because many routers don't support "NAT loopback". You and others in your home should join with the local IP, while friends outside use the public IP. A phone on mobile data is another quick way to test from outside.
Most home connections get a new public IP from time to time. A dynamic DNS service gives you a name that follows your IP, and you can point your own domain at it as described in how to use a domain for a Minecraft server.
Look at the WAN or Internet IP shown on your router's status page and compare it with your public IP from "what is my IP".
100.64. to 100.127.: this is CGNAT. Your provider shares one public IP between many customers, and you cannot forward ports on their equipment.192.168.x.x or 10.x.x.x: this is double NAT. There is another router in front of yours, often the provider's modem.Either put the provider's modem in bridge mode so your own router gets the public IP, or forward the port on both devices: on the modem to your router's WAN IP, and on your router to the PC.
online-mode=true so nobody can join under someone else's name. server.properties explained covers why.If players still cannot join after all of this, work through can't connect to a Minecraft server.