Keep your server's IP address from being blocked
On some networks, a VPN server's IP address is blocked within hours. To make yours much harder to block, turn away probes first, then add a second IP address for its outgoing traffic.
How a network finds a VPN server
A network can recognize the connection itself: the shape of its traffic, or how the server answers a probe. A self-signed certificate with a made-up name gives a server away, too: the name is sent in clear, and a probe sees the certificate. A trusted certificate makes a connection look like a visit to an ordinary website.
Or it can look at where the traffic goes. Some countries may use reputation systems for this: when many people reach local banks, government services and other local sites from the same foreign IP address, that address can be classified as a VPN or a proxy and added to a blocklist. The sites need not be local, either: a censor can run servers of its own abroad and watch which addresses reach them.
Or someone simply tells it. An access key is not encrypted, and anyone who has one can read the server's address from it, so share your keys with as few people as you can.
Turn away probes
With MinClientProtocolVersion set to 15, every app must prove in its first request that it holds an access key, and anything that cannot gets the plain refusal of an ordinary web server.
This needs your server and your users' apps on VpnHood 9.1 or later. Update them first, in either order: an updated app still connects to a server that is not updated yet.
A managed server takes it from its server profile. On a standalone server, put it under FileAccessManager in /opt/VpnHoodServer/storage/appsettings.json, then restart the server; on Linux, the install command can set it for you.
Only apps on VpnHood 9.1 or later can connect
{
"Session": {
"MinClientProtocolVersion": 15
}
}Older apps then cannot connect, and nothing tells them to update. Wait until your users have updated: until then, leave the setting at its default, 8, which lets every app in.
Use one IP to connect and another to go out
Give the server two public IP addresses, each with one job:
- The connection IP is the address your users' apps connect to. It is the one in their access keys.
- The outgoing IP is the address the server's traffic to websites leaves from. It is the only one websites see.
Websites can only report the address they see, so if an address gets flagged that way, it is the outgoing IP, and your users keep connecting to the other one. You can even replace a flagged outgoing IP without sending anyone a new key, because no key contains it.
VpnHood! SERVER has no setting for the outgoing IP. It reaches websites like any other program on the machine, so the operating system decides which address that traffic leaves from. You set the outgoing IP in the operating system, and the connection IP in VpnHood.
Add a second IP address
Order an additional IPv4 address from your hosting provider, and add it to the machine as the provider's documentation describes. Outside Docker, you can leave that part to the server: it adds an address it is set to listen on by itself.
Keep the machine's main address as the outgoing IP, and make the new one the connection IP. The operating system already sends its traffic from the main address, so there is less to change, and if your users can no longer reach the main address, it can still do this job.
Set the outgoing IP
This command shows the address the machine sends its traffic from: the one after src.
ip route get 1.1.1.1The output, with 198.51.100.20 as the outgoing IP
1.1.1.1 via 198.51.100.1 dev eth0 src 198.51.100.20 uid 0
cache
If it shows the new address rather than the main one, the machine is set up the other way round. The simplest fix is to swap the roles: use the address it shows as the outgoing IP, and the other one as the connection IP.
In Docker, the server shares the host's network, so the host's settings apply.
On a cloud where the machine itself has only private addresses, such as AWS, Google Cloud, Azure or Oracle Cloud, each public IP is mapped to one of them. Use the private addresses on the machine and wherever the server listens, and the public connection IP wherever an address goes into the keys.
Make the server use the connection IP
Tell VpnHood! SERVER to listen on the connection IP only, and to put only that address in the access keys. The outgoing IP then does not answer as a VPN server, even to someone who probes it.
Set both yourself: left alone, the server learns its address from its outgoing traffic, on a managed server and a standalone one alike, so it would find the outgoing IP. Set your server's IP addresses shows how.
Keys you gave out before carry the old address. Keep the server listening on it for a few days, so apps pick up the new key by themselves, then remove it: until you do, the outgoing IP still answers as a VPN server.
Check the result
Connect from a device and look up your IP address on any site that shows it. You should see the outgoing IP.
If the connection IP stays reachable from then on, the network was finding your server by where its traffic goes. If it is still blocked within hours, the network is recognizing the connection itself: give the server a trusted certificate and the settings for a censored network.
Give the server a trusted certificate
Out of the box, the server presents a self-signed certificate with a made-up name. Give it a domain name you own, with a certificate from a certificate authority such as Let's Encrypt, and a connection to it looks like a visit to an ordinary website.
Pick a host name that does not hint at a VPN, such as api.example.com: the names in a trusted certificate are public, since every certificate an authority issues goes into public logs. Use a certificate for that one name rather than a wildcard one: VpnHood! MANAGER does not take wildcard certificates, and your users' apps send the name in clear anyway.
A host that refuses strangers is nothing unusual: many sites keep an API or their files on a host of their own, and their website on www.example.com, often somewhere else. Your domain can do the same. The server shows no website of its own, since that would give a probe one more thing to recognize it by, so point www.example.com at any site you like, on any hosting.
Make it the name your users' keys carry. A probe that sends the name your users' apps send then gets that certificate, and so does a probe that sends no name, as a server presents its trusted certificate first.
A domain does not get your users past a blocked address, though: it points at the same server, and the keys still carry the server's IP address. Only a reverse proxy puts other addresses in front of the server.
Use a domain name and a trusted certificate shows how, on a managed server and on a standalone one.
Use a name of your choice, without a domain
The name your users' apps send in clear is always the name of the server's certificate: there is no separate setting for it. A self-signed certificate can carry any name, even one you do not own, as apps accept it by the fingerprint in their key and never look the name up. So you can replace the made-up name without a domain.
This hides less than a trusted certificate, and a real site's name can do more harm than good: Which certificate should your server use? explains why.
On a managed server, add a certificate with that name. On a standalone server, make one yourself.
Settings for a censored network
On a network that blocks VPN servers, these settings make every connection to your server look more like a visit to a website, for all of its users at once, whatever their apps are set to:
- Cloak Mode for everyone.
AllowTcpPacketset tofalsemakes every app carry its traffic as Cloak Mode does. The apps turn Cloak Mode on by themselves and show that the server enforces it. - No UDP and no QUIC to the server.
UdpEndPointsandQuicEndPointsset to[]leave the apps' connections to the server on TCP alone, as a website's are. Apps set to UDP or QUIC then connect over TCP. - Your users' QUIC and UDP dropped. This is your users' own traffic, not the apps' connections to the server. With Cloak Mode enforced,
AllowQuicPacketset tofalsedrops the QUIC that your users' apps send, andAllowUdpPacketset tofalseall of their UDP but DNS. The apps drop it on the device, so it never crosses the network. Browsers soon switch to TCP, but voice and video calls and games that need UDP stop working, so weigh what your users need.
Cloak Mode for everyone, no UDP and no QUIC to the server, and your users' QUIC dropped
{
"Session": {
"AllowTcpPacket": false,
"AllowQuicPacket": false
},
"UdpEndPoints": [],
"QuicEndPoints": []
}On a standalone server
Put the settings for a censored network under FileAccessManager in /opt/VpnHoodServer/storage/appsettings.json, then restart the server.
Put the server behind a reverse proxy
If the connection IP is blocked anyway, put the server behind a reverse proxy such as Cloudflare. Apps then connect to the proxy, and the server's own address can stay out of the keys. Whether the proxy itself stays reachable depends on the country and the network.
Put your server behind a reverse proxy shows how, and what to weigh first.