I have a Centos server with three NIC cards.
ETH0 Public IP xx.xx.xx.xx1/xx.xx.xx.xx2 (with two public IP)
EHT1 Local Subnet 192.168.80.0 (DHCP server listening on this interface)
ETH2 Local Subnet (10.0.1.10) Connected to printers/file servers/other lans only accessible inside the organisation.
My Setup requirement:- on ETH1 (192.168.800/24 subnet) I have few users who needs to access Internet and their mails. We have setup a mail server inside 192.168.80.0/24 subnet itself so that mail access should be faster for the users.
I have enabled static NAT to mail server 192.168.80.2 which has got public IP xx.xx.xx.xx2. Rest users on eth1 see their public IP as xx.xx.xx.xx1 since we have enabled DNAT for it too.
File servers/Printers are accessible by the users on subnet 192.168.80.0/24.
I have another subnet 192.168.70.0/24 which needs to communicate to 192.168.80.0/24 subnet and similarly 192.168.80.0.24 needs to communicate to 192.168.70.0/24.
192.168.80.0/24 is connected to 10.0.0.0/24 using L3 switch. 192.168.70.0/24 is connected to 10.0.0.0/24 using L3 switch.
Everything works fine but unable to make communication b/w 192.168.80.0/24 to 192.168.70.0.. vis and vis.
Whenever I do traceroute from 192.168.80.0/24 to 192.168.70.0/24 network it goes to internet.
traceroute 192.168.70.1 * * * 192.168.80.1 * * * ISP default gateway IP
How can I enable forwarding or routing for traffic originating from subnet 192.168.80.0/24 and destined to 192.168.70.0/24 should go via eth2 (10.0.1.10) so that above traceroute should be appear something like below and rest should work as it is working now.
traceroute 192.168.70.1 * * * 192.168.80.1 * * * 10.0.1.10
I don't have any clue what needs to be done now.
My NAT rules:
-A PREROUTING -d xx.xx.xx.xx2/32 -i eth0 -j DNAT --to-destination 192.168.80.2 -A POSTROUTING -s 192.168.80.2/32 -o eth0 -j SNAT --to-source xx.xx.xx.xx2 -A POSTROUTING -s 192.168.80.0/24 -o eth0 -j SNAT --to-source xx.xx.xx.xx1 -A POSTROUTING -o eth0 -j MASQUERADE
route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 115.xx.xx.200 0.0.0.0 255.255.255.252 U 0 0 0 eth0 192.168.80.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 10.0.0.0 0.0.0.0 255.255.252.0 U 0 0 0 eth2 18.104.22.168 0.0.0.0 255.0.0.0 U 0 0 0 eth0 0.0.0.0 115.xx.xx.137 0.0.0.0 UG 0 0 0 eth0