感谢回复,您提供的这个地址中的连接我这无法打开。poloshiao 写了:我使用的 AventailConnect 客户端看看 這一篇 及其連結文章 能否幫你# Aventail VPN ConnectionGenerated, to restore copy from /etc/resolv.conf.Sonicwall
http://superuser.com/questions/141834/c ... ux-machine
Connecting to a SonicWall VPN from a Linux machine
随后从同事那得到了一个Aventail其他版本的客户端,可以登录成功但无法使用tun0虚拟网卡完成通讯。
Aventail程序目录
代码: 全选
root@xxx:/usr/local/Aventail# ll
total 3348
drwxr-xr-x 6 root root 4096 8月 16 21:09 ./
drwxr-xr-x 14 root root 4096 2月 21 22:08 ../
-rwsr-xr-x 1 root root 3317824 2月 21 22:08 AvConnect*
lrwxrwxrwx 1 root root 14 8月 15 11:05 certs -> /etc/ssl/certs/
-rw-r--r-- 1 root root 17593 2月 21 22:08 cttel.pl
drwxr-xr-x 2 root root 4096 2月 21 22:08 help/
drwxr-xr-x 2 root root 4096 2月 21 22:08 lib/
-rw-r--r-- 1 root root 11368 2月 21 22:08 logo.png
drwxr-xr-x 2 root root 4096 2月 21 22:08 man/
-rw-r--r-- 1 root root 30365 8月 16 21:02 nmdc
drwxr-xr-x 2 root root 4096 2月 21 22:08 nui/
-rwxr-xr-x 1 root root 1911 2月 21 22:08 startct.sh*
-rwxr-xr-x 1 root root 2063 2月 21 22:08 startctui.sh*
-rwxr-xr-x 1 root root 1239 2月 21 22:08 uninstall.sh*
-rw-r--r-- 1 root root 10 8月 15 11:05 version
后来分析了下Aventail VPN的通讯流程大概如下:
代码: 全选
root@xxx:/home/xxx/Desktop/vpn# netstat -anlp | grep 967
tcp 0 0 10.13.75.151:41596 111.200.23.250:443 ESTABLISHED 967/AvConnect
tcp 0 0 127.0.0.1:34964 127.0.0.1:39980 ESTABLISHED 967/AvConnect
root@xxx:/home/xxx/Desktop/vpn# netstat -anlp | grep 34964
tcp 0 0 127.0.0.1:34964 127.0.0.1:39980 ESTABLISHED 967/AvConnect
tcp6 0 0 127.0.0.1:39980 127.0.0.1:34964 ESTABLISHED 740/java
是VPN客户端,客户端启动Socket server侦听39980端口,Server启动后调起AvConnect 并传出-p39980,
PID : 967
AvConnect进程,连通VPN Server,负责所有与VPN Server的通讯。
AvConnect通过 -p39980连通VPN客户端。AvConnect启动后向VPN Server发送各种指令获取密钥、dns和路由表数据,并传递给VPN客户端39980端口用于日志输出。
代码: 全选
ping 111.13.101.208
1、发送ICMP协议,路由到tun0
2、AvConnect通过tun0字符设备读取数据
3、AvConnect做部分数据加工后,通过41596端口发送到VPN Server。
VPN连通后,发现tun0所有的数据包都丢失了。
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.13.15.156 P-t-P:10.13.15.156 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1396 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:1 errors:0 dropped:179 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 B) TX bytes:52 (52.0 B)
怀疑可能出错的过程:
1、创建tun0部分信息错误;
2、AvConnect无法从tun0设备获取信息;
3、AvConnect read tun0设备数据后无法发送到VPN Server端。(但通过wlps30网卡是能ping通VPN Server,亦能正常获取到dns、route数据,这条也能排除)
AvConnect是个可执行文件,没有想到反编译的办法,不能确定哪儿的问题。AvConnect自带的debug日志非常的少。
代码: 全选
2016-08-17 11:47:40 [0x7f19f38b7780] I - ctssl.cpp:Initialize - Intializing SSL[OpenSSL 1.0.1q 3 Dec 2015] ss[0] rc[/usr/local/Aventail] uc[/root/AventailConnect/library/certificates]
2016-08-17 11:47:40 [0x7f19f38b7780] D - ctssl.cpp:SetupSSLVerifyLocation - using </usr/local/Aventail/certs>(directory) for root certificates
2016-08-17 11:47:40 [0x7f19f38b7780] D - ctssl.cpp:GetPublicCerts - cert count-l<0> count<0>
2016-08-17 11:47:40 [0x7f19f38b7780] I - ctcurl.h:Initialize - Intializing Curl[7.46.0] code[0 - 1]
2016-08-17 11:47:40 [0x7f19f38b7780] D - AventailConnectService.cpp:Intialize - rv<1>
2016-08-17 11:47:40 [0x7f19f38b7780] E - AventailConnectService.cpp:Start - IPC port, undefined
2016-08-17 11:47:40 [0x7f19f38b7780] D - ctcurl.h:UnInitialize - inited<1>
2016-08-17 11:47:40 [0x7f19f38b7780] D - ctssl.cpp:UnInitialize - UnIntializing count<0>
2016-08-17 11:47:40 [0x7f19f38b7780] D - ctssl.cpp:UnInitialize - SSL UnIntialization done.
2016-08-17 11:47:40 [0x7f19f38b7780] D - AventailConnectService.cpp:Start - rv<22>
2016-08-17 11:47:40 [0x7f19f38b7780] D - Main.cpp:main - AventailConnectService Done<22>
2016-08-17 11:47:40 [0x7f19f38b7780] I - Closing Log
@poloshiao 是否有方法反编译AvConnect可执行文件, 或者监控tun0运作情况(状态、发送的数据、接收的数据)
已加载的和tunnel相关的内核模块信息
代码: 全选
root@xxx:~/AventailConnect/library/logs# lsmod | grep tunnel
xfrm4_mode_tunnel 16384 0
xfrm4_tunnel 16384 0
udp_tunnel 16384 0
mpls_iptunnel 16384 0
mpls_router 24576 1 mpls_iptunnel
tunnel6 16384 0
tunnel4 16384 2 ipip,xfrm4_tunnel
root@xxx:/dev/net# ll
total 0
drwxr-xr-x 2 root root 60 8月 14 16:37 ./
drwxr-xr-x 20 root root 4440 8月 17 11:36 ../
crw-rw-rw- 1 root root 10, 200 8月 14 16:37 tun