Update
The fist iptables' rule stays the same of above
Code:
$IPT -t nat -A POSTROUTING -s 192.168.1.0/24 -j SNAT --to 192.168.0.2
The problem is to make network 192.168.0.0 reach 192.168.1.0
I'm trying with this code but ...
Code:
$IPT -t nat -A PREROUTING -s 192.168.0.0/24 -d 192.168.1.0/24 -j DNAT --to 192.168.0.2
this is the routing table in the inside network 192.168.1.0
Code:
root@mail:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
this the routing table on the linux gateway 2 eths
Code:
root@argo:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
Network 192.168.1.0 pings 192.168.1.0 not the opposite.
Code:
root@mail:~# ping mac
PING makintoxik (192.168.0.3) 56(84) bytes of data.
64 bytes from makintoxik (192.168.0.3): icmp_seq=1 ttl=63 time=0.677 ms
64 bytes from makintoxik (192.168.0.3): icmp_seq=2 ttl=63 time=0.496 ms
64 bytes from makintoxik (192.168.0.3): icmp_seq=3 ttl=63 time=0.487 ms
--- makintoxik ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.487/0.553/0.677/0.089 ms