If you've ever used BandwagonHost (æŹçŠć·„), you know the paradox of choice: 13 data centers spread across Los Angeles, Hong Kong, Tokyo, Osaka, Dubai, and the US East Coast. Which one is actually fastest from your network?
I got tired of manually pinging test IPs one by one, so I wrote a bash script that tests all 13 in about 30 seconds. Here's the tool and what I learned building it.
The One-Liner
curl -fsSL https://raw.githubusercontent.com/devguoo/bwg-speed-test/main/test.sh | bash
That's it. No package to install, no Python, no Node. It runs on any Linux server, macOS, or WSL â anywhere you have bash and ping.
Want more detail? Add -v for verbose mode:
curl -fsSL https://raw.githubusercontent.com/devguoo/bwg-speed-test/main/test.sh | bash -s -- -v
What the Output Looks Like
The script pings each datacenter (4 ICMP packets each), then sorts and color-codes the results:
đ Results (sorted by latency, lowest first)
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Datacenter Location Latency Status
ââââââââââââââââââââââââââ ââââââââââââââââ ââââââââ ââââââââââââââ
Hong Kong CN2 GIA Hong Kong 42.5 ms đ Fastest!
Dubai Dubai, UAE 65.3 ms â Great
Japan Osaka Softbank Osaka, Japan 102.8 ms â Good
DC6 CN2 GIA-E Los Angeles 148.2 ms â Good
DC3 CN2 Los Angeles 152.3 ms â Good
DC9 CN2 GIA Los Angeles 155.1 ms â Good
DC2 QNET Los Angeles 158.7 ms â Good
DC8 ZNET Los Angeles 162.4 ms â Good
DC4 MCOM Los Angeles 165.9 ms â Good
Fremont Fremont, CA 172.3 ms â Good
New Jersey New Jersey 238.5 ms â Fair
New York New York 245.1 ms â Fair
Japan Tokyo CN2 GIA Tokyo, Japan â â Skipped (IPv6)
Green for fast, yellow for okay, red for slow. The fastest datacenter gets a đ. If your machine doesn't have IPv6, those targets are auto-skipped instead of timing out.
How It Works Under the Hood
The script is ~150 lines of pure bash. Here's the basic flow:
1. Define all test targets
Each datacenter has a known test IP published by BandwagonHost. The script stores them in arrays:
names=("DC2 QNET" "DC3 CN2" "DC6 CN2 GIA-E" "Hong Kong CN2 GIA" ...)
ips=("104.194.76.1" "23.252.96.1" "162.244.241.103" "93.179.124.161" ...)
2. Ping each one
Four ICMP packets per datacenter, with a 2-second timeout. The script parses the average RTT from ping output â and yes, it handles both the Linux and macOS ping output formats:
ping -c 4 -W 2 "$ip" 2>/dev/null | tail -1 | awk -F'/' '{print $5}'
3. Sort and colorize
Results get sorted numerically by latency, then each line is color-coded based on thresholds:
- Green (< 100ms): Great
- Yellow (100â200ms): Good
- Red (> 200ms): Fair/Slow
4. IPv6 detection
Before pinging an IPv6 address, the script checks if the system actually has IPv6 connectivity. No connectivity? It skips gracefully instead of hanging for 8 seconds.
Some Patterns I've Noticed
After running this from various locations, a few things stand out:
- From mainland China, Hong Kong CN2 GIA consistently wins â usually 30â50ms. The CN2 GIA-E (DC6) in LA is the next best at ~150ms, significantly faster than regular LA datacenters.
- From US-based servers, the LA datacenters cluster around 1â10ms (obviously), while Hong Kong and Dubai jump to 150â200ms.
- CN2 vs non-CN2 matters â even within Los Angeles, DC6 (CN2 GIA-E) and DC9 (CN2 GIA) route differently than DC2 (QNET) or DC4 (MCOM). The difference can be 20â30ms from Asia.
- Tokyo CN2 GIA is IPv6-only, so it's invisible from many machines. If you need Japan, Osaka Softbank is the IPv4 alternative.
- Dubai is surprisingly solid from both Asia and Europe â worth considering if you serve a global audience.
When This Is Actually Useful
- Choosing a datacenter for a new VPS â run the script from a machine on the same network as your users
- Verifying migration options â before migrating between BandwagonHost DCs, check if the new one is actually faster
- Periodic checks â network routing changes. What was fastest 6 months ago might not be fastest today. Throw it in a cron job:
# Weekly speed check, log results
0 3 * * 1 curl -fsSL https://raw.githubusercontent.com/devguoo/bwg-speed-test/main/test.sh | bash > ~/bwg-results-$(date +%F).log 2>&1
"Is curl | bash Safe?"
Fair question. The script is fully open source â it only uses ping and standard shell utilities. No network calls except ICMP. No data collection. No telemetry.
If you prefer to inspect first:
git clone https://github.com/devguoo/bwg-speed-test.git
cd bwg-speed-test
cat test.sh # read it
./test.sh # then run it
Try It Out
The repo is at github.com/devguoo/bwg-speed-test. It's MIT licensed â use it, fork it, improve it.
If you find it useful, a â on the repo helps others discover it. And if you have ideas â more providers, download speed tests, a web UI â issues and PRs are welcome.
What datacenter came out fastest for you? Drop your results in the comments â I'm curious how routing differs across regions.
Top comments (0)