I am facing a problem in sending traffic through L2TP tunnel using Linux iptables MASQUERADE feature.
SG1 in following setup is having iptables with MASQUERADE. The rule is:
# iptables -t nat -A POSTROUTING -j MASQUERADE -o ppp0
Test set-up:
192.168.1.82 192.168.1.254 LAN PC ----------------- SG 1 ( LAC Mode ) --------------- SG2 ( LNS Mode ) 172.16.3.83 172.16.3.73 6.6.6.7 ---- l2tp tunnel ---- 6.6.6.6
After estabilshing the L2TP tunnel, when we issue ping from LAN PC (192.168.1.82) to LNS IP address (6.6.6.6) we observe the packets sent out by SG1 having strange Source IP in both inner and outer IP header.
# ping 6.6.6.6 (from 192.168.1.82)
Problem:
The outer IP header is having the source IP as 6.7.1.254 (last two octets of PPP IP + last two octets of ethernet IP).
And the inner IP header (PPP) is having source as 6.6.6.7 instead of 192.168.1.82 (actual packet originator).
If i disable the iptables rule with MASQUERADE then the traffic is going fine.
Can anyone suggest, what is the mistake in configuration or is it the problem with L2TP itself ?
Regards, --Rajesh