explaingit

lennylxx/ipv6-hosts

4,488PythonAudience · generalComplexity · 1/5LicenseSetup · easy

TLDR

A curated hosts file mapping Google, YouTube, Facebook, and Wikipedia to their IPv6 addresses so users in Mainland China can access these services, with a Python script to auto-update the IP addresses.

Mindmap

mindmap
  root((ipv6-hosts))
    What it does
      Hosts file for China
      IPv6 address mappings
      Bypass DNS failures
    Sites Covered
      Google and YouTube
      Facebook
      Wikipedia
    Tools Included
      update_hosts.py script
      merge_snippets.sh
      Custom DNS support
    How it works
      Hosts file checked first
      Skips blocked DNS
      IPv6 different treatment
    License
      MIT for code
      CC BY-NC-SA for data
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Copy the hosts file to your computer so you can access Google and YouTube via IPv6 without DNS failures in China

USE CASE 2

Run the update_hosts.py script to refresh all domain IP addresses automatically using a DNS server in Hong Kong or Japan

USE CASE 3

Merge multiple partial hosts snippets into a single file using the included shell script for a custom network configuration

USE CASE 4

Set up a local hosts override so your IPv6 connection bypasses DNS resolution for popular Western services

Tech stack

PythonDNSIPv6Shell

Getting it running

Difficulty · easy Time to first run · 5min

Just copy the hosts file to your system, running update_hosts.py requires Python and a reachable public DNS server outside China.

Code is MIT licensed, use freely for any purpose. The hosts file content is Creative Commons BY-NC-SA 3.0, share and adapt with attribution, for non-commercial use only.

In plain English

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.

Copy-paste prompts

Prompt 1
How do I apply the ipv6-hosts hosts file on Windows 11 to enable access to Google and YouTube over IPv6?
Prompt 2
Show me how to run the update_hosts.py script from lennylxx/ipv6-hosts with a custom DNS server at 2001:4860:4860::8888 using 20 parallel threads.
Prompt 3
How do I use merge_snippets.sh from the ipv6-hosts repo to combine multiple partial hosts files into one master file?
Prompt 4
Explain how a hosts file bypass works and why IPv6 addresses in this repo can help reach sites that are blocked at the IPv4 DNS level.
Prompt 5
Write a cron job that runs update_hosts.py weekly to keep the IPv6 address mappings current.
Open on GitHub → Explain another repo

← lennylxx on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.