NewCode CLOUD — 20% off your first month on all cloud VPSClaim

ong Kong VPS Network Troubleshooting: Diagnose CN2 GIA and Latency Issues (2026)

· 7 min read

Network issues on a Hong Kong VPS manifest in two distinct ways: problems originating on the VPS itself (misconfigured firewall, service not listening, MTU mismatch) and problems in the network path between the VPS and your users (routing degradation, CN2 GIA congestion, DNS misconfiguration). This guide provides systematic tools and methodology to diagnose both.


Step 1: Establish a Baseline — What Should Normal Look Like?

Before diagnosing issues, know what healthy looks like:

<code"># Verify CN2 GIA routing is active (look for 59.43.x.x hops = AS4809 backbone)
traceroute -n 202.97.0.1  # China Telecom endpoint

# Healthy CN2 GIA trace shows:
# 1  YOUR_VPS_GATEWAY          ~1ms
# 2  HK CN2 entry point        ~2ms
# 3  59.43.x.x  (AS4809)      ~5ms   ← Premium backbone confirmed
# 4  59.43.x.x  (AS4809)      ~18ms
# 5  China Telecom backbone    ~28ms
# Final target                 ~35ms

# If you see 202.96.x.x or 61.x.x.x instead of 59.43.x.x:
# You are NOT on CN2 GIA — contact Server.HK support
<code"># Baseline latency measurements — run during off-peak and peak hours
# Save these as your reference numbers

# To mainland China (multiple cities):
for IP in 202.97.0.1 61.135.169.121 180.76.76.76; do
  echo "Target: $IP"
  ping -c 10 -q $IP | tail -2
  echo "---"
done

# To Google (international baseline):
ping -c 10 -q 8.8.8.8 | tail -2

Step 2: Diagnose Packet Loss

<code"># mtr — real-time traceroute with packet loss per hop
apt install -y mtr-tiny

# Test to mainland China
mtr --report --report-cycles=100 202.97.0.1

# Output:
# HOST                       Loss%   Snt   Last   Avg  Best  Wrst StDev
# 1. YOUR_GATEWAY             0.0%   100    0.4   0.4   0.3   0.8   0.1
# 2. 59.43.x.x (CN2 GIA)     0.0%   100    3.2   3.1   2.8   4.1   0.2
# 3. 59.43.x.x               0.0%   100   18.4  18.3  17.9  19.2   0.3
# 4. 202.97.0.1               0.0%   100   32.1  31.9  31.2  33.0   0.4

# Interpret Loss%:
# 0% at every hop: Perfect — no issues
# Loss at final hop only: Usually ICMP rate limiting (not real loss)
# Loss at a middle hop propagating to all subsequent hops: Real issue at that router
# Loss starting at your gateway: Local network/VPS issue
<code"># Test UDP packet loss (more representative for some protocols)
apt install -y iperf3

# Find a public iperf3 server in mainland China
iperf3 -c iperf.he.net -u -b 10M -t 30 -R  # UDP reverse test
# Compare "Lost/Total" datagrams to determine UDP packet loss percentage

Step 3: Diagnose Local Service Issues

<code"># Verify your service is actually listening
ss -tlnp | grep LISTEN

# Expected output for web server:
# LISTEN  0  511  0.0.0.0:80   0.0.0.0:*  users:(("nginx",pid=...))
# LISTEN  0  511  0.0.0.0:443  0.0.0.0:*  users:(("nginx",pid=...))

# If your service isn't there, check if it's running:
systemctl status nginx
journalctl -u nginx --since "1 hour ago"
<code"># Test port reachability from inside the VPS
curl -sI http://127.0.0.1:80
curl -sI https://127.0.0.1:443 --insecure

# Test from outside (from your local machine):
curl -sI https://YOUR_VPS_IP
telnet YOUR_VPS_IP 443  # Should connect immediately
<code"># Check firewall rules — is port blocked?
ufw status verbose
iptables -L INPUT -n | grep -E "ACCEPT|DROP" | head -20

# Quick test: temporarily allow all and see if connection works
# ufw disable  ← ONLY for diagnostic purposes, re-enable immediately
# If connection works after disabling: firewall rule is too restrictive

Step 4: DNS Troubleshooting

<code"># Check DNS resolution from VPS
dig yourdomain.com A +short        # IPv4 record
dig yourdomain.com AAAA +short     # IPv6 record
dig yourdomain.com MX +short       # Mail records
dig yourdomain.com TXT +short      # SPF/DKIM records

# Check from different DNS servers (rule out resolver-specific issues)
dig @1.1.1.1 yourdomain.com A +short   # Cloudflare
dig @8.8.8.8 yourdomain.com A +short   # Google
dig @114.114.114.114 yourdomain.com A +short  # Chinese DNS

# Check DNS propagation globally
# Use: dnschecker.org or whatsmydns.net (online tools)

# If Chinese DNS returns different results: split-horizon DNS issue
# If one resolver returns wrong result: resolver cache issue (wait for TTL expiry)
<code"># Check your VPS DNS resolver
cat /etc/resolv.conf
# Should show nameserver entries

# Test resolver speed
time dig @127.0.0.53 google.com A  # Local systemd-resolved
time dig @1.1.1.1 google.com A     # Cloudflare (baseline)

Step 5: SSL/TLS Troubleshooting

<code"># Check certificate validity and expiry
echo | openssl s_client -connect yourdomain.com:443 -servername yourdomain.com 2>/dev/null \
  | openssl x509 -noout -dates -subject

# Test TLS handshake timing
curl -w "TLS handshake: %{time_appconnect}s\nTotal: %{time_total}s\n" \
  -o /dev/null -s https://yourdomain.com

