title: Forward lan traffic to VPN IPsec
body: <p>I am using from Linux a docker container to set up an IPsec ike connection, specifically it is a stono/ike container.</p>
  <blockquote>
  <p>docker run -d --privileged --net=host -v sites:/sites stono/ike:latest site user password</p>
  </blockquote>
  <p>This container raises a tap0 interface in the host and creates routes for each subnet of the VPN. The VPN offers me an IP as a client within a range 192.168.50.0/24 and from it allows me to access This is the routing table:</p>
  <pre><code>192.168.50.0/24 via 192.168.50.14 dev tap0 proto static
  192.168.51.0/24 via 192.168.50.14 dev tap0 proto static
  192.168.52.0/24 via 192.168.50.14 dev tap0 proto static
  ....
  </code></pre>
  <p><strong>How can I share these networks on my lan?</strong></p>
  <ul>
  <li>IPV4 Forward is enabled</li>
  <li>I have created iptables rules to accept the traffic:</li>
  </ul>
  <pre><code>iptables -A FORWARD -i eth0 -j ACCEPT 
  iptables -A FORWARD -o tap0 -j ACCEPT 
  iptables -t nat -A POSTROUTING -o tap0 -j MASQUERADE
  </code></pre>
  <p>Finally I have created the static routes on another computer in my lan but I can only ping the ip 192.168.50.14, the ip assigned to me by the VPN server in the tap0 interface, the rest of the host in that network, or in the others, I have no access.</p>
  <pre><code>sudo ip route add 192.168.50.0/24 via 192.168.1.202
  sudo ip route add 192.168.51.0/24 via 192.168.1.202
  ...
  </code></pre>