Howto: IP forwarding on same server using iptables.

Posted on Updated on

Here in my server has two IP’s , Primary IP has listening to public network and secondary is private IP, Some of the service is listening to my secondary IP, I need to connect it from public.

I used to the simple Iptable rule to use IP forwarding so  that every traffic to the primary IP has transfered to the secondery. then I can access all the service that using both primary and secondery IP’s.

iptables -t nat -A PREROUTING -i eth0 -p tcp -j DNAT --to