If you already have a WireGuard configuration, enter its settings in two groups: Private Key and Address belong to your device; the Peer’s Public Key, Endpoint, and Allowed IPs belong to the remote peer. After saving, send a request that should use WireGuard, then check whether there’s no handshake, a handshake with no response, or only larger requests getting stuck.
Add WireGuard from Add Server
The steps below use the Home screen on iPhone / iPad. Open your existing WireGuard configuration and find the [Interface] and [Peer] sections. Don’t mix up the addresses and keys in these sections: the first describes your device’s tunnel interface, while the second describes the peer it communicates with. Compare and enter the details locally; don’t send the full configuration in a chat or support ticket.
Choose the protocol
On Home, tap the “+” in the top-right corner to open Add Server, then choose WireGuard under Type. If you already have another working configuration, keep it and add a separate entry for testing.
Enter your device’s settings
Use
[Interface]to enter Private Key and Address. Keep the prefix length if Address includes/32or/128. If the original configuration specifies an MTU, start with that value.Enter the peer settings
Use
[Peer]to enter the peer’s Public Key, Endpoint, and Allowed IPs. If the app has separate host and port fields for Endpoint, enter them separately. Endpoint is not a URL withhttps://. Enter Preshared Key only if it appears in the original configuration.Save and test
After saving, return to Home and select the entry you just added. Check Global Routing, turn on the connection, and visit a permitted destination that should be reachable through this peer. Turning on the connection only confirms that it’s enabled locally; it doesn’t confirm a handshake or working traffic.
What to enter for Private Key, Peer, and Endpoint
PrivateKey is your device’s private key. The PublicKey under [Peer] is the remote peer’s public key. Your provider registers your device’s public key, which corresponds to your Private Key—not your private key itself. If you replace your device’s key, the remote registration must also be updated. Changing only Shadowrocket’s settings won’t restore the handshake.
Device settings · [Interface]
- Private Key
- The
PrivateKeyfrom the original configuration. Enter it on your device only. - Address
- Your device’s tunnel address. Example:
192.0.2.10/32. - MTU
- Limits the size of IP packets in the tunnel. Keep the specified value from the original configuration to start.
Address is neither your public exit IP nor the Endpoint.
Peer settings · [Peer]
- Public Key
- The
PublicKeyfor this Peer in the original configuration. - Endpoint
- The peer’s host and UDP port. Example:
198.51.100.20:51820. - Allowed IPs
- The tunnel subnet assigned to this Peer. Example:
203.0.113.0/24. - Preshared Key
- An optional shared key. If used, it must match on both ends; don’t enter the Public Key here instead.
The peer’s public key, Endpoint, and subnet in an entry must all come from the same Peer.
The IP addresses in these cards are documentation examples and won’t connect. The actual Endpoint may also be a domain name; your device must resolve it before it can send the handshake to the corresponding UDP port. Use the port from the original configuration—don’t change it to 51820 just because that’s the example.
How Allowed IPs and Global Routing work together
First check whether the request is sent through WireGuard, then check whether the destination IP belongs to that Peer. Global Routing determines how Shadowrocket handles traffic. Allowed IPs is a list of IP prefixes used by WireGuard to select an outbound peer and validate the source address of packets decrypted from that peer. It isn’t a domain rule, and adding a default prefix won’t automatically route requests matched as DIRECT through WireGuard.
Config
RecommendedFollow the rules in the current configuration. When testing, check which rule matches the destination and which policy applies. Confirm that traffic is actually sent through WireGuard—not matched as DIRECT or sent through another route by FINAL.
Best for: everyday rule-based routing and checking whether a specific destination uses WireGuard.
Proxy
You can temporarily test the proxy route using the selected WireGuard entry to reduce interference from Config rules. If Proxy works but Config doesn’t, check the matched rule and selected policy first; there’s no need to change the key or MTU right away.
Best for: briefly comparing results while keeping the destination and network the same.
If the original configuration only includes a private service subnet, test with a known reachable service in that subnet—not an arbitrary public homepage. For a domain, also check its resolved IPv4 or IPv6 address. The same domain can return both, while the existing configuration may allow only one. Don’t widen a narrow subnet to the default route just to make a test pass.
Troubleshooting: handshake failures and no traffic after a handshake
Keep the test destination and Global Routing settings fixed, and change one thing at a time. If the current app or remote status shows the latest handshake time, check it after sending a new request. WireGuard may not handshake immediately while idle, and a successful handshake in the past doesn’t prove it can communicate now.
- No handshake after sending a request: First confirm the request is actually routed through WireGuard, then check that the Endpoint resolves and its UDP port is reachable. If the same configuration fails on Wi-Fi but handshakes over cellular, check name resolution or UDP reachability on the original network. Don’t replace the keys at the same time. Being able to open a webpage only confirms that webpage’s route works; it doesn’t prove the WireGuard UDP port is reachable.
- No handshake on another network either: Compare the original configuration and make sure the device’s Private Key, the Peer’s Public Key, and any Preshared Key belong to the right entry. If you’ve generated a new device key, confirm that the remote side has registered the matching public key. When asking for help, share when it happened, the network type, and whether a handshake appeared. Never include your private or shared key.
- Handshake updates, but traffic doesn’t work: Check that the destination IP falls within Allowed IPs and that Address is the tunnel address assigned to your device. If a known IP service in the subnet works but its domain doesn’t, check the DNS response and whether that address is reachable. If the address and rules are correct but there’s still no response, ask the network administrator to check the return route for your client address, forwarding, and access policies.
- The first request often times out after idle periods: If traffic is stable while active, compare consecutive requests with requests after an idle period on the same network. Check whether network equipment is expiring the UDP mapping too soon. Set Persistent Keepalive to the specified value only if the configuration requires it and the app provides the option. It can help maintain the mapping, but it won’t fix an incorrect port or key.
When to adjust MTU
Consider MTU a likely factor when the handshake works and small requests complete, but larger responses from the same site repeatedly stall. WireGuard encapsulation uses extra space for transport; if the path can’t carry packets as large as the current setting and can’t reliably signal that they’re too large, small packets may get through while larger ones are repeatedly dropped. If there’s no handshake at all, check the Endpoint, UDP reachability, and keys first—not the MTU.
- Record a baseline: Note the original MTU, network type, and test destination. On the same network with the same routing policy, test a small response and a larger one, and confirm the issue is reproducible. One slow page load isn’t enough to diagnose an MTU problem.
- Change only the MTU: Start with the value recommended in the configuration. If the original is
1420and testing a different value is allowed, try1380and repeat the request to the same destination. These values are troubleshooting examples, not universal settings. - Retest and restore: Compare the results before and after the change, making sure the network or routing policy hasn’t changed. If there’s no consistent improvement, restore the original value. If only one Wi-Fi network needs a lower value, record that finding rather than applying it to other devices and networks.