LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Know how to route (https://www.linuxquestions.org/questions/linux-networking-3/know-how-to-route-663417/)

sergiomc 08-17-2008 12:38 PM

Know how to route
 
Hello everybody.
I am new user from the forums, I'm from peru.
I have a problem I hope you may help me.

I don't understand very well how the route tables (route command add, del etc) works.

This is the scenario:

eth0: ip 10.200.0.x / subnet 255.255.255.0 / gateway 10.200.0.2
eth1: ip 192.168.0.x / subnet 255.255.255.0 / gateway 192.168.0.2

What I want is that when I make a
ping 10.200.0.16 for example, it returns an answers of connection.
and the same with 192.168.0.50 for example

but now, I do the 2 commands above, and only returns answers on the net 192. The ping to 10.xxxx. returns bad.

The route table is the original, i didn't modify any because i didn't know how it works.

But i tried a little things i found on the web.

I tried route add -net 10.200.0.0 -subnet 255.255.255.0 -gw 10.200.0.2 dev eth0

I assummed that: all the requests from net 10.200.xxx and "ping" to 10.200.xxx will go though the gw 10.200.0.2
But, I assumed bad, because it didn't work.

So what am i missing ??

Thanks for your time and help.

sergiomc

PS: Sorry for my poor english, i speak spanish. :study:

Mr. C. 08-17-2008 02:00 PM

You don't need to add another route - the correct routes are established for the attached network when you bring the interface up.

You need to enable tcp routing on the system:

cat /proc/sys/net/ipv4/ip_forward

if 0, it needs to be 1:

echo 1 > /proc/sys/net/ipv4/ip_forward

If you have iptables enabled, you may need to make changes. The easiest way to get routing to work is to first disable all firewalls, make routing work, and then reable firewalls adding the correct rules.

For ping to work, ensure each system has not disabled ICMP ping:

cat /proc/sys/net/ipv4/icmp_echo_ignore_all

should be 0. If 1, set to 0 using a similar echo command as above.

If you still have trouble, should output of:

route -n
ifconfig -a
cat /proc/sys/net/ipv4/icmp_echo_ignore_all
cat /proc/sys/net/ipv4/ip_forward

sergiomc 08-17-2008 09:25 PM

Thanks for your answer Mr. C.
I will try
echo 1 > /proc/sys/net/ipv4/ip_forward

I think I didn't do it in the tests.

iptables is not enabled in the server and in the client pc (windows), firewall is disabled.

I'll do the tests and let you know if any happens.

Thanks.

sergiomc


All times are GMT -5. The time now is 09:28 AM.