How to route traffic from eth1 to eth0
by pikta from LinuxQuestions.org on (#5KQ1A)
Hello,
I am sure, that this problem was solved on this forum, but ...
I am using Debian linux machine. It has two interfaces eth0 and eth1. eth0 (IP 10.1.1.229)has internet connection . eth1 (IP 172.10.10.19) is dedicated for a internal network without internet.
In internal network i has a computer with IP 172.10.10.25. I want that this computer will accsess an internet. From IP 172.10.10.25 I can ping 172.10.10.19 but i cant ping 8.8.8.8. I was trying to add route from 172.10.10.0/24 to internet trough 10.1.1.229 (eth0 interface)on my Debian linux, I tried IP forward, but 172.10.10.25 cant access internet. How to do it correct? What commands I need to write?
What I did on debian linux:
I allowed ip foward:
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
Then i configured IP tables:
sudo /sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo /sbin/iptables -A FORWARD -i eth0 -o eth1 -m --state RELATED,ESTABLISHED -j ACCEPT
sudo /sbin/iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
but it doesnt work. What I am doing wrong?
Here is a picture for my problem
Attached Thumbnails
I am sure, that this problem was solved on this forum, but ...
I am using Debian linux machine. It has two interfaces eth0 and eth1. eth0 (IP 10.1.1.229)has internet connection . eth1 (IP 172.10.10.19) is dedicated for a internal network without internet.
In internal network i has a computer with IP 172.10.10.25. I want that this computer will accsess an internet. From IP 172.10.10.25 I can ping 172.10.10.19 but i cant ping 8.8.8.8. I was trying to add route from 172.10.10.0/24 to internet trough 10.1.1.229 (eth0 interface)on my Debian linux, I tried IP forward, but 172.10.10.25 cant access internet. How to do it correct? What commands I need to write?
What I did on debian linux:
I allowed ip foward:
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
Then i configured IP tables:
sudo /sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo /sbin/iptables -A FORWARD -i eth0 -o eth1 -m --state RELATED,ESTABLISHED -j ACCEPT
sudo /sbin/iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
but it doesnt work. What I am doing wrong?
Here is a picture for my problem
Attached Thumbnails