Copy the hosts file to your computer so you can access Google and YouTube via IPv6 without DNS failures in China
Run the update_hosts.py script to refresh all domain IP addresses automatically using a DNS server in Hong Kong or Japan
Merge multiple partial hosts snippets into a single file using the included shell script for a custom network configuration
Set up a local hosts override so your IPv6 connection bypasses DNS resolution for popular Western services
Just copy the hosts file to your system, running update_hosts.py requires Python and a reachable public DNS server outside China.
This repository provides a hosts file intended to improve access to Google, YouTube, Facebook, and Wikipedia for people in Mainland China using IPv6 connections. A hosts file is a plain text file that exists on every computer. When your computer looks up the address of a website, it checks this file first before asking a DNS server. If the domain name appears in the hosts file, the computer uses the IP address listed there directly and skips the DNS lookup entirely. This repository contains a curated hosts file that maps popular Western services to their IPv6 addresses, bypassing the DNS resolution step that often fails or returns blocked results in China. The reason IPv6 specifically helps in some network configurations in China is that IPv6 infrastructure has historically received different treatment than IPv4 at the network level, sometimes allowing connections that would otherwise be blocked or slowed. The repository also includes two scripts. One is a Python script called update_hosts.py, which uses multi-threading to look up the current IPv6 addresses for all the domains in the file and update it automatically. Running DNS lookups manually for hundreds of domains would be tedious, so the script automates this. You can specify a custom DNS server, how many parallel threads to use, and whether to include the canonical names. The second is a shell script called merge_snippets.sh that combines separate partial hosts files into one. The README lists several public DNS servers in the US, Hong Kong, and Japan that can be used with the update script, since the default DNS server in China may not return accurate results for these domains. The code is MIT licensed. The hosts file content itself is licensed under Creative Commons BY-NC-SA 3.0, meaning you can share and adapt it for non-commercial purposes with attribution.
← lennylxx on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.