Users in China sometimes report that their ISPs block or throttle persistent UDP connections. However, these restrictions often only apply to the specific port being used. Port hopping can be used as a workaround for this situation.
The Hysteria client supports a special multi-port address format:
- Multiple individual ports.
- A range of ports.
- A combination of both.
There is no limit to the number of ports you can specify.
The client will randomly select one of the specified ports for the initial connection and will periodically switch to a different port. The option for controlling the interval is
hopInterval in the
- 30s is the default. It must be at least 5s.
Assuming the server is reachable on all the ports you specified, the hopping process is transparent to the upper layers and should not cause any data loss/disconnection.
The Hysteria server does not have built-in support for listening on multiple ports, so you cannot use the above format as a listening address on the server side. We recommend using iptables or nftables DNAT to forward the ports to the server's listening port.
In this example, the server listens on port 443, but the client can connect to any port in the range 20000-50000.