I've set up openvpn using tun. I can ping both ways between client & server. But I can't ping from the client to (as a test).

I've added nat with:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

But things don't appear to route from the tun0 interface to eth0.

tcpdump on tun0 shows that packets are coming in (in this case ping to as a test):

12:21:55.956564 IP > google-public-dns-b.google.com: ICMP echo request, id 512, seq 17153, length 40

But tcpdump on eth0 doesn't show anything other than my ssh traffic.

I have a ping looping from the vpn client, and I see that in my tcpdump on tun0, but I don't see anything "google" in my tcpdump on eth0.

Any thoughts? I can run this ping fine from the openvpn host. iptables are empty except for the MASQUERADE action, with defaults to accept.

  • I agree with poige. Paste routes, iptables rules, tcpdump on eth0, openvpn configs. – 3molo Jul 14 '11 at 6:01

Aha, it was step #1 in this guide on configuring linux as a router... turn on IP Forwarding.



Iptables -A FORWARD -j ACCEPT?

  • Policy is accept by default: Chain FORWARD (policy ACCEPT) – davidparks21 Jul 14 '11 at 5:56

Why -j MASQUERADE @ -o eth0 if you're talking bout I've set up openvpn using tun?

You need to verify you've got: routing (forwarding, actually) enabled (sysctl), routing is properly set-up (needed routes are installed), NAT is properly set-up if it's needed.

  • 1
    Because he intend to SNAT vpn clients -> internet? – 3molo Jul 14 '11 at 5:49
  • I'm guessing I'm missing a route here. What do I need to do to route traffic out the default gateway? I'm confused here because I already have a default route, so I am assuming that any packet that comes in destine for an external address will be forwarded to the default gateway. – davidparks21 Jul 14 '11 at 5:57
  • Have you verified you have forwarding enabled?… – poige Jul 14 '11 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.