How to port forward a Stardew Valley server
Stardew Valley normally needs no port forwarding at all. Multiplayer goes through the platform's relay service, and invitations are handled by an invite code rather than an address.
Your setup
Pick the firmware family, not the exact model — the menus are identical across a range.
Default is 24642. If you changed it, it is the value of the port setting in the server mod.
The private address of the machine running the server — ipconfig on Windows, ip addr on Linux. It starts with 192.168, 10. or 172.
Open these
This firmware accepts ranges, so each line below is a single rule.
- 24642 UDP
24642UDPGame trafficOnly needed for direct IP invites. Stardew normally connects through the Galaxy relay, which requires no forwarding whatsoever.
Do not open these
This game has no remote-administration port to get wrong. Forward only what is listed on the left and nothing else.
Step by step: your router
- 1
Give the server a fixed local IP
A forward points at one address. If the server picks up a different one after a reboot, the rule silently starts pointing at nothing — this is why forwards "stop working" on their own.
On this router:look for DHCP Reservation, Address Reservation, Static Lease or Manually Assigned IP
- 2
Open the router admin page
Try these addresses in a browser on the same network:
- 192.168.0.1
- 192.168.1.1
- 192.168.2.1
- 10.0.0.1
Almost always printed on a sticker on the router itself.
- 3
Find the port forwarding page
Port Forwarding, Virtual Server, NAT, Applications & Gaming, or Port Mapping
Vendors use at least six names for the same feature. Whatever it is called, the page you want is the one asking for a port, a protocol and a device on your network. If the external and internal port fields both exist, set them to the same number.
- 4
Create one rule per line
a description field, if there is one External / WAN / Public / Service port Internal / LAN / Private port Protocol Internal IP / Device / Server IP Stardew Valley 24642 24642 UDP your server’s local IP External and internal port are the same number here. Changing the external port is possible, but then everyone connects on the new one, so keep them matched unless you have a reason.
- 5
Let the server through its own firewall
The router now sends traffic to the machine, and the machine can still refuse it. Windows Defender Firewall in particular blocks a freshly installed dedicated server by default, which looks exactly like a failed forward.
Take it with you
Stardew Valley — port forwarding rules -------------------------------------- 24642 UDP -> <server local IP>
Check whether it worked
Test from outside your own network. Connecting from a machine in the house proves nothing — that traffic never leaves the LAN and never touches the rule you just wrote.
This game uses a UDP port and has no query protocol we can speak, so there is no honest way for us to test it from here — a UDP port that is open and one that is filtered look identical from outside. Ask someone outside your network to connect instead.
What usually goes wrong
If you are here because friends cannot join, the cause is very rarely a closed port — it is usually a mismatch in game version or mod list, or an invite code from a previous session. Forwarding only enters the picture for a dedicated server setup running through a mod, and even then only for direct-IP connections.
Not forwarding at all
A dedicated Stardew server keeps the farm running so nobody has to wait for the host to be online, which is the actual limitation the relay does not solve.