Privacy Tools Guide

Using a VPN to bypass censorship or protect your privacy only works if you can verify the VPN is actually doing its job. Many users assume their VPN is working correctly, only to discover later that IP leaks, DNS leaks, or WebRTC leaks have been exposing their real location the entire time. This guide covers practical verification methods for developers and power users who need confirmed censorship bypass and genuine location masking.

Why VPNs Sometimes Fail to Mask Your Location

A VPN creates an encrypted tunnel between your device and a remote server, routing your traffic through that server’s IP address. However, several failure points can expose your real location:

Basic Verification: Checking Your Public IP

The first step is confirming your visible IP address differs from your actual one. Before connecting to your VPN, note your public IP:

curl -s ifconfig.me
curl -s ipinfo.io/ip

After connecting to your VPN, run the same command. If the IP changes to match your VPN server’s location, basic IP masking is working. However, this only confirms surface-level functionality—deeper leaks can still expose you.

Testing for DNS Leaks

DNS leaks represent a serious privacy risk because they reveal your ISP and can indicate your general geographic location. The concept works like this: even if your traffic routes through a VPN server, your device might still send DNS queries to your ISP’s DNS servers, creating a detectable pattern.

To test for DNS leaks, use a specialized tool:

# Using dnsleaktest (requires installation or web interface)
# Install the tool
brew install dnsleaktest  # macOS

# Run the test
dnsleaktest

Alternatively, visit dnsleaktest.com in your browser while connected to the VPN. The results should show DNS servers matching your VPN’s location, not your ISP’s servers.

For a more manual approach, check which DNS servers your system is using:

# Linux
resolvectl status

# macOS
scutil --dns | grep nameserver

If these show your ISP’s DNS servers while the VPN is connected, you have a DNS leak. Most quality VPN applications include built-in DNS leak protection—ensure it’s enabled in your VPN settings.

Detecting WebRTC Leaks

WebRTC (Web Real-Time Communication) enables direct browser-to-browser communication but can inadvertently expose your real IP address. This happens because browsers may use STUN (Session Traversal Utilities for NAT) requests to establish peer-to-peer connections, and these requests can return your actual IP.

To test for WebRTC leaks:

  1. Visit browserleaks.com/webrtc while connected to your VPN
  2. Look for any IP addresses that don’t match your VPN server
  3. Multiple IP addresses appearing (your real IP alongside your VPN IP) indicates a leak

If you discover a WebRTC leak, disable WebRTC in your browser:

Firefox:

// In about:config, set these values
media.peerconnection.enabled = false

Chrome/Chromium:

Testing IPv6 Leaks

IPv6 adoption continues growing, and many VPNs only handle IPv4 traffic. This creates a potential leak where your IPv6 address (which directly identifies your connection) could be exposed.

To test:

# Check if you have an IPv6 address
ip -6 addr show

# Test IPv6 connectivity
curl -s https://ipv6.icanhazip.com

If you see an IPv6 address when connected to a VPN that only supports IPv4, your real IPv6 address may be visible. Quality VPN services now support IPv6 or block it entirely to prevent leaks.

Verifying Censorship Bypass

For users in countries with strict internet censorship, confirming actual censorship bypass requires testing against blocked services. This goes beyond IP masking—you need to verify you can actually access previously blocked content.

Effective tests include:

  1. Attempt to access blocked domains: Try loading websites known to be blocked in your region
  2. Check for censorship indicators: Some countries inject reset packets or redirect DNS to block pages
  3. Verify consistent access: Confirm you can repeatedly access blocked content without intermittent failures
# Test access to a blocked domain (replace with known blocked site)
curl -v https://example-blocked-site.com

# Check for DNS-based blocks
nslookup example-blocked-site.com

If DNS queries return NXDOMAIN (non-existent domain) or IPs that point to block pages, your VPN isn’t effectively bypassing censorship at the DNS level.

Advanced: Manual Traffic Analysis

