| 本帖最後由 kingwilliam 於 2019-1-18 16:40 編輯 
 回復 26# 角色
 
 
 1、这个安装是否有参考链接?
 安裝沒有特別 只是一般的安裝
 官網 : https://www.v2ray.com/chapter_00/install.html
 腳本 : bash <(curl -L -s https://install.direct/go.sh)
 
 2、TLS用什么方法产生Certs?
 用 Let's Encrypt
 我是用 https://www.sslforfree.com/ 生成
 
 3、透明代理,你怎样把WiFi接上去,让后mobile device不安装任何翻墙软件都能科学上网?
 透明代理 重點不在v2ray, v2ray 只需開 Dokodemo
 重點在 iptables {下面的iptabales不是我原創, 我也是上網集百家於大成}
 所以 透明代理 多數都要用 linux做.
 
 全家翻牆 有需要用2隻wifirouter (當然要睇實際環境, 我的情況是 vm-pfsense + AP)
 第1隻是接駁出internet
 第2隻重點在wifi share
 如用wifi router
 wan gw 直指 ubuntu 就可以
 如 ubuntu 是 192.168.198.253
 就設定 wan GW 是 192.168.198.253
 
 因v2ray只能做到 tcp udp, 如果ping 或pptp 這類就不行
 
 上面的 iptables 是v2ray官網和多數人的做法, 其實有另類方法,
 如在第2隻router內有openvpn, 就變成openvpn over v2ray, 就樣不只tcp udp, ping pptp甚麼也可以
 (這方案我也用過 都係有好有懷 最後都沒用 只留在後備 原因是openvpn好容易斷(容易斷是指數分鐘到6小時不等, 有時一天一兩次, 有時好多次) 當然openvpn 斷後數秒後會自動重建 但個人感覺不太好.
 所以在我的inbound會看見socket 和 http, 因方便測試, 就算 openvpn 經 dokodemo 或 openvpn 經 http proxy都試過, 兩樣都ok)
 
 
 v2ray-國內-inbound
 國內 ubuntu iptables複製代碼        "inbounds": [
                // socks:1080
                {
                        "protocol": "socks",
                        "listen": "192.168.198.253",
                        "port": 1080
                },
                
                // socks:1081
                {
                        "protocol": "http",
                        "listen": "192.168.198.253",
                        "port": 1081
                },
                // dokodemo-door:12345
                {
                        "port": 12345,
                        "protocol": "dokodemo-door",
                        "domainOverride": ["tls","http"],
                        "settings": {
                                "network": "tcp,udp",
                                "followRedirect": true
                        }
                },
                // dokodemo-door:53
                {
                        "protocol": "dokodemo-door",
                        "port": 53,
                        "listen": "192.168.198.253",
                        "settings": {
                                "address": "192.168.188.1",
                                "port": 53,
                                "network": "udp",
                                "timeout": 0,
                                "followredirect": false
                        }
                }
        ],
// 192.168.198.253 是國內 ubuntu server ip address
// "192.168.188.1" 是香港 server dns server ip address 當然用 8.8.8.8 也可
複製代碼#!/bin/bash
# get dyndns abc.dyndns.org
hostip2=$(host abc.dyndns.org | cut -d ' ' -f 4)
# TCP
# Create new chain
iptables -t nat -N V2RAY
# Ignore your V2Ray server's addresses
# It's very IMPORTANT, just be careful.
iptables -t nat -A V2RAY -d $hostip2 -j RETURN
# Ignore LANs and any other addresses you'd like to bypass the proxy
# See Wikipedia and RFC5735 for full list of reserved networks.
iptables -t nat -A V2RAY -d 0.0.0.0/8 -j RETURN
iptables -t nat -A V2RAY -d 10.0.0.0/8 -j RETURN
iptables -t nat -A V2RAY -d 127.0.0.0/8 -j RETURN
iptables -t nat -A V2RAY -d 169.254.0.0/16 -j RETURN
iptables -t nat -A V2RAY -d 172.16.0.0/12 -j RETURN
iptables -t nat -A V2RAY -d 192.168.0.0/16 -j RETURN
iptables -t nat -A V2RAY -d 224.0.0.0/4 -j RETURN
iptables -t nat -A V2RAY -d 240.0.0.0/4 -j RETURN
# Anything else should be redirected to Dokodemo-door's local port
iptables -t nat -A V2RAY -p tcp -j REDIRECT --to-ports 12345
# Apply the rules
iptables -t nat -A PREROUTING -p tcp -j V2RAY
#iptables -t nat -A OUTPUT -p tcp -j V2RAY
#UDP
# Create new chain
ip route add local 0.0.0.0/0 dev lo table 100
ip rule add fwmark 1 table 100
iptables -t mangle -N V2RAY_MARK
# Ignore your V2Ray server's addresses
# It's very IMPORTANT, just be careful.
iptables -t mangle -A V2RAY_MARK -d $hostip2 -j RETURN
# Ignore LANs and any other addresses you'd like to bypass the proxy
# See Wikipedia and RFC5735 for full list of reserved networks.
iptables -t mangle -A V2RAY_MARK -d 0.0.0.0/8 -j RETURN
iptables -t mangle -A V2RAY_MARK -d 10.0.0.0/8 -j RETURN
iptables -t mangle -A V2RAY_MARK -d 127.0.0.0/8 -j RETURN
iptables -t mangle -A V2RAY_MARK -d 169.254.0.0/16 -j RETURN
iptables -t mangle -A V2RAY_MARK -d 172.16.0.0/12 -j RETURN
iptables -t mangle -A V2RAY_MARK -d 192.168.0.0/16 -j RETURN
iptables -t mangle -A V2RAY_MARK -d 224.0.0.0/4 -j RETURN
iptables -t mangle -A V2RAY_MARK -d 240.0.0.0/4 -j RETURN
iptables -t mangle -A V2RAY_MARK -p udp --dport 53 -j RETURN
# Anything else should be redirected to Dokodemo-door's local port
iptables -t mangle -A V2RAY_MARK -p udp -j TPROXY --on-port 12345 --tproxy-mark 1
# Add any UDP rules
iptables -t mangle -A PREROUTING -p udp -j V2RAY_MARK
#iptables -t mangle -A OUTPUT -j V2RAY_MARK
 |