服务端(以Ubuntu为例)

修改apt仓库文件

1
vim /etc/apt/sources.list

添加

1
deb http://shadowvpn.org/debian wheezy main

之后安装软件

1
2
3
apt-get update
apt-get install shadowvpn
apt-get install fail2ban

修改shadowvpn配置文件

1
2
3
4
5
6
vim /etc/shadowvpn/server.conf

password=308c7be12c1689f3
port=2222
mtu=1530
token=308c7be12c1689f3

password和token可用这个命令生成

1
xxd -l 8 -p /dev/random

最佳mtu计算方法 原文地址

我的现象和你的一样,是mtu的问题,默认的mtu值对于你的网络环境来说太高了。测试自己的mtu是多少,然后做减法
for wireless network,I advice you to test your real mtu value. for reference:
MTU of PPPoE #53
Max MTU: How do I find mine?
for windows
ping -f -l 1472 www.baidu.com
for linux
ping -s 1472 www.baidu.com
for example,my mtu is 1452,and the mtu value in client.conf server.conf should be 1452-20-8-24=1400

多层转发可以使用socat来处理

1
socat UDP4-RECVFROM:2222,fork UDP4-SENDTO:1.1.1.1:2222

客户端(以Openwrt为例)

下载地址
https://sourceforge.net/projects/openwrt-dist/files/shadowvpn/
https://github.com/aa65535/openwrt-shadowvpn/releases
依赖包
https://sourceforge.net/projects/openwrt-dist/files/depends-libs/

  • 移除 /etc/hotplug.d/iface/30-shadowvpn
  • 清空 client_up.sh 和 client_down.sh
  • 去掉wan口的Use Default Gateway
  • 建立新的interface命名为tun, ip: 10.7.0.2, gateway: 10.7.0.1
  • 建立新的firewall zone命名为tun zone, 添加interface tun到tun zone, 允许lan=>tun, tun=>wan
  • 建立新的静态路由
    • tun : 0.0.0.0 : 10.7.0.1 : 5 : empty
    • (adsl) wan : server-ip : 0.0.0.0 : empty : 10 : empty
    • (dhcp) wan : server-ip : dhcp-gateway : empty : 10 : empty
  • 修改shadowvpn.conf文件,填写对应的server, port, password, token
  • /etc/init.d/shadowvpn restart
  • ip route 或者 route 查看核对当前路由信息
  • 自启动 (待完成)