Home About Me

Giving an IPv6-Only VPS a Route to the IPv4 Internet

An IPv6-only VPS is cheap, but the lack of IPv4 access quickly becomes annoying: many sites still do not support IPv6, so tasks such as downloading scripts hosted on GitHub or cloning repositories can fail. There are two common ways to give the machine IPv4 connectivity. They trade off differently, so the right choice depends on what you need.

DNS64 + NAT64

Advantages: works with VPS located in mainland China.
Drawback: you cannot reach IPv4 addresses directly.

When you query a domain name, the DNS server returns an IPv6 address if the destination supports IPv6. If it does not, the server synthesizes an IPv6 address according to DNS64 rules. That synthetic address points to a NAT64 gateway; the gateway maps it back to the original IPv4 destination, retrieves the data, and forwards it to you. This is how an IPv6-only machine can reach IPv4-only websites.

Google Public DNS supports DNS64, but it does not provide a matching NAT64 gateway, so you would have to run your own. Cloudflare DNS64 is the simpler option because it comes with NAT64.

Usage is simple: edit /etc/resolv.conf, delete or comment out the existing contents, then add the following lines and save the file.

nameserver 2606:4700:4700::64
nameserver 2606:4700:4700::6400

Other public DNS64 services include:

  • TREX (Finland)
2001:67c:2b0::4
2001:67c:2b0::6
  • Go6Lab
2001:67c:27e4:15::6411
2001:67c:27e4::64

Cloudflare WARP

Advantages: native IPv4, streaming service unlocking, and it can help avoid Google CAPTCHAs.
Drawbacks: not supported on VPS in mainland China, and response times can sometimes be slow.

WARP is Cloudflare's WireGuard-based service for securing and accelerating network traffic. By connecting to a Cloudflare edge node, it provides privacy protection and route optimization.

Manual WARP configuration is complicated and easy to get wrong, especially for beginners. One-click scripts make the process much simpler. Because GitHub does not support pure IPv6 networking, the scripts may fail to download; configure DNS64 as described above first.

fscarmen's WARP script

GitHub: https://github.com/fscarmen/warp

The script supports multiple Linux distributions and CPU architectures. It automatically selects a WireGuard approach based on the Linux version and virtualization type, and it provides a menu that is friendly to ordinary users.

Speedtest result:

fscarmen WARP speed test

The menu is available in both Chinese and English.

fscarmen WARP menu

fscarmen WARP menu options

First, switch to root with sudo -i. Then run the installation command that matches your needs.

Usage

Enable IPv4 support for an IPv6-only VPS

Run:

wget -N https://gitlab.com/fscarmen/warp/-/raw/main/menu.sh && bash menu.sh 4

Then choose the appropriate option based on your situation.

Add dual-stack global networking to the VPS

Start the same menu and select the dual-stack path when prompted. The command is the same entry point:

wget -N https://gitlab.com/fscarmen/warp/-/raw/main/menu.sh && bash menu.sh 4

Once configured, the VPS should have an IPv4 address:

VPS assigned an IPv4 address

After installation, run warp [option] again. Common options are listed below:

<table> <thead> <tr> <th>[option]</th> <th>Action</th> </tr> </thead> <tbody> <tr> <td>h</td> <td>Help</td> </tr> <tr> <td>4</td> <td>Whatever the current state, switch to WARP IPv4</td> </tr> <tr> <td>6</td> <td>Whatever the current state, switch to WARP IPv6</td> </tr> <tr> <td>d</td> <td>Whatever the current state, switch to WARP dual-stack</td> </tr> <tr> <td>o</td> <td>Toggle WARP; the script checks the current state and turns it on or off automatically</td> </tr> <tr> <td>u</td> <td>Uninstall WARP</td> </tr> <tr> <td>v</td> <td>Sync the script to the latest version</td> </tr> <tr> <td>i</td> <td>Change the WARP IP</td> </tr> <tr> <td>s</td> <td>Quickly switch between single-stack and dual-stack, e.g. warp s 4, warp s 6, warp s d</td> </tr> <tr> <td>other or empty</td> <td>Open the menu</td> </tr> </tbody> </table>

To turn WARP networking on or off, run warp o. For help, run warp h.

P3TERX's warp.sh script

GitHub: https://github.com/P3TERX/warp.sh

The script supports x86 and ARM architectures and multiple Linux distributions. It is popular because it is powerful and easy to use.

Speedtest result:

P3TERX WARP speed test

First, switch to root with sudo -i. Then run the installation command that fits your needs.

The one-shot installation script is a true one-command WARP setup.

P3TERX warp.sh one-click install

Usage

If the VPS only has IPv6 and needs IPv4 support, use this one-shot command:
# Automatically configure WARP WireGuard IPv4 network
bash <(curl -fsSL git.io/warp.sh) 4
To add dual-stack global networking, use this one-shot command:
# Automatically configure WARP WireGuard dual-stack global network
bash <(curl -fsSL git.io/warp.sh) d

The script provides a user-friendly menu for managing the WARP network. Run the following command to view the menu and network status:

bash <(curl -fsSL git.io/warp.sh) menu

P3TERX warp.sh menu

P3TERX warp.sh network status

To see the script's subcommands, run:

bash <(curl -fsSL git.io/warp.sh) help

The script does not appear to include an uninstall option, so removing WARP requires manual cleanup.

Cloudflare WARP speed test

Speedtest supports IPv4 and IPv6 and can measure the maximum external network speed available to the VPS through WARP.

  • Install Ookla Speedtest CLI (the installation script was written by P3TERX):
curl -fsSL git.io/speedtest-cli.sh | sudo bash
  • Then run the speedtest command.

Notes

  1. WARP is similar to a VPN. Many people once used it to bypass restrictions, and it is now blocked in mainland China. It can only be used from VPS outside mainland China.
  2. Because many users rely on it, you may fail to obtain a WARP IP. Try again later.
  3. Using WARP can make file downloads take longer to respond and can reduce speed.
  4. The IP obtained through WARP is not a public IP; it is only used for outbound access.