DEV Community

Guo
Guo

Posted on

I Built a One-Command Speed Test for All 13 BandwagonHost Data Centers

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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)
Enter fullscreen mode Exit fullscreen mode

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" ...)
Enter fullscreen mode Exit fullscreen mode

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}'
Enter fullscreen mode Exit fullscreen mode

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

  1. Choosing a datacenter for a new VPS — run the script from a machine on the same network as your users
  2. Verifying migration options — before migrating between BandwagonHost DCs, check if the new one is actually faster
  3. 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
Enter fullscreen mode Exit fullscreen mode

"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
Enter fullscreen mode Exit fullscreen mode

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)