你好,我现在启动strongswan都正常,但是在客户端建立连接时失败,烦请帮忙看看什么问题,不胜感激~下面是日志:
Dec 10 15:37:58 07[CFG] received stroke: add connection ‘ikev2’
Dec 10 15:37:58 07[CFG] adding virtual IP address pool 10.99.1.0/24
Dec 10 15:37:58 07[CFG] loaded certificate “CN=vpn.ilinklink.com” from ‘fullchain.pem’
Dec 10 15:37:58 07[CFG] added configuration ‘ikev2’
Dec 10 15:38:24 13[NET] received packet: from xxx.xxx.xxx.xxx[500] to xxx.xxx.xxx.xxx[500] (604 bytes)
Dec 10 15:38:24 13[ENC] parsed IKE_SA_INIT request 0 [ SA KE No N(REDIR_SUP) N(NATD_S_IP) N(NATD_D_IP) N(FRAG_SUP) ]
Dec 10 15:38:24 13[IKE] xxx.xxx.xxx.xxx is initiating an IKE_SA
Dec 10 15:38:24 13[IKE] remote host is behind NAT
Dec 10 15:38:24 13[ENC] generating IKE_SA_INIT response 0 [ SA KE No N(NATD_S_IP) N(NATD_D_IP) N(FRAG_SUP) N(MULT_AUTH) ]
Dec 10 15:38:24 13[NET] sending packet: from xxx.xxx.xxx.xxx[500] to xxx.xxx.xxx.xxx[500] (448 bytes)
Dec 10 15:38:27 09[NET] received packet: from xxx.xxx.xxx.xxx[500] to xxx.xxx.xxx.xxx[500] (604 bytes)
Dec 10 15:38:27 09[ENC] parsed IKE_SA_INIT request 0 [ SA KE No N(REDIR_SUP) N(NATD_S_IP) N(NATD_D_IP) N(FRAG_SUP) ]
Dec 10 15:38:27 09[IKE] received retransmit of request with ID 0, retransmitting response
Dec 10 15:38:27 09[NET] sending packet: from 4xxx.xxx.xxx.xxx[500] to xxx.xxx.xxx.xxx[500] (448 bytes)
Dec 10 15:38:30 14[NET] received packet: from xxx.xxx.xxx.xxx[500] to xxx.xxx.xxx.xxx[500] (604 bytes)
Dec 10 15:38:30 14[ENC] parsed IKE_SA_INIT request 0 [ SA KE No N(REDIR_SUP) N(NATD_S_IP) N(NATD_D_IP) N(FRAG_SUP) ]
Dec 10 15:38:30 14[IKE] received retransmit of request with ID 0, retransmitting response
Dec 10 15:38:30 14[NET] sending packet: from xxx.xxx.xxx.xxx[500] to xxx.xxx.xxx.xxx[500] (448 bytes)
Dec 10 15:38:33 08[NET] received packet: from xxx.xxx.xxx.xxx[500] to xxx.xxx.xxx.xxx[500] (604 bytes)
Dec 10 15:38:33 08[ENC] parsed IKE_SA_INIT request 0 [ SA KE No N(REDIR_SUP) N(NATD_S_IP) N(NATD_D_IP) N(FRAG_SUP) ]
Dec 10 15:38:33 08[IKE] received retransmit of request with ID 0, retransmitting response
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all — 0.0.0.0/0 0.0.0.0/0 policy match dir in pol ipsec
REJECT all — 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
ACCEPT all — 0.0.0.0/0 0.0.0.0/0 policy match dir out pol ipsec
MASQUERADE all — 10.1.0.0/24 0.0.0.0/0
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all — 0.0.0.0/0 0.0.0.0/0 policy match dir in pol ipsec
REJECT all — 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
你可以试试这么写
-A FORWARD -m state –state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -s 10.1.0.0/24 -o eth0 -j ACCEPT
-A FORWARD -j REJECT –reject-with icmp-host-prohibited
大哥 在吗 strongswan客户端连接VPN连接不上 启动时报错
initiating IKE_SA myvpn[1] to 123.125.247.90
generating IKE_SA_INIT request 0 [ SA KE No N(NATD_S_IP) N(NATD_D_IP) N(HASH_ALG) N(REDIR_SUP) ]
sending packet: from 192.168.71.131 [500] to 123.125.247.90 [500] (1388 bytes)
received packet: from 123.125.247.90 [500] to 192.168.71.131 [500] (580 bytes)
parsed IKE_SA_INIT response 0 [ SA KE No V N(NATD_S_IP) N(NATD_D_IP) ]
received unknown vendor ID: 48:55:41:57:45:49:2d:49:4b:45:76:31:44:53:43:50
local host is behind NAT, sending keep alives
no IDi configured, fall back on IP address
authentication of ‘192.168.71.131 ‘ (myself) with pre-shared key
no shared key found for ‘192.168.71.131
‘ – ’48:55:41:57:45:49:2d:49:4b:45:76:31:44:53:43:50’
establishing connection ‘myvpn’ failed
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
ike=aes256-sha256-modp2048,3des-sha1-modp2048,aes256-sha1-modp2048!
esp=aes256-sha256,3des-sha1,aes256-sha1!
原来的加密会导致8分钟左右断线,修改为这个就完美了。
多次尝试安装,用您的方法成功了,非常感谢!
终于找到个乐于助人的博主了,先马克有问题再来请教!
弄好了,多谢
连接上了,但不能上网
android 的可能和系统版本有关系,不同的版本支持的加密类型不同,你可以查一下你的版本支持的加密类型,把它加到ike和esp里。
你好,我现在启动strongswan都正常,但是在客户端建立连接时失败,烦请帮忙看看什么问题,不胜感激~下面是日志:
Dec 10 15:37:58 07[CFG] received stroke: add connection ‘ikev2’
Dec 10 15:37:58 07[CFG] adding virtual IP address pool 10.99.1.0/24
Dec 10 15:37:58 07[CFG] loaded certificate “CN=vpn.ilinklink.com” from ‘fullchain.pem’
Dec 10 15:37:58 07[CFG] added configuration ‘ikev2’
Dec 10 15:38:24 13[NET] received packet: from xxx.xxx.xxx.xxx[500] to xxx.xxx.xxx.xxx[500] (604 bytes)
Dec 10 15:38:24 13[ENC] parsed IKE_SA_INIT request 0 [ SA KE No N(REDIR_SUP) N(NATD_S_IP) N(NATD_D_IP) N(FRAG_SUP) ]
Dec 10 15:38:24 13[IKE] xxx.xxx.xxx.xxx is initiating an IKE_SA
Dec 10 15:38:24 13[IKE] remote host is behind NAT
Dec 10 15:38:24 13[ENC] generating IKE_SA_INIT response 0 [ SA KE No N(NATD_S_IP) N(NATD_D_IP) N(FRAG_SUP) N(MULT_AUTH) ]
Dec 10 15:38:24 13[NET] sending packet: from xxx.xxx.xxx.xxx[500] to xxx.xxx.xxx.xxx[500] (448 bytes)
Dec 10 15:38:27 09[NET] received packet: from xxx.xxx.xxx.xxx[500] to xxx.xxx.xxx.xxx[500] (604 bytes)
Dec 10 15:38:27 09[ENC] parsed IKE_SA_INIT request 0 [ SA KE No N(REDIR_SUP) N(NATD_S_IP) N(NATD_D_IP) N(FRAG_SUP) ]
Dec 10 15:38:27 09[IKE] received retransmit of request with ID 0, retransmitting response
Dec 10 15:38:27 09[NET] sending packet: from 4xxx.xxx.xxx.xxx[500] to xxx.xxx.xxx.xxx[500] (448 bytes)
Dec 10 15:38:30 14[NET] received packet: from xxx.xxx.xxx.xxx[500] to xxx.xxx.xxx.xxx[500] (604 bytes)
Dec 10 15:38:30 14[ENC] parsed IKE_SA_INIT request 0 [ SA KE No N(REDIR_SUP) N(NATD_S_IP) N(NATD_D_IP) N(FRAG_SUP) ]
Dec 10 15:38:30 14[IKE] received retransmit of request with ID 0, retransmitting response
Dec 10 15:38:30 14[NET] sending packet: from xxx.xxx.xxx.xxx[500] to xxx.xxx.xxx.xxx[500] (448 bytes)
Dec 10 15:38:33 08[NET] received packet: from xxx.xxx.xxx.xxx[500] to xxx.xxx.xxx.xxx[500] (604 bytes)
Dec 10 15:38:33 08[ENC] parsed IKE_SA_INIT request 0 [ SA KE No N(REDIR_SUP) N(NATD_S_IP) N(NATD_D_IP) N(FRAG_SUP) ]
Dec 10 15:38:33 08[IKE] received retransmit of request with ID 0, retransmitting response
你好,服务器搭好后win10和android手机都显示已连接,可是无法访问网页,请问有什么排查方向吗?谢谢
内核转发,防火墙转发,dns, 还有确保服务器本身可以访问“外网”。想确定具体原因就看日志。
内核防火墙转发根据教程来的,应该没有问题吧,服务器肯定能连外网。日志里只有建立tunnel时的信息。怀疑是dns的问题。下面是一些信息:
# iptables -nL
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all — 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
ACCEPT icmp — 0.0.0.0/0 0.0.0.0/0
ACCEPT all — 0.0.0.0/0 0.0.0.0/0
ACCEPT tcp — 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
ACCEPT ah — 0.0.0.0/0 0.0.0.0/0
ACCEPT esp — 0.0.0.0/0 0.0.0.0/0
ACCEPT udp — 0.0.0.0/0 0.0.0.0/0 udp dpt:500
ACCEPT udp — 0.0.0.0/0 0.0.0.0/0 udp dpt:4500
REJECT all — 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all — 0.0.0.0/0 0.0.0.0/0 policy match dir in pol ipsec
REJECT all — 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
# iptables -t nat -nL
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
ACCEPT all — 0.0.0.0/0 0.0.0.0/0 policy match dir out pol ipsec
MASQUERADE all — 10.1.0.0/24 0.0.0.0/0
# cat /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
vm.swappiness = 0
net.ipv4.neigh.default.gc_stale_time=120
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_announce=2
net.ipv4.conf.all.arp_announce=2
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_synack_retries = 2
net.ipv4.ip_forward = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv6.conf.all.forwarding=1
抓了一下ipsec0的包,发现一直出错,错误如下:
# tcpdump -i ipsec0 -vvv -n
tcpdump: listening on ipsec0, link-type RAW (Raw IP), capture size 262144 bytes
09:38:01.580894 IP (tos 0x0, ttl 64, id 47089, offset 0, flags [DF], proto TCP (6), length 60)
10.1.0.1.45184 > 106.11.186.53.http: Flags [S], cksum 0xcdbd (correct), seq 3774583306, win 65535, options [mss 1360,sackOK,TS val 43066875 ecr 0,nop,wscale 8], length 0
09:38:01.580941 IP (tos 0xc0, ttl 64, id 24224, offset 0, flags [none], proto ICMP (1), length 88)
172.20.136.173 > 10.1.0.1: ICMP host 106.11.186.53 unreachable – admin prohibited, length 68
IP (tos 0x0, ttl 63, id 47089, offset 0, flags [DF], proto TCP (6), length 60)
10.1.0.1.45184 > 106.11.186.53.http: Flags [S], cksum 0xcdbd (correct), seq 3774583306, win 65535, options [mss 1360,sackOK,TS val 43066875 ecr 0,nop,wscale 8], length 0
09:38:01.626734 IP (tos 0x0, ttl 64, id 39556, offset 0, flags [DF], proto UDP (17), length 66)
10.1.0.1.36063 > 8.8.8.8.domain: [udp sum ok] 48911+ AAAA? connect.rom.miui.com. (38)
09:38:01.626758 IP (tos 0xc0, ttl 64, id 24259, offset 0, flags [none], proto ICMP (1), length 94)
172.20.136.173 > 10.1.0.1: ICMP host 8.8.8.8 unreachable – admin prohibited, length 74
IP (tos 0x0, ttl 63, id 39556, offset 0, flags [DF], proto UDP (17), length 66)
10.1.0.1.36063 > 8.8.8.8.domain: [udp sum ok] 48911+ AAAA? connect.rom.miui.com. (38)
09:38:01.653729 IP (tos 0x0, ttl 64, id 30625, offset 0, flags [DF], proto TCP (6), length 60)
10.1.0.1.36156 > 120.92.98.14.xmpp-client: Flags [S], cksum 0x1e57 (correct), seq 700928419, win 65535, options [mss 1360,sackOK,TS val 43066882 ecr 0,nop,wscale 8], length 0
09:38:01.653749 IP (tos 0xc0, ttl 64, id 24270, offset 0, flags [none], proto ICMP (1), length 88)
172.20.136.173 > 10.1.0.1: ICMP host 120.92.98.14 unreachable – admin prohibited, length 68
IP (tos 0x0, ttl 63, id 30625, offset 0, flags [DF], proto TCP (6), length 60)
10.1.0.1.36156 > 120.92.98.14.xmpp-client: Flags [S], cksum 0x1e57 (correct), seq 700928419, win 65535, options [mss 1360,sackOK,TS val 43066882 ecr 0,nop,wscale 8], length 0
09:38:01.770704 IP (tos 0x0, ttl 64, id 850, offset 0, flags [DF], proto TCP (6), length 60)
10.1.0.1.33932 > 106.11.186.53.https: Flags [S], cksum 0x4ce5 (correct), seq 4177012060, win 65535, options [mss 1360,sackOK,TS val 43066894 ecr 0,nop,wscale 8], length 0
09:38:01.770726 IP (tos 0xc0, ttl 64, id 24294, offset 0, flags [none], proto ICMP (1), length 88)
172.20.136.173 > 10.1.0.1: ICMP host 106.11.186.53 unreachable – admin prohibited, length 68
IP (tos 0x0, ttl 63, id 850, offset 0, flags [DF], proto TCP (6), length 60)
10.1.0.1.33932 > 106.11.186.53.https: Flags [S], cksum 0x4ce5 (correct), seq 4177012060, win 65535, options [mss 1360,sackOK,TS val 43066894 ecr 0,nop,wscale 8], length 0
09:38:01.811018 IP (tos 0x0, ttl 64, id 16885, offset 0, flags [DF], proto UDP (17), length 66)
10.1.0.1.first-defense > 8.8.4.4.domain: [udp sum ok] 48911+ AAAA? connect.rom.miui.com. (38)
09:38:01.811035 IP (tos 0xc0, ttl 64, id 24299, offset 0, flags [none], proto ICMP (1), length 94)
172.20.136.173 > 10.1.0.1: ICMP host 8.8.4.4 unreachable – admin prohibited, length 74
IP (tos 0x0, ttl 63, id 16885, offset 0, flags [DF], proto UDP (17), length 66)
10.1.0.1.first-defense > 8.8.4.4.domain: [udp sum ok] 48911+ AAAA? connect.rom.miui.com. (38)
你用国内服务器搭梯子?
阿里云的硅谷机房
检查一下 charon.log 日志的内容,那个比较详细。
问题找到了,iptables filter 表的FORWARD链中拒绝了icmp,下面的第二条。删掉就好了。
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all — 0.0.0.0/0 0.0.0.0/0 policy match dir in pol ipsec
REJECT all — 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
你可以试试这么写
-A FORWARD -m state –state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -s 10.1.0.0/24 -o eth0 -j ACCEPT
-A FORWARD -j REJECT –reject-with icmp-host-prohibited
大哥 在吗 strongswan客户端连接VPN连接不上 启动时报错
initiating IKE_SA myvpn[1] to 123.125.247.90
generating IKE_SA_INIT request 0 [ SA KE No N(NATD_S_IP) N(NATD_D_IP) N(HASH_ALG) N(REDIR_SUP) ]
sending packet: from 192.168.71.131 [500] to 123.125.247.90 [500] (1388 bytes)
received packet: from 123.125.247.90 [500] to 192.168.71.131 [500] (580 bytes)
parsed IKE_SA_INIT response 0 [ SA KE No V N(NATD_S_IP) N(NATD_D_IP) ]
received unknown vendor ID: 48:55:41:57:45:49:2d:49:4b:45:76:31:44:53:43:50
local host is behind NAT, sending keep alives
no IDi configured, fall back on IP address
authentication of ‘192.168.71.131 ‘ (myself) with pre-shared key
no shared key found for ‘192.168.71.131
‘ – ’48:55:41:57:45:49:2d:49:4b:45:76:31:44:53:43:50’
establishing connection ‘myvpn’ failed
没有找到共享密钥,看看 ipsec.secrets 文件里的密码设置的对不对。记得重启服务。
使用letsencrypt ios/mac均可以以eap用户密码登录。但是Android和WIN10不能连接。
win10客户端写的已经很详细了,配置的都对是没问题的。
win10 正常,但ios12总是提示用户认证失败
看下你的账号密码,leftId 等等是否正确,还有证书是否配置正确及有效。
我的用ios12很正常。
如果你的win10和ios 是同一个账号,那可能不能同时登录 ,重启strongswan服务后在ios上单独登录试试。