Linux – Allow GRE (IP protocol 47) over Linux router NAT for a subnet

greiptableslinuxnat;

I have network setup as shown below:
network

The VPN server running is windows 2012 server default VPN, which uses GRE protocol. I am able to have VPN connection to that remote vpn server, from my intranet single IP only. But I am not able to connect for range of intranet IP 172.16.14.0/24. The problem is with linux router, which is doing NAT.
My iptable for nat table looks like this for working vpn connection (for single IP), allowing gre protocol:

 iptables -I PREROUTING -t nat -p 47 --src 202.xx.yy.abc  -j DNAT --to-destination 172.16.14.15
 iptables -I POSTROUTING -p 47 -t nat --src 172.16.14.15  -j SNAT --to-source 202.xx.yy.zz
 iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE 
 iptables -A INPUT -p 47 -j ACCEPT

This rule works fine for single IP 172.16.14.15. How can I make this works for whole 172.16.14.0/24 range so that I can have VPN connection to the remote VPN server ?

Best Answer

I found the solution.

I did this:

 sysctl -w net.netfilter.nf_conntrack_helper=1

Then add

modprobe ip_nat_pptp

I was using Ubuntu 18.04.2 LTS, kernel version 4.15.0-45-generic. There was no need to do anything related with GRE protocol inside iptables PREROUTING, POSTROUTING tables. Adding just above two lines worked.