我有以下网络配置:
Office1 <-- openvpn --> office2 <-- ipsec tunnel --> branch office
办公室1和办公室2使用Debian,分支机构:juniper srx100
Office1 network: 172.17.20.0/24
Office2 network: 192.168.31.0/24
Branch network: 192.168.16.0/24
有效的方法:office1 <-> office2,branch_office <-> office2,branch office --> office1
但来自 office1 的流量无法从 office1 到达分支机构。流量到达 office2 后就消失了。iptables 规则“-j LOG”未记录任何内容
为什么它不起作用?如何修复?
更新:
->>您能显示所有 3 台设备的路由表吗?– Tom O'Connor♦ 3 小时前 1
办公室1:
192.168.31.0/24 via 192.168.31.254 dev tun6
192.168.16.0/24 via 192.168.31.254 dev tun6
172.17.20.0/24 dev vlan20 proto kernel scope link src 172.17.20.1
default via 85.21.118.145 dev vlan7
办公室2:
172.17.20.1 dev tun0 proto kernel scope link src 192.168.31.254
192.168.70.0/24 dev eth0 proto kernel scope link src 192.168.70.254
192.168.31.0/24 dev eth0 proto kernel scope link src 192.168.31.254
172.17.20.0/24 via 172.17.20.1 dev tun0
default via 62.176.6.1 dev eth1
分支机构:
show route
inet.0: 8 destinations, 8 routes (8 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
0.0.0.0/0 *[Static/5] 1w0d 04:16:31
> to 109.195.11.254 via fe-0/0/0.0
109.195.10.0/23 *[Direct/0] 1w0d 04:16:31
> via fe-0/0/0.0
109.195.10.17/32 *[Local/0] 1w0d 04:16:31
Local via fe-0/0/0.0
172.17.20.0/24 *[Static/5] 00:37:33
> via st0.0
192.168.16.0/24 *[Direct/0] 6d 04:54:35
> via vlan.0
192.168.16.1/32 *[Local/0] 1w0d 04:32:01
Local via vlan.0
192.168.31.0/24 *[Static/5] 00:37:33
> via st0.0
192.168.70.0/24 *[Static/5] 00:37:33
> via st0.0
->office2 和分支机构之间的 IPsec 策略是什么样的?(在 office2 上尝试 ip xfrm 策略)
src 0.0.0.0/0 dst 0.0.0.0/0
dir 4 priority 0 ptype main
src 0.0.0.0/0 dst 0.0.0.0/0
dir 3 priority 0 ptype main
src 0.0.0.0/0 dst 0.0.0.0/0
dir 4 priority 0 ptype main
src 0.0.0.0/0 dst 0.0.0.0/0
dir 3 priority 0 ptype main
src 192.168.16.0/24 dst 0.0.0.0/0
dir fwd priority 2147483648 ptype main
tmpl src branch_ip dst office2_ip
proto esp reqid 0 mode tunnel
src 192.168.16.0/24 dst 0.0.0.0/0
dir in priority 2147483648 ptype main
tmpl src branch_ip dst office2_ip
proto esp reqid 0 mode tunnel
src 0.0.0.0/0 dst 192.168.16.0/24
dir out priority 2147483648 ptype main
tmpl src office2_ip dst branch_ip
proto esp reqid 0 mode tunnel
答案1
您可能没有在 office2 上启用 IP 转发。请尝试以下任一操作:
cat /proc/sys/net/ipv4/ip_forward
或者 Debian 专用:
sysctl net.ipv4.ip_forward
参数应为“1”。在 Debian 上,编辑 /etc/sysctl.conf,在某处(Squeeze 上的第 27 行和第 28 行左右)你应该找到 -
# Uncomment the next line to enable packet forwarding for IPv4
#net.ipv4.ip_forward=1
取消注释该行,重新启动,你会发现它现在被持续设置为转发数据包。