Skip to content

Instantly share code, notes, and snippets.

@huadaonan
Forked from zpoint/v2ray_openvpn_netflix.md
Last active March 14, 2020 02:40
Show Gist options
  • Save huadaonan/01c6a2eaa04b418fc5bd5f7f444177d7 to your computer and use it in GitHub Desktop.
Save huadaonan/01c6a2eaa04b418fc5bd5f7f444177d7 to your computer and use it in GitHub Desktop.
v2ray + openvpn to unblock gfw and netflix

Two things need to be paid

  • vps(such as bandwagonhost)
    • If you are using China Telecom, a CN2 network is required, or you may get stuck when streaming a video
  • vpn vendor to unblock netflix(a openvpn connection that can unblock netflix)

vpn

The basic idea is setup a socks5 proxy to forawrd all network traffic from the socks5 to a specific openvpn, in v2ray, forward all the netflix traffic to the socks5 proxy

detail

Why not connect to the openvpn directly ?

The openvpn connection is highly unstable or slow due to GFW

Why not connect to VPS directly ?

You can easily get a fast VPS(CN2) from various provider, but most of them can't combined the fast and stable connection from China && unblock from the netflix

So, I decide to do it myself

Steps

  1. install v2ray

    bash <(curl -s -L https://git.io/v2ray.sh)
    
  2. config openvpn connection inside a docker container

In most case the following command can't set up properly, please read the Notice part to change the configuration if there's something wrong

    git clone https://github.com/zpoint/openvpn_socks5_docker.git
    ./build.sh
    ./start.sh
    launch *.ovpn
  1. exit the docker container, change your v2ray configure file to forward the netflix traffic the the openvpn connection inside the container, this is part of my configure file located in /etc/v2ray/config.json

{
  "inbounds": [
    {
      "port": 2333,
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "uuid",
            "alterId": 64
          }
        ]
      },
      "streamSettings": {
        "network": "ws",
        "wsSettings": {
        "path": "/one"
        }
      },
       "sniffing": {
         "enabled": true,
         "destOverride": [
    		"http",
   		 "tls"
         ]
     }
    }
  ],


"outbounds": [
        {
	"protocol": "freedom",
	"settings": {}
 },
 {
  "protocol": "socks",
  "settings": {
     "servers": [{
         "port": 1080,
	     "address": "172.18.0.2"
	        }]
  },
  "streamSettings": {
   "tcpSettings": {
    "header": {
     "type": "none"
    }
   },
   "network": "tcp",
   "security": "none"
  },
  "tag": "streaming"
 }
],
"routing": {
 "domainStrategy": "IPOnDemand",
 "rules": [
     {
   "type": "field",
   "domain": [
    "domain:btstatic.com",
    "domain:netflix.com",
    "domain:netflix.net",
    "domain:nflxext.com",
    "domain:nflximg.com",
    "domain:nflximg.net",
    "domain:nflxsearch.net",
    "domain:nflxso.net",
    "domain:nflxvideo.net",
    "domain:ipaddress.com"
   ],
   "outboundTag": "streaming"
  }
 ]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment