LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-15-2008, 09:42 AM   #1
uncle-c
Member
 
Registered: Oct 2006
Location: The Ether
Distribution: Ubuntu 16.04.7 LTS, Kali, MX Linux with i3WM
Posts: 299

Rep: Reputation: 30
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
 
Old 02-15-2008, 09:51 AM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
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.
 
Old 02-15-2008, 10:00 AM   #3
uncle-c
Member
 
Registered: Oct 2006
Location: The Ether
Distribution: Ubuntu 16.04.7 LTS, Kali, MX Linux with i3WM
Posts: 299

Original Poster
Rep: Reputation: 30
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
 
Old 02-15-2008, 10:06 AM   #4
paragkalra
Member
 
Registered: Sep 2006
Location: Nagpur, Maharashtra, India
Distribution: Debian, Ubuntu, Redhat, Fedora, SLES, OpenSUSE, FreeBSD, Mac OS X
Posts: 221

Rep: Reputation: 31
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.
 
Old 02-15-2008, 10:22 AM   #5
uncle-c
Member
 
Registered: Oct 2006
Location: The Ether
Distribution: Ubuntu 16.04.7 LTS, Kali, MX Linux with i3WM
Posts: 299

Original Poster
Rep: Reputation: 30
Thanks a lot guys. The explanations helped !

Cheers,
UC
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Routing between two network satishap Linux - Networking 1 12-12-2007 01:14 AM
Network Routing omid1979 Linux - Networking 0 11-15-2004 09:26 AM
[help] RH Network Routing Policy princenux Linux - Networking 1 07-04-2004 10:34 AM
2 network cards, 2 network connections - routing problem tvojvodi Linux - Networking 4 02-24-2004 03:26 PM
network/routing(?) problems jaleskin Linux - Networking 1 09-08-2003 11:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration