When entering WireGuard settings manually, distinguish your device from the peer, then separate the tunnel address from the external endpoint. This guide is for iPad and iPhone users who already have a configuration for their device. Enter each value in its corresponding field, then check the handshake, routing, and actual connectivity in that order. Adjust MTU or Keepalive only if needed.
PrivateKey and PublicKey: Identify Which Key Belongs to Whom
Use the client configuration as your reference: [Interface] describes your device, and [Peer] describes the peer it communicates with. Each side has its own key pair. In Shadowrocket, enter your device's PrivateKey and the peer's PublicKey—not both values from the same key pair.
Local Device and Peer in the Client Configuration
[Interface] — Local device
PrivateKeyis the private key for your current device. Enter the original string exactly as provided, including any trailing equals signs, and don't paste the field name along with it.Addressis the address assigned to your device inside the tunnel. It is usually provided in the configuration and is not the address assigned to your iPad by the current Wi-Fi network.
[Peer] — Peer
PublicKeyidentifies the peer. The server uses your device's public key to identify it in return.Endpointis the destination for outgoing WireGuard UDP packets. If the configuration also includes aPresharedKey, enter the provided value in the corresponding field. It does not replace either public or private key.
Don't use a server configuration as a client configuration. When confirming your device's identity with an administrator, share your public key—not your private key or preshared key.
Address, Endpoint, and MTU: Field-by-Field Guide
The Address in a WireGuard configuration and the app's Address field for the server may have the same name. Use the field's location and purpose to tell them apart: if Address is paired with Port, it takes the host portion of Endpoint. Enter the tunnel address in the field for the client IP.
| Field | Example value | Where to enter it and what to check |
|---|---|---|
Address | 10.20.30.2/32 | The local IPv4 address inside the tunnel. If an IPv6 address is also assigned, enter each address in its corresponding field. Use the prefix provided in the configuration; don't change /32 to /24 on your own. |
Endpoint | 198.51.100.20:51820 | The peer's IP address or hostname, plus its UDP port. If the app has separate host and port fields, enter 198.51.100.20 and 51820 separately. Don't add https://. |
MTU | 1420 | The maximum size, in bytes, of an inner IP packet carried by the tunnel interface. The outer IP, UDP, and WireGuard headers also use some of the available transmission space, so the right value depends on the network path. |
PersistentKeepalive | 25 | The app's Keepalive setting, in seconds. It helps maintain UDP state in a NAT or firewall when there's no other traffic. It is not a handshake timeout or a latency test interval. |
The values in this table illustrate the format only. The example Endpoint uses a documentation-only address and cannot be used to connect. Use your own configuration, and don't treat the example port as a protocol requirement.
Add a WireGuard Server Manually in Shadowrocket
Start with the client configuration for your current device. If it lists multiple [Peer] sections, don't combine values copied from different sections to create one entry. These manual setup steps cover a single peer.
Select the protocol
Go to Home →「+」→ Add Server → Type → WireGuard. Confirm the protocol first, then enter the settings to avoid adding a WireGuard port to a server entry for another protocol.
Enter the peer details
Read
EndpointandPublicKeyfrom the same[Peer]section. Enter the host and UDP port in the server address and port fields, then enter the peer's public key. IfEndpointuses a domain name, keep the configured domain instead of treating an IP address from a single DNS lookup as permanent.Enter your device details
Enter the
PrivateKeyfrom[Interface]in the private key field, and put the tunnelAddressin the client IP field. If the configuration includes both IPv4 and IPv6 addresses, enter them in their respective fields. Don't paste an entire configuration line into a single input.Check optional settings
Check
MTU,PersistentKeepalive, and the preshared key against the original configuration. Don't fill in values that weren't provided. If the configuration includesAllowedIPs, especially when it lists only a few network ranges, first confirm which destinations should be reachable. This is a WireGuard peer setting, not the same as Shadowrocket'sConfigrules.Save and test
After saving, return to Home, select the entry you just added, and connect. Send an actual request to a destination that should go through this peer. Seeing the system VPN indicator only confirms that the VPN is enabled; it doesn't mean WireGuard has completed a handshake with the peer.
Global Routing: Separate Connection Failures from Rule Mismatches
First confirm that the test traffic is actually routed through WireGuard. AllowedIPs matches peer addresses and validates received traffic in WireGuard; Home → Global Routing determines whether Shadowrocket sends a request to the proxy. These settings serve different purposes and cannot replace each other. If the server only reaches a specific private network, test a known working service on that network rather than an arbitrary public website.
Config
RecommendedUse the rules in the current configuration file to handle requests. Check that the destination matches the expected rule and that the rule's outbound policy selects this WireGuard entry. If the request matches DIRECT, a successful connection doesn't prove WireGuard is working.
Best for: Everyday use and retesting after confirming how the rules route traffic.
Proxy
Temporarily send test requests handled by Shadowrocket through the currently selected proxy to rule out interference from Config rules. Note the original setting first, then restore it when you're done. If the same destination works under Proxy but not under Config, check the rules and their outbound policies first.
Best for: Briefly checking whether the same destination takes a different route because of the rules.
Common WireGuard Handshake, MTU, and Keepalive Issues
Keep the network, server entry, and test destination the same while troubleshooting, and change only one setting at a time. First check whether the peer can be reached, then investigate DNS resolution, transfer size, and recovery after idle periods. Problems at different stages call for different checks.
The connection is on, but why is there no handshake recorded by the peer?
First send a request that should actually go through this peer, then check the host and UDP port in Endpoint. Ask the peer administrator to confirm that your device's public key is registered, and verify the peer public key and any optional preshared key entered in the app. If the issue occurs only on a particular Wi-Fi network, test the same entry on another authorized network to distinguish a configuration problem from UDP connectivity on that network. Don't start by changing MTU or Keepalive.
A service works by IP address, but not by domain name. What should I check first?
First check whether the DNS server specified in the configuration is reachable through the current route, and whether the destination requires private DNS to resolve. Compare with a service known to support access by IP address. Don't simply replace an HTTPS site's domain with its IP for testing; certificate validation and site identification may fail as a result.
Small requests work, but large pages or file transfers stall. Should I change MTU?
Reproduce the issue on the same network and outbound route: small requests succeed, but larger transfers repeatedly stall. Then check the path MTU. If the current value is 1420, note it and try 1380 on its own, reconnect, and test the same resource again. Restore the original value if there's no improvement. These two numbers illustrate how to compare values; they are not universal settings.
It works right after connecting but drops after sitting idle. Should I enable Keepalive?
First confirm that the issue occurs on the same network while the connection remains on, not after switching Wi-Fi or the system disconnecting the VPN. If the initial handshake and ongoing transfers work, but replies fail only after the connection has been idle, try 25 seconds if recommended by your configuration provider, then retest after the same idle period. Keepalive sends packets periodically. If you don't have this issue and the configuration doesn't require it, there's no need to add background traffic.
Get Shadowrocket and Follow the Setup Guide
Get Shadowrocket for iPhone and iPad from the App Store for a one-time payment of $2.99. Check the App Store listing for system requirements. The Mac (Apple silicon and Intel), Windows, Android, and Linux versions are free; download them from this site's download page.