我有一个装有 Ubuntu 14.04 的 Amazon EC2 实例,其中安装了 Cisco VPN 客户端。我正在使用 Cisco AnyConnect 安全移动客户端(版本 3.1.04072)。
当我运行 VPN 客户端时,我可以看到一些初始输出,这表明 VPN 连接已成功建立,之后我将失去对服务器的访问权限。我需要从控制台重新启动服务器才能重新获得访问权限。
我猜想 VPN 搞乱了路由表,但我真的不知道如何修复它。在启动 openvpn 之前,我尝试添加默认网关路由,正如这个答案所解释的那样:https://serverfault.com/a/649855/105464,但没有运气
我能够在本地 Ubuntu 机器上成功运行相同的 VPN 客户端。以下是 VPN 连接前后的本地路由表:
使用本地机器上的 VPN 之前
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 9 0 0 wlan0
使用本地机器上的 VPN 后
$ ifconfig
cscotun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:172.22.145.31 P-t-P:172.22.145.31 Mask:255.255.240.0
inet6 addr: fe80::8863:d678:a432:4ba9/128 Scope:Link
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1280 Metric:1
RX packets:903 errors:0 dropped:0 overruns:0 frame:0
TX packets:969 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:371960 (371.9 KB) TX bytes:268199 (268.1 KB)
eth0 Link encap:Ethernet HWaddr b4:b5:2f:75:f7:b5
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:3323045 errors:0 dropped:6 overruns:0 frame:0
TX packets:2694039 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3003631663 (3.0 GB) TX bytes:464943796 (464.9 MB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:673096 errors:0 dropped:0 overruns:0 frame:0
TX packets:673096 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:92228222 (92.2 MB) TX bytes:92228222 (92.2 MB)
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 cscotun0
0.0.0.0 192.168.1.1 0.0.0.0 UG 256 0 0 wlan0
130.132.2.14 192.168.1.1 255.255.255.255 UGH 0 0 0 wlan0
172.22.144.0 0.0.0.0 255.255.240.0 U 0 0 0 cscotun0
192.168.1.0 0.0.0.0 255.255.255.0 U 9 0 0 wlan0
192.168.1.1 0.0.0.0 255.255.255.255 UH 0 0 0 wlan0
$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ciscovpn all -- anywhere anywhere
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ciscovpn all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ciscovpn all -- anywhere anywhere
Chain ciscovpn (3 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ciscovpnfw all -- anywhere anywhere
ciscovpnfw all -- anywhere anywhere
ciscovpnfw udp -- anywhere anywhere udp spt:bootpc dpt:bootps
ciscovpnfw udp -- anywhere anywhere udp spt:bootps dpt:bootpc
ciscovpnfw udp -- anywhere anywhere udp spt:dhcpv6-client dpt:dhcpv6-server
ciscovpnfw udp -- anywhere anywhere udp spt:dhcpv6-server dpt:dhcpv6-client
ciscovpnfw tcp -- 192.168.1.124 vpn4.its.yale.edu tcp dpt:https
ciscovpnfw tcp -- vpn4.its.yale.edu 192.168.1.124 tcp spt:https
ciscovpnfw udp -- 192.168.1.124 vpn4.its.yale.edu udp dpt:https
ciscovpnfw udp -- vpn4.its.yale.edu 192.168.1.124 udp spt:https
ciscovpnfw all -- 192.168.1.124 192.168.1.0/24
ciscovpnfw all -- 192.168.1.0/24 192.168.1.124
ciscovpnfw all -- 192.168.1.0/24 192.168.1.255
ciscovpnfw all -- 192.168.1.124 192.168.1.255
ciscovpnfw udp -- 192.168.1.0/24 224.0.0.251 udp dpt:mdns
ciscovpnfw udp -- 192.168.1.124 224.0.0.251 udp dpt:mdns
ciscovpnfw udp -- 192.168.1.0/24 239.255.255.250 udp dpt:1900
ciscovpnfw udp -- 192.168.1.124 239.255.255.250 udp dpt:1900
ciscovpnfw all -- anywhere 255.255.255.255
ciscovpnfw all -- 192.168.1.124 255.255.255.255
ciscovpnfw udp -- 192.168.1.124 anywhere udp dpt:domain
ciscovpnfw udp -- anywhere 192.168.1.124 udp spt:domain
ciscovpnfw udp -- anywhere anywhere udp spt:bootpc dpt:bootps
ciscovpnfw udp -- anywhere anywhere udp spt:bootps dpt:bootpc
ciscovpnfw udp -- anywhere anywhere udp spt:dhcpv6-client dpt:dhcpv6-server
ciscovpnfw udp -- anywhere anywhere udp spt:dhcpv6-server dpt:dhcpv6-client
ciscovpnfw all -- anywhere anywhere
ciscovpnfw all -- vpn172022145031.its.yale.internal anywhere
DROP all -- anywhere anywhere
Chain ciscovpnfw (28 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere