Port forwarding for a Stardew Valley server
In the usual setup Stardew Valley needs nothing forwarded. Its multiplayer is carried by the platform's relay, and friends come in with an invite code instead of an address.
Your setup
Choose the firmware family rather than your exact model — every router in a family shares the same menus.
Out of the box it is 24642. If you changed that, use whatever you set in the port setting in the server mod.
The local address of the computer that runs the server. Find it with ipconfig on Windows or ip addr on Linux; it will begin with 192.168, 10. or 172.
Open these
Your firmware takes ranges, so each line here is one 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
Good news: this game has no remote-admin port that could be exposed by mistake. Forward the ports on the left and stop there.
Step by step: your router
- 1
Give the server a fixed local IP
A forwarding rule targets a single local address. If the server comes back from a reboot with a new one, the rule quietly points at an empty address — which is how forwards seem to "break by themselves".
On this router:look for DHCP Reservation, Address Reservation, Static Lease or Manually Assigned IP
- 2
Open the router admin page
From a device on the same network, open one of these in a browser:
- 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 Use the same number for the external and internal port. You can make the external one different, but then every player has to connect on that new number, so keep them identical unless you have a specific reason not to.
- 5
Let the server through its own firewall
The router is now sending traffic to the right computer, but that computer can still turn it away. Windows Defender Firewall is the usual offender: it blocks a newly installed dedicated server by default, and from outside that is indistinguishable from a broken forward.
Take it with you
Stardew Valley — port forwarding rules -------------------------------------- 24642 UDP -> <server local IP>
Check whether it worked
Always test from outside your network. A connection from another device in the house proves nothing: that traffic stays on your LAN and never passes through the rule you just created.
This game listens on UDP and has no query protocol we support, so we cannot test it honestly from here: seen from outside, an open UDP port and a filtered one look exactly alike. The reliable test is a friend outside your network trying to connect.
Advertisement
The usual mistake
Friends stuck outside? Suspect the port last. Check first that everyone runs the same game version and the same mods, and that nobody is using an invite code from an old session. Port rules only become relevant with a dedicated server built on a mod, and then only for people connecting by IP.
Advertisement
Skipping port forwarding
A dedicated Stardew server keeps the farm open without everyone waiting on the host — the one limitation the relay cannot fix.