LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   NAT Config on Centos (https://www.linuxquestions.org/questions/linux-newbie-8/nat-config-on-centos-879503/)

kiwembe 05-08-2011 02:20 PM

NAT Config on Centos
 
I have two network interface eth0 and eth1

eth0 is on 192.168.0/24 network connected to the internet eth1 is on 10.10.10/24 network and DHCP for this network the clients connected to this interface can not connect to the internet but they can ping 192.168.0.4 which is the eth0 ip but can not ping 192.168.0.1 cisco router or anything else on 192.168.0/24 I have tried few tricks
but still not working

1) iptables -t nat -A POSTROUTING -s 10.10.10.0/24 -o eth0 \
-j SNAT --to 192.168.0.4/24

it did not work

2) iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to 192.168.0.4
did not work as well

I real need help on this thanks in advance

bhaslinux 05-09-2011 03:37 PM

cat /proc/sys/net/ipv4/ip_forward ?

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

kiwembe 05-18-2011 08:55 AM

Thanks for the reply but still no luck

cat /proc/sys/net/ipv4/ip_forward
1

ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:0c:29:14:b8:10 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.85/24 brd 192.168.1.255 scope global eth0
inet6 fe80::20c:29ff:fe14:b810/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:0c:29:14:b8:1a brd ff:ff:ff:ff:ff:ff
inet 192.168.129.132/24 brd 192.168.129.255 scope global eth1
inet6 fe80::20c:29ff:fe14:b81a/64 scope link
valid_lft forever preferred_lft forever
4: sit0: <NOARP> mtu 1480 qdisc noop
link/sit 0.0.0.0 brd 0.0.0.0
ping 4.2.2.2 -I eth0
PING 4.2.2.2 (4.2.2.2) from 192.168.1.85 eth0: 56(84) bytes of data.
64 bytes from 4.2.2.2: icmp_seq=1 ttl=244 time=385 ms
64 bytes from 4.2.2.2: icmp_seq=2 ttl=244 time=281 ms

ping 4.2.2.2 -I eth1
PING 4.2.2.2 (4.2.2.2) from 192.168.129.132 eth1: 56(84) bytes of data.

--- 4.2.2.2 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1445ms

I'm using vmware when I eneble NAT on eth0 and DHCP on eth1 everything works

but when I enable Bridge mode on eth0 and DHCP on eth1 that's when things stop working

Thanks


All times are GMT -5. The time now is 01:31 AM.