Cloud server with WireGuard
Like the Tailscale setup, the gateway does not listen on the public internet: it listens only on the server’s WireGuard address, and the iPhone reaches it through the tunnel. The difference is that you run the tunnel yourself, with no third-party coordination service. The server opens one UDP port for WireGuard and nothing for hmob.
The examples use these addresses; replace them with your own:
| Address | |
|---|---|
| WireGuard network | 10.8.0.0/24 |
| Server (WireGuard endpoint) | 10.8.0.1, listening on UDP 51820 |
| iPhone | 10.8.0.2 |
Before you start
Section titled “Before you start”- A Linux server (x86_64 or aarch64) with herdr installed, root access, and
wireguard-tools,nftablesandqrencodeinstalled (for examplesudo apt install wireguard-tools nftables qrencode). - The official WireGuard app and the Hmob app on the iPhone.
1. Server: WireGuard endpoint
Section titled “1. Server: WireGuard endpoint”Create keys for the server and the phone:
sudo sh -c 'umask 077; cd /etc/wireguard && wg genkey | tee server.key | wg pubkey > server.pub && wg genkey | tee phone.key | wg pubkey > phone.pub'Create /etc/wireguard/hmobwg.conf:
[Interface]Address = 10.8.0.1/32ListenPort = 51820PostUp = wg set %i private-key /etc/wireguard/server.keyPreUp = nft -f /etc/wireguard/hmobwg.nftPostDown = nft delete table inet hmobwg
[Peer]# iPhone: the contents of /etc/wireguard/phone.pubPublicKey = <phone public key>AllowedIPs = 10.8.0.2/322. Server: let the phone reach hmob only
Section titled “2. Server: let the phone reach hmob only”By default a WireGuard peer can reach every service on the server. Allow only hmob and drop everything else from the tunnel. Create /etc/wireguard/hmobwg.nft:
table inet hmobwg { chain input { type filter hook input priority filter - 5; policy accept; iifname "hmobwg" ip saddr 10.8.0.2 ip daddr 10.8.0.1 tcp dport 8443 accept comment "hmob" iifname "hmobwg" drop }}Start the tunnel:
sudo systemctl enable --now wg-quick@hmobwgsudo wg show hmobwgIn your cloud firewall or security group, allow inbound UDP 51820 (narrow the source to the networks you use if you can). Do not open TCP 8443.
3. Phone: import the tunnel
Section titled “3. Phone: import the tunnel”Generate the phone’s configuration on the server and show it as a QR code:
SERVER_PUBLIC_IP=203.0.113.10 # your server's public addresssudo sh -c "umask 077; cat > /etc/wireguard/phone.conf" <<EOF[Interface]PrivateKey = $(sudo cat /etc/wireguard/phone.key)Address = 10.8.0.2/32
[Peer]PublicKey = $(sudo cat /etc/wireguard/server.pub)Endpoint = $SERVER_PUBLIC_IP:51820AllowedIPs = 10.8.0.1/32PersistentKeepalive = 25EOFsudo qrencode -t ansiutf8 < /etc/wireguard/phone.confIn the WireGuard app, tap + → Create from QR code, scan it and turn the tunnel on. Then delete the phone’s key material from the server:
sudo rm /etc/wireguard/phone.conf /etc/wireguard/phone.keyAllowedIPs = 10.8.0.1/32 sends only traffic for the server through the tunnel; the rest of the phone’s traffic is unaffected.
4. Server: install the gateway
Section titled “4. Server: install the gateway”As the user who runs herdr (not root):
curl -fsSL https://hmob-app.github.io/install.sh | shexport PATH="$HOME/.local/bin:$PATH" # if the script says it is not on PATHhmob install-service --bind 10.8.0.1ss -ltn | grep 8443 # only 10.8.0.1:8443This installs a systemd user service and enables lingering, so it runs at boot without you logging in.
5. Pair your iPhone
Section titled “5. Pair your iPhone”hmob pair --url https://10.8.0.1:8443With the WireGuard tunnel on, open the Hmob app, tap Scan pairing QR code and scan the code. Always scan: manual entry has no certificate fingerprint and fails against the gateway’s self-signed certificate.
Rule-based VPN clients (Stash, Clash and similar)
Section titled “Rule-based VPN clients (Stash, Clash and similar)”Rule-based clients send private address ranges such as 10.0.0.0/8 outside their tunnel by default, so connecting to 10.8.0.1 times out. Use a private host name instead:
- Pick a name ending in
.testor.internal, for examplehmob.wg.test. The app relaxes iOS’s system trust check only for these reserved suffixes; the QR fingerprint still decides trust. - Run a small DNS server on the server’s WireGuard address that answers that name with
10.8.0.1and forwards everything else (for examplednsmasq --host-record=hmob.wg.test,10.8.0.1 --listen-address=10.8.0.1 --bind-interfaces --server=1.1.1.1), and allow TCP/UDP 53 from the phone inhmobwg.nftbefore the drop rule. - In the client, use fake-ip DNS, set the WireGuard outbound’s
dnsto10.8.0.1, and putDOMAIN,hmob.wg.test,<your WireGuard outbound>before any LAN-direct rule. - Pair with
hmob pair --url https://hmob.wg.test:8443.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Check |
|---|---|
| Pairing times out | The tunnel is on in the WireGuard app and sudo wg show hmobwg shows a recent handshake; UDP 51820 is open; sudo tcpdump -ni hmobwg port 8443 sees packets. |
| Packets arrive but nothing connects | sudo nft list table inet hmobwg: the accept rule is before the drop; ss -ltn shows hmob on 10.8.0.1:8443. |
| “A TLS error caused the secure connection to fail” | You entered the address by hand, or used a host name not ending in .test / .internal. Pair again by scanning. |
| Large screens stall | Lower the tunnel MTU to 1280–1380 (MTU = 1380 in the phone’s [Interface]). |