I have created a network namespace in debian 8 and created veth interface vpngw. On this vpngw, I am running OpenVPN as client and have default gw in this namespace towards global namespace (out from the namespace) and there I have a modem with public IP address, through which I am routing this to the OpenVPN server on the other end by using masquerading.

iptables -t nat -I POSTROUTING -s -0 sierra -j MASQUERADE

Now the problem is, sometime it works and traffic from (IP of vpngw) gets NATted and works as expected. The tunnel gets established. But most of the times it is not hitting the iptables rule and not getting NATted.

Can anyone please help me? What is wrong here?

  • Is that really -0 (zero)? What other iptables rules do you have? Is there any pattern to when it connects? – muru Jul 17 at 9:20
  • no it is " -o ". in nat table this is the one i have. – jitendra Jul 17 at 11:11
  • Actually let me rephrase my problem in simple word: 1) ii have a linux box , debian8 2) i have a local lan interface , I am running openvpn client on this 3) the traffic from this local interface VPNServer:vpnPort ( x.x.x.x:1194) not getting NAT to my public facing interface (sierra) – jitendra Jul 17 at 11:43

Your Answer

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

Browse other questions tagged or ask your own question.