LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Network routing question (http://www.linuxquestions.org/questions/linux-newbie-8/network-routing-question-621372/)

uncle-c 02-15-2008 09:42 AM

Network routing question
 
Hello folks,
I've been reading up on routing and creating networks and was wondering if someone could kindly explain something.
Below is the network layout :

http://i27.tinypic.com/x4q4ok.jpg

From the machines 192.168.30.2/3/4 the route to the wireless network is configured by the following command
Code:

$ route add -net 192.168.29.0 netmask 255.255.255.0 gw 192.168.30.20
Why isn't the gateway 192.168.29.1 ? The answer would definitely help me understand some concepts a lot more clearly !

Thanks !
UC

anomie 02-15-2008 09:51 AM

Quote:

Originally Posted by uncle-c
From the machines 192.168.30.2/3/4 the route to the wireless network is configured by the following command
Code:

$ route add -net 192.168.29.0 netmask 255.255.255.0 gw 192.168.30.20
Why isn't the gateway 192.168.29.1 ?

Because the 192.168.30.* subnet only needs to know how to get to its gateway/router (and the router decides how to get requests to the next network, which happens to be 192.168.29.* in this case). There is no 192.168.29.1 gateway on the first network; they're two different networks.

uncle-c 02-15-2008 10:00 AM

Thanks for the swiftest of replies anomie.
So the command to configure routing from the wireless laptops to either of 192.168.30.2/3/4 would be :

Code:

$ route add -net 192.168.30.0 netmask 255.255.255.0 gw 192.168.29.1
?

Thanks again !
uc

paragkalra 02-15-2008 10:06 AM

Your subnet mask is 255.255.255.0, which means 192.168.29.0 & 192.168.30.0 are two different networks and hence packets from 192.168.29.0 needs to be transfered through a gateway/router to reach to 192.168.30.0

You need to under stand the working of gateway:

This route has been added to enable communication between these two different networks.

When gateway receives packet from 192.168.29.0 network it checks for destination network and since destination network is different from the the source network it then checks for other lancard and hence for the other network. If it founds one (which is also true in your case) then those packets are transfered to the destined network.

If your subnet mask would have been 255.255.0.0 then the two networks would have been same in that case gateway won't check for other network and hence no need to add the route.

uncle-c 02-15-2008 10:22 AM

Thanks a lot guys. The explanations helped !

Cheers,
UC


All times are GMT -5. The time now is 02:13 PM.