# Check which TLS versions are supported
nmap --script ssl-enum-ciphers -p 443 yourdomain.com 2>/dev/null \
  | grep -E "TLSv|Grade"

# Test certificate chain (intermediate certs)
openssl s_client -connect yourdomain.com:443 -showcerts 2>/dev/null \
  | grep -E "issuer|subject" | head -10
<code"># Let's Encrypt renewal issues — common causes
# 1. Port 80 blocked by UFW
ufw allow 80/tcp  # Certbot needs port 80 for HTTP challenge

# 2. Nginx is serving a different site on the domain
nginx -T | grep server_name | grep yourdomain.com

# 3. Certificate already expired
certbot certificates

# 4. Force renewal
certbot renew --force-renewal -d yourdomain.com --nginx

Step 6: Nginx Performance Troubleshooting

<code"># Check Nginx error log for actionable errors
tail -100 /var/log/nginx/error.log | grep -E "crit|emerg|alert|error"

# Common errors and fixes:
# "connect() failed (111: Connection refused)" → backend not running on expected port
# "no live upstreams while connecting to upstream" → all backend servers down
# "upstream timed out (110)" → backend too slow, increase proxy_read_timeout
# "too many open files" → increase worker_rlimit_nofile in nginx.conf

# Check Nginx connection statistics
curl http://127.0.0.1:8080/stub_status  # If configured (see monitoring guide)

# Real-time request rate
tail -f /var/log/nginx/access.log | pv -l -i 5 > /dev/null  # Requires pv
<code"># PHP-FPM issues (if running WordPress/PHP)
# Check PHP-FPM error log
tail -50 /var/log/php8.3-fpm.log

# Check if PHP-FPM is overloaded
# High pm.max_children can exhaust memory; too low causes queuing
ps aux | grep php-fpm | wc -l  # Active workers

# Check PHP-FPM pool status
curl http://127.0.0.1/fpm-status?full  # Requires pm.status_path in pool config

Step 7: Database Connection Issues

<code"># PostgreSQL — check connections
sudo -u postgres psql -c "SELECT count(*), state FROM pg_stat_activity GROUP BY state;"
# If max_connections hit: connections pile up in 'idle' state

# Check connection pool utilisation
sudo -u postgres psql -c "SHOW max_connections;"
sudo -u postgres psql -c "SELECT count(*) FROM pg_stat_activity;"

# PgBouncer pool status (if using PgBouncer)
psql -h 127.0.0.1 -p 6432 -U pgbouncer pgbouncer -c "SHOW POOLS;"

# MySQL connection check
mysql -e "SHOW STATUS LIKE 'Threads_connected';"
mysql -e "SHOW STATUS LIKE 'Max_used_connections';"
<code"># Test database connectivity from application server
# Node.js:
node -e "
const {Pool} = require('pg');
const pool = new Pool({connectionString: process.env.DATABASE_URL});
pool.query('SELECT 1').then(() => console.log('DB OK')).catch(console.error);
"

Step 8: Memory and Swap Pressure

<code"># Identify memory consumers
ps aux --sort=-%mem | head -15

# Check for OOM killer events (process killed due to memory exhaustion)
dmesg | grep -i "oom\|out of memory" | tail -10
journalctl -k | grep -i "oom" | tail -10

# Memory breakdown
free -h
cat /proc/meminfo | grep -E "MemTotal|MemFree|MemAvailable|Cached|Buffers|SwapTotal|SwapFree"

# If swap is heavily used:
swapon --summary
# Consider: increase RAM plan, or reduce PHP-FPM workers / MySQL buffer pool

Step 9: Testing from Mainland China Vantage Points

<code"># Tools for testing your HK VPS from within mainland China (run from browser):
# 1. https://www.17ce.com — test from 30+ Chinese ISP nodes
#    Enter your domain → Results show:
#    - First byte time (TTFB) per city
#    - Download speed per city
#    - Success rate per city (0% = your site is inaccessible from that location)

# 2. https://ping.pe — ICMP ping from global nodes including mainland China
#    Shows if CN2 GIA routing is delivering expected <50ms latency

# 3. https://tools.ipip.net/ping.php — Chinese ISP-specific ping tests
#    Tests from China Mobile, China Telecom, China Unicom separately

# If 17ce.com shows high failure rate from China:
# - Check if you have any Google/YouTube/blocked content embeds
# - Verify Nginx is not returning 500 errors for Chinese user agents
# - Test with Chinese IP using proxy to reproduce the issue

Network Diagnostic Cheatsheet

<code"># ONE-LINER DIAGNOSTIC: run this when something is wrong
echo "=== Network Diagnostics ===" && \
echo "--- Listening ports ---" && ss -tlnp | grep LISTEN && \
echo "--- UFW status ---" && ufw status | head -20 && \
echo "--- CN2 GIA check ---" && \
  traceroute -n -m 10 202.97.0.1 2>/dev/null | head -8 && \
echo "--- Nginx status ---" && systemctl status nginx --no-pager | head -10 && \
echo "--- Disk free ---" && df -h / && \
echo "--- Memory ---" && free -h && \
echo "--- Load ---" && uptime

Conclusion

Systematic network troubleshooting on a Hong Kong VPS follows a clear hierarchy: verify the CN2 GIA routing path with traceroute, confirm services are listening with ss, check the firewall with ufw status, validate DNS from multiple resolvers including Chinese DNS servers, and use 17ce.com for real China-origin testing. Most issues fall into one of five categories — firewall blocking, service not running, DNS misconfiguration, SSL certificate problems, or routing degradation — each with a specific diagnostic command that confirms or rules it out.

Optimise your network: Browse Server.HK Hong Kong VPS plans — all plans include CN2 GIA routing with dedicated AS4809 peering; contact support if traceroute shows unexpected routing paths.

Related articles

More in VPS & ServersServer setup guides