<div dir="ltr"><div><div><div><div><div><div><div><div><div><div>Hi,<br></div> my network configurationis :<br><br></div> private subnet <a href="http://192.168.1.0/24" target="_blank">192.168.1.0/24</a> private subnet <a href="http://192.168.5.0/24" target="_blank">192.168.5.0/24</a><br></div> PC1 ------ ONT1 <========IPSEC TUNNEL=========> ONT2 ------- PC2<br>
135.251.199.83
135.251.205.188 <br><br><br></div>i am setting up a ipsec tunnel on ONT1 and ONT2, and this tunnel seems had setup, on ONT1 i can saw:<br><div><div><br>[root@AONT: admin]# ipsec --version<br>Linux Openswan U2.6.38/K3.4.11-rt19 (netkey)<br></div></div><br>[root@AONT: admin]# ipsec setup status<br>IPsec running - pluto pid: 6676<br>pluto pid 6676<br>1 tunnels up<br>some eroutes exist<br><br>[root@AONT: admin]# ip xfrm policy<br>src <a href="http://192.168.1.0/24" target="_blank">192.168.1.0/24</a> dst <a href="http://192.168.5.0/24" target="_blank">192.168.5.0/24</a> proto udp sport 1701 dport 1701 <br> dir out priority 2344 <br> tmpl src 135.251.199.83 dst 135.251.205.188<br> proto esp reqid 16385 mode tunnel<br>src <a href="http://192.168.5.0/24" target="_blank">192.168.5.0/24</a> dst <a href="http://192.168.1.0/24" target="_blank">192.168.1.0/24</a> proto udp sport 1701 dport 1701 <br> dir fwd priority 2344 <br> tmpl src 135.251.205.188 dst 135.251.199.83<br> proto esp reqid 16385 mode tunnel<br>src <a href="http://192.168.5.0/24" target="_blank">192.168.5.0/24</a> dst <a href="http://192.168.1.0/24" target="_blank">192.168.1.0/24</a> proto udp sport 1701 dport 1701 <br> dir in priority 2344 <br> tmpl src 135.251.205.188 dst 135.251.199.83<br> proto esp reqid 16385 mode tunnel<br>src ::/0 dst ::/0 <br> socket out priority 0 <br><br></div>and here is my ipsec.conf<br>version 2.0 # conforms to second version of ipsec.conf specification<br>config setup<br> nat_traversal=yes<br> oe=off<br> protostack=netkey<br> plutostderrlog=/tmp/vpnerr.log<br> plutoopts="--interface=eth4"<br>conn L2TP-PSK<br> authby=secret<br> pfs=no<br> auto=add<br> keyingtries=3<br> dpddelay=30<br> dpdtimeout=120<br> dpdaction=Restart<br> rekey=yes<br> ikelifetime=8h<br> keylife=1h<br> type=tunnel<br> left=135.251.199.83<br> leftnexthop=%defaultroute<br> leftprotoport=17/1701<br> leftsubnet=<a href="http://192.168.1.0/24" target="_blank">192.168.1.0/24</a><br> right=135.251.205.188<br> rightprotoport=17/1701<br> rightsubnet=<a href="http://192.168.5.0/24" target="_blank">192.168.5.0/24</a><br><br></div>Then I can not access to 192.168.5.x, and i follow some documents from internet adding iptables likes:<br>iptables -t nat -A POSTROUTING -s site-A-private-subnet -d site-B-private-subnet -j SNAT --to site-A-Public-IP
<br><br></div>but it does not works. when i add route from my workmates:<br></div> route add -net <a href="http://192.168.5.0/24" target="_blank">192.168.5.0/24</a> ppp0<br></div>I can ping 192.168.5.x ,but the tcpdump data on ONT2 was not ESP, only ICMP packets. So this is not the correct ways.<br><br></div>Should I add other iptables or route to allow PC1 ping PC2? <br>Any assistance will be greatly appreciated! </div>