有一台装有 Ubuntu 18.04 的计算机位于 NAT 路由器后面并接收子网中的地址192.168.1.0/24
。例如192.168.1.11
我使用IPSec IKEv2协议从这台计算机连接到 VPN 服务器,但既不systemctl start strongswan
也不ipsec start
不提高连接,我只能以一种方式连接:
sudo charon-cmd --cert ca-cert.pem --host vpn_domain_or_IP --identity your_username
连接后,我从 VPN 服务器上的 NAT 子网获取地址10.10.10.0/24
,例如10.10.10.11
VPN 工作,所有流量都通过隧道。但是到本地网络的连接完全消失了,从子网192.168.1.0/24
到地址的请求192.168.1.11
以及从我的计算机到任何子网地址的请求192.168.1.0/24
都不会通过
输出ip a
:
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 18:d6:c7:14:ff:04 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.11/24 brd 192.168.1.255 scope global dynamic noprefixroute eth0
valid_lft 562sec preferred_lft 562sec
15: ipsec0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1400 qdisc fq_codel state UNKNOWN group default qlen 500
link/none
inet 10.10.10.11/32 scope global ipsec0
valid_lft forever preferred_lft forever
inet6 fe80::5b2:78:42:d7/64 scope link stable-privacy
valid_lft forever preferred_lft forever
平
:~# ping 192.168.1.11
PING 192.168.1.11 (192.168.1.11) 56(84) bytes of data.
64 bytes from 192.168.1.11: icmp_seq=1 ttl=64 time=0.071 ms
64 bytes from 192.168.1.11: icmp_seq=2 ttl=64 time=0.070 ms
64 bytes from 192.168.1.11: icmp_seq=3 ttl=64 time=0.069 ms
64 bytes from 192.168.1.11: icmp_seq=4 ttl=64 time=0.072 ms
64 bytes from 192.168.1.11: icmp_seq=5 ttl=64 time=0.067 ms
^C
--- 192.168.1.11 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4075ms
rtt min/avg/max/mdev = 0.067/0.069/0.072/0.010 ms
:~# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
^C
--- 192.168.1.1 ping statistics ---
6 packets transmitted, 0 received, 100% packet loss, time 5105ms
所有配置都与此资源相同。