For the most thorough verification, analyze your network traffic directly:

# Linux: Monitor all network connections while VPN is active
sudo tcpdump -i any -n | grep -v "VPN_INTERFACE"

# Check routing table to ensure VPN is default route
ip route show

# Verify all traffic goes through VPN tunnel
traceroute 8.8.8.8

The traceroute output should show the first hop as your VPN server, not your local network or ISP gateway.

Building a Verification Script

You can automate these checks into a single script:

#!/bin/bash

echo "=== VPN Leak Verification ==="

# Check public IP
echo "Public IP: $(curl -s https://api.ipify.org)"

# Check for DNS leaks (basic check)
echo "DNS servers in use:"
scutil --dns | grep nameserver | head -3

# Check for WebRTC leaks
echo "WebRTC test: Visit browserleaks.com/webrtc"

# Test against known blocked site
echo "Testing blocked site access:"
curl -s -o /dev/null -w "%{http_code}" https://example-blocked-site.com

echo "=== Verification Complete ==="

Run this script with your VPN connected and disconnected to establish a baseline.

What to Do If Leaks Are Detected

If you discover leaks, several fixes are available:

  1. Enable kill switch: Most VPN apps include a network kill switch that blocks all traffic if the VPN disconnects unexpectedly
  2. Enable DNS leak protection: This forces all DNS queries through the VPN tunnel
  3. Disable IPv6: Either at the OS level or in your VPN settings
  4. Use a different VPN protocol: Some protocols handle leaks better than others (WireGuard typically performs well)
  5. Consider custom DNS: Configure your system to use privacy-focused DNS servers (like Cloudflare 1.1.1.1 or Quad9) that support DNS-over-HTTPS

Comprehensive Leak Testing Script

Automate all verification tests into a single comprehensive script:

#!/bin/bash
# Complete VPN verification suite

echo "=== VPN LEAK VERIFICATION SUITE ==="
echo "Start time: $(date)"
echo ""

# Test 1: IP Address Verification
echo "[TEST 1] IP Address Detection"
REAL_IP=$(curl -s https://api.ipify.org)
echo "Real IP: $REAL_IP"

VPN_IP=$(curl -s --socks5 127.0.0.1:9050 https://api.ipify.org 2>/dev/null || echo "SOCKS failed")
echo "VPN IP: $VPN_IP"

if [ "$REAL_IP" != "$VPN_IP" ]; then
    echo "[PASS] IP addresses differ"
else
    echo "[FAIL] IP addresses match - possible leak"
fi

# Test 2: DNS Leak Detection
echo ""
echo "[TEST 2] DNS Leak Detection"
echo "Resolving google.com..."
nslookup google.com | grep "^Server:"

# Test 3: WebRTC Leak Detection
echo ""
echo "[TEST 3] WebRTC Leak Detection (requires browser)"
echo "Visit https://browserleaks.com/webrtc in your VPN browser"
echo "Check for IP addresses outside VPN range"

# Test 4: IPv6 Leak Detection
echo ""
echo "[TEST 4] IPv6 Leak Detection"
IPV6=$(curl -s https://ipv6.icanhazip.com 2>/dev/null || echo "No IPv6")
echo "IPv6 Address: $IPV6"

# Test 5: Routing Path Verification
echo ""
echo "[TEST 5] Traceroute Analysis"
echo "Tracing route to 8.8.8.8..."
traceroute -m 5 8.8.8.8 | head -10

# Test 6: Port Leak Detection
echo ""
echo "[TEST 6] Port Scan for Leaks"
netstat -tuln | grep ESTABLISHED | wc -l
echo "Established connections (should all be to VPN server)"

echo ""
echo "=== VERIFICATION COMPLETE ==="

Geographic Bypass Verification

For censorship bypass validation, test whether you can access services blocked in your region:

#!/bin/bash
# Test access to commonly blocked services

BLOCKED_SITES=(
    "https://news.ycombinator.com"      # Blocked in some countries
    "https://www.reddit.com"            # Blocked in some regions
    "https://www.bbc.com"               # Blocked in some countries
    "https://www.wikipedia.org"         # Blocked in some regions
)

for site in "${BLOCKED_SITES[@]}"; do
    echo "Testing access to $site..."

    # Test without VPN
    response=$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 5 "$site")
    echo "  Direct: HTTP $response"

    # Test with VPN (requires VPN setup)
    vpn_response=$(curl -s -o /dev/null -w "%{http_code}" --socks5 127.0.0.1:9050 "$site")
    echo "  Via VPN: HTTP $vpn_response"

    if [ "$response" != "200" ] && [ "$vpn_response" = "200" ]; then
        echo "  [PASS] Bypass successful"
    else
        echo "  [CHECK] Verify manually"
    fi

    echo ""
done

Advanced: Traffic Flow Verification with tcpdump

For technical users, analyze actual packet flow to confirm encryption:

# Start packet capture on VPN interface
sudo tcpdump -i tun0 -w vpn_traffic.pcap -c 1000 "tcp or udp"

# Stop capture with Ctrl+C, then analyze
file vpn_traffic.pcap
strings vpn_traffic.pcap | head -20

# Look for plaintext data (encrypted traffic shows random bytes)
# If you see recognizable text, encryption may have failed

All encrypted VPN traffic should appear as random bytes when captured. If you see recognizable strings like HTTP headers or domain names, the traffic is not properly encrypted.

Censorship Detection: Identifying Block Methods

Different censorship methods require different verification approaches:

Block Method Detection Technique VPN Effectiveness
IP Blocking Direct access fails, traceroute blocked High
DNS Blocking nslookup fails, alternative DNS needed High
DPI (Deep Packet Inspection) Connections reset after handshake Medium
SNI Blocking TLS handshake fails Medium-High
BGP Hijacking Routes redirected to fake servers Very High

For each method:

# 1. Test IP blocking
curl -v https://BLOCKED_IP

# 2. Test DNS blocking
nslookup blocked.site.com
dig blocked.site.com

# 3. Test DPI detection (watch for connection reset)
timeout 10 curl -v https://blocked-site.com

# 4. Test SNI blocking (try ClientHello analysis)
openssl s_client -connect blocked-site.com:443 -servername blocked-site.com

VPN Provider Evaluation Checklist

When selecting a VPN for censorship bypass, verify:

# 1. Check if VPN supports IPv6 (prevents IPv6 leaks)
curl -6 https://ipv6.icanhazip.com

# 2. Verify DNS-over-HTTPS availability
nslookup -class=CH -type=TXT whoami.ds.akahelp.net

# 3. Test multiple exit nodes
# Switch to different VPN server and repeat IP tests

# 4. Check for metadata leaks
# Monitor firewall logs while connected
sudo ufw status numbered

# 5. Verify kill switch functionality
# Manually kill VPN process and verify network access stops
sudo kill -9 $(pgrep -f openvpn)

Performance Impact Testing

Beyond functionality, verify that bypass VPN maintains usable performance:

#!/bin/bash
# Performance baseline establishment

echo "=== VPN PERFORMANCE TEST ==="

# Baseline: Direct connection
echo "Direct connection speed test:"
time curl -O https://speed.cloudflare.com/__down?bytes=10485760 &>/dev/null
rm -f __down*

# VPN connection
echo "VPN connection speed test:"
# Ensure VPN is active before this
time curl -O https://speed.cloudflare.com/__down?bytes=10485760 &>/dev/null
rm -f __down*

# Latency test
echo "Latency comparison:"
echo "Direct ping to 8.8.8.8:"
ping -c 5 8.8.8.8

echo "VPN exit node ping:"
ping -c 5 $(curl -s https://api.ipify.org)

For censorship bypass to be practical, VPN latency should remain under 200ms and bandwidth loss under 50% of direct connection speed.

Built by theluckystrike — More at zovo.one