Total Pageviews

Friday 13 September 2019

利用vpn程序udptun.py翻墙

登陆linux vps.
git clone https://github.com/gamehacker/udptun udptun-by-gamehacker
cd udptun-by-gamehacker

[root@host udptun-by-gamehacker]# ls
client.sh  README.md  server.sh  udptun.py
[root@host udptun-by-gamehacker]# python udptun.py -h
Usage: udptun.py [-s port|-c serverip] [-hd] [-l localip]
[root@host udptun-by-gamehacker]# python udptun.py -s 2234 -l 192.168.128.1
不过此命令python udptun.py -s 2234 -l 192.168.128.1是运行在前台的,容易退出,我们可以利用systemd来把它运行为service:
nano /etc/systemd/system/udptun.service
其内容为:
[Unit]
After=network.target

[Service]
ExecStart=/usr/bin/python /root/udptun-by-gamehacker/udptun.py -s 2234 -l 192.168.128.1
Restart=always

[Install]
WantedBy=multi-user.target 


然后运行,
systemctl start udptun
systemctl enable udptun

服务器端搭建完成。

在客户机器mac上。
git clone https://github.com/gamehacker/udptun udptun-by-gamehacker
cd udptun-by-gamehacker
sudo python udptun.py -c vps-public-ip,2234 -l 192.168.128.2 -p 192.168.128.1
(注意:这一段“-p 192.168.128.1”一定要加上。)
等到输出里显示:Logged in server succefully! ,就表明连上了服务器。
 保持此窗口不要关闭。

sudo route add default 192.168.1.1 && sudo route delete default && sudo route add default 192.168.128.1 && sudo route add vps-public-ip 192.168.1.1

sudo networksetup -setdnsservers "Wi-Fi" 127.0.0.1


cd ~/goproxy-by-snail007 && sudo ./proxy dns -S socks -T tcp -P 127.0.0.1:1080 -p :53  

(此dns proxy需先运行ss客户端,用法见:又一款可以套上一层socks proxy的dns代理程序:dns-proxy-by-snail007-goproxy )

项目地址:https://github.com/gamehacker/udptun
此项目其实fork自https://github.com/78/udptun,但是这个项目的作者已删除这个项目,唉,又一个自我阉割的examp.

注意:此程序跟hans(https://briteming.blogspot.com/2016/10/ip-over-icmp-proxy.html)一样不够坚挺,估计是没加密的缘故。建议使用gtun(https://briteming.blogspot.com/2019/09/vpn-gtun.html),gtun还比较坚挺。

相关帖子;https://briteming.blogspot.com/2015/09/udpip-udpipvpn.html
https://briteming.blogspot.com/2012/03/udpip-udpipvpn.html


No comments:

Post a Comment