LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-15-2006, 03:09 PM   #1
>G<
LQ Newbie
 
Registered: Jun 2006
Posts: 26

Rep: Reputation: 15
Route


Can someone explain to me what route is and what is the purpose of using it? Also what is a routing table?
 
Old 06-15-2006, 03:30 PM   #2
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 60
Routing is just the concept of the internet and many networks that basically provides the means of discovering paths along which information can be sent.

Long and short of it and in lamens terms, its a map for your network telling it how the data transmitted is to travel on the roads on the map.

So with that said, the purpose is if it didn't exist your internet traffic wouldn't know what to do, in turn you would have internet It (the data) would get lost on the roads on the map :P
 
Old 06-15-2006, 03:45 PM   #3
>G<
LQ Newbie
 
Registered: Jun 2006
Posts: 26

Original Poster
Rep: Reputation: 15
DrOzz,

Thanks. I still don't understand how I am meant to use it e.g. to access the Internet as well as on a LAN. Secondly what does the route table represent? For example noted below is my route table.

Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 10.69.88.1 10.69.90.28 20
10.69.88.0 255.255.252.0 10.69.90.28 10.69.90.28 20
10.69.90.28 255.255.255.255 127.0.0.1 127.0.0.1 20

Default Gateway: 10.69.88.1

What does the route table represent when it categorizes Destination, Netmask, Gateway and Interface and also how do I use this information?
 
Old 06-18-2006, 03:15 PM   #4
>G<
LQ Newbie
 
Registered: Jun 2006
Posts: 26

Original Poster
Rep: Reputation: 15
Can anyone help?
 
Old 06-18-2006, 04:04 PM   #5
vimal
Red Hat India
 
Registered: Nov 2004
Location: Kerala/Pune,india
Distribution: RedHat, Fedora
Posts: 260

Rep: Reputation: 36
Hello >G<,

That was a nice question for you to ask. As our senior member said, its just a path for the data to travel onto other networks. To say it more clearly, a routing table specifies the way by which your local computers send their data packets onto an outer network. Your routing table represent the information regarding your network and its available routes. It depicts the network, the gateway by which the data travel for a particular network, its netmask etc... If you have more than one network connection to the outer world through your local machine, you can see the ips of the gateways configured here. If you have any problems understanding the basics, please reply...


Thanks,,,
 
Old 06-18-2006, 05:31 PM   #6
>G<
LQ Newbie
 
Registered: Jun 2006
Posts: 26

Original Poster
Rep: Reputation: 15
Vimal,

Thanks for your reply. To summarise what you said.

1) It provides a “map” for the host PC in the manner the data should travel to other PCs’ on the network as well as external networks such as the Internet

2) In the instance there is more than one gateway on the host PC, this is reflected on the route table

3) The route table only represents a ‘map’ for the host PC and has no other function

Based on the assumption my summary of your reply is correct, I have the following questions

1) Is there a reason as to why a user would want to add/amend/delete a route?

2) Why would a user want to add/amend/delete a route when the gateway has already been specified in their system configuration?
 
Old 06-18-2006, 05:55 PM   #7
vimal
Red Hat India
 
Registered: Nov 2004
Location: Kerala/Pune,india
Distribution: RedHat, Fedora
Posts: 260

Rep: Reputation: 36
Hello >G<,

At any time, a machine in a network would use a single gateway to transfer its data to the outer network. This is depicted as the 'default gateway'. Adding routes or entries into the routing table can only be carried out by the root user. The system configuration for 'route' must be changed when you are setting up a LAN. Each machine in your network should be told of the default gateway it has to use, to connect to the outside world. Also if you have more than one gateway in your LAN and if one connection goes down, you will need to change the machine's route configuration so as to divert the packets to reach the destination. Many a reason may exist for changing a route in a local machine, it all depends on the network scenario.. I hope you got the point. Reply in case of need ......

Thanks..
 
Old 06-18-2006, 06:15 PM   #8
>G<
LQ Newbie
 
Registered: Jun 2006
Posts: 26

Original Poster
Rep: Reputation: 15
Vimal,

Basically what you mean is the route table is used to identify if the host PC has more than one path (route) to send its data. Is this correct?
 
Old 06-18-2006, 06:48 PM   #9
vimal
Red Hat India
 
Registered: Nov 2004
Location: Kerala/Pune,india
Distribution: RedHat, Fedora
Posts: 260

Rep: Reputation: 36
Hello >G<,

The word 'route' has it all. If you have a LAN and you want to connect to the internet, you would only connect one machine to the net and share the connection within the LAN. That specific machine would be the gateway for the LAN machines. Also if you are connecting to more than one ISPs, you can configure them in the same machine but through different interfaces. In this case even if the gateway is physically a single machine, we have more than one route to the internet... ie.. through the different interfaces..

Thanks..
 
Old 06-18-2006, 11:23 PM   #10
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by >G<
Vimal,

Basically what you mean is the route table is used to identify if the host PC has more than one path (route) to send its data. Is this correct?
Yes. You are probably thinking of using two ISPs to access the internet or something (i.e., both routes provide you with the same information). While it can be used for this (not easily), that's not what he meant. The routing table may specify where to find different networks. For example, a computer may have one place where it looks for a private network, and another place where it looks for the internet. Routing tables are used often in subnetted offices.

To keep life easy for the clients, usually DHCP only supplies one `router'. That one router, however, probably has many routes. For example, let's say I have the ip 192.168.1.4. If I want to talk to 192.168.1.3, this is what I try:

First, I look myself (i.e., see if such a machine exists on the hub). This is where that machine is. If it weren't, I'd ask the router.

What if I want to talk to 192.168.3.5?

I ask my DHCP-supplied router, named 192.168.1.1. This router has a route that says for all machines on the 192.168.5.0/24 network, ask the machine at 192.168.5.1. This is one of the routes.

What if I want to talk to 64.179.4.146?

Again, I ask my router, named 192.168.1.1. The router knows this is an internet address, and it looks through a different route (the ISP's router). The ISP's router probably gets more and more high-level (maybe even switches to a different ISP), and then more and more low-level, until the network is finally found.

So one machine has multiple routes, each of which depend on the destination address. To learn more about how to see a routing path, look up information on `traceroute'. If you want to look at how large-scale internet routing works, look up the Border Gateway Protocol (note, the net was not always `decentralized').
 
Old 06-20-2006, 03:29 PM   #11
>G<
LQ Newbie
 
Registered: Jun 2006
Posts: 26

Original Poster
Rep: Reputation: 15
osor,

Thanks for your reply. I'm utterly confused now. Are you suggesting routes is for finding networks? If so is that what a route table specifies i.e. routes for different networks? Assuming that is true, why would one add/amend routes? Can this not be achieved via a router/switch e.g. Assuming I am on network 192.168.1 and I want to get onto network 192.168.2. I'm sorry but I just want to get a clear understanding of what route exactly does and the purpose of route tables. Thanks for all your help.
 
Old 06-20-2006, 08:14 PM   #12
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by >G<
osor,

Thanks for your reply. I'm utterly confused now. Are you suggesting routes is for finding networks? If so is that what a route table specifies i.e. routes for different networks? Assuming that is true, why would one add/amend routes? Can this not be achieved via a router/switch e.g. Assuming I am on network 192.168.1 and I want to get onto network 192.168.2. I'm sorry but I just want to get a clear understanding of what route exactly does and the purpose of route tables. Thanks for all your help.
Different routes are for finding different networks (or rather, specifying how to get to a certain computer based on the network on which it resides). The routing table specifies the `route' to use to reach a specific network. If you look at the output of the route command, you see a Destination field and a Netmask field (it would be helpful if these were next to each other) that together describe a network. Then there is a `Gateway' specified that shows the machine you need to ask if you want to reach the network.

At least one of your Gateway fields must be (depending on your version of route or the flags used) either 0.0.0.0 or *. What this means is that to find a computer on the specified network, look only on the local `wire' (for ethernet, this is usually done with ARP).

Another thing to keep in mind is that the gateways specified must first have a way to be reached. So at least one of your gateways must be on the `wire'.

Why would one want to add/ammend routes? For fun ... Actually, in most default setups, the routing table does not need to be modified at all. The usual computers on which special routes are created are usually routers (go figure). Then, all machines on that router's wire use it as the default route. That way, all the complexity of a routing decision disappears from the view of the clients.

A lot of cool stuff can be done with routing tables. Since it is not often feasible to do experiments with large networks, there are people who made an easier way. The Netkit project provides a way to simulate/test network setups (using virtual machines). It is a really great diagnostic (and learning) tool .

Last edited by osor; 06-20-2006 at 08:25 PM.
 
Old 06-20-2006, 08:52 PM   #13
>G<
LQ Newbie
 
Registered: Jun 2006
Posts: 26

Original Poster
Rep: Reputation: 15
Osor,

Thanks for your reply. Correct me if I am wrong or have misinterpreted what you said

- route specifies how to find a network
- the route table outlines the various paths a PC can take to reach a network
- I would add/amend routes to specify one or more paths a PC can use

Based on the assumption I have understood what you have said, how would I know which route to add/amend? What situations would require me to add/amend routes/paths?

Also having checked my route table, none of my gateways has the value 0.0.0.0 or *
 
Old 06-20-2006, 09:59 PM   #14
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by >G<
Also having checked my route table, none of my gateways has the value 0.0.0.0 or *
In that case, I would ask you to (assuming linux 2.6) print the results of `cat /proc/net/route' (please use code tags, as it is easier to read). Also, can you do a `route -V' and give the output.

According to an earlier post, your route command produced the following:
Code:
Network Destination          Netmask          Gateway       Interface  Metric
            0.0.0.0          0.0.0.0       10.69.88.1     10.69.90.28      20
         10.69.88.0    255.255.252.0      10.69.90.28     10.69.90.28      20
        10.69.90.28  255.255.255.255        127.0.0.1       127.0.0.1      20
Basically, this says (starting from bottom up):
  • If the loopback interface is trying to reach the machine 10.69.90.28 (presumably your actual interface) it should consult itself (i.e., to get from one interface to another. this is usually implied and not stated in the routing table.).
  • To reach any computer on the 10.69.88.0/22 network, look on the wire of the interface with the address 10.69.90.28 (this is where, in all my machines with various distros, the gateway is denoted as 0.0.0.0 meaning the wire. I guess this is not universal as I thought it was.).
  • To reach any machine (with any ip address), ask the machine at 10.69.88.1.
Thus, the 10.69.88.1 is your default route. CNP.

Last edited by osor; 06-20-2006 at 10:12 PM.
 
Old 06-20-2006, 10:45 PM   #15
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by >G<
Osor,

Thanks for your reply. Correct me if I am wrong or have misinterpreted what you said

- route specifies how to find a network
- the route table outlines the various paths a PC can take to reach a network
- I would add/amend routes to specify one or more paths a PC can use

Based on the assumption I have understood what you have said, how would I know which route to add/amend? What situations would require me to add/amend routes/paths?

Also having checked my route table, none of my gateways has the value 0.0.0.0 or *
  • Yes (if you consider a single computer as a network with a full netmask).
  • Yes (kind of). It doesn't really specify a path to the destination. It specifies the `next hop' (i.e., what computer to ask for a connection with the destination. the computer at that end presumably has its own `next hop'. The `next hop' idea continues until a path is found. Although it is possible to specify/query more complete routes using RIP and stuff, this is beyond the basic routing table).
  • Yes.

The kind of situations in which routing tables get advanced varies. For example, consider the `next hop' idea, and imagine if an endless loop is created. While the Internet Protocol has safeguards against this (TTL), this is an example of misconfigured routes. In that case, a quick and dirty fix would be to manually specify the route on the affected machine(s).

Another more real-life scenario: using your previous information, consider the routing table on your `default route' (the machine with ip 10.69.88.1). Now let's postulate that this router is for your workplace's office and has three separate network interfaces. The interface called lan0 is connected to a switch that is connected to your network (10.69.88.0/22). It also has another interface lan1 which is connects to a switch that connects the routers for four other offices of the same workplace (each of these is configured similarly). An ipaddr of 10.69.88.1 is shared by lan0 and lan1 (they're bridged). There is also an internet interface called wan0 (each office has its own public ip, and its own separate connection to the internet) with ipaddr 64.179.4.146. The routing table would probably look something like this (trying to use the format of your `route' command):

Code:
Network Destination          Netmask          Gateway       Interface  Metric
            0.0.0.0          0.0.0.0       64.179.4.1            wan0      20
         10.69.80.0    255.255.252.0       10.69.80.1            lan1      20
         10.69.84.0    255.255.252.0       10.69.84.1            lan1      20
         10.69.92.0    255.255.252.0       10.69.92.1            lan1      20
         10.69.88.0    255.255.252.0       10.69.88.1            lan0      20
         10.69.88.1  255.255.255.255        127.0.0.1              lo      20
As you can see, the admins decided to dedicate the block 10.69.80.0/20 for the entire workplace network (four offices). The routing tables allow communication between hosts in different offices (whether the firewall rules do is a whole different ball game), even though the entire workplace is not on one big switch (the offices might even be in different locations -- lan1 might be a virtual interface created by VPN).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
I am not able to add a new route to my route table using route command prashanth s j Linux - Networking 2 09-03-2005 04:34 AM
if a route fails in a multipath route? eantoranz Linux - Networking 5 07-03-2005 02:03 PM
Route to subnet exists but I get "Network unreachable" when adding default route fciuffani Linux - Networking 4 08-18-2004 02:11 PM
ADSL as a Alternate route or backup route bhagat2000 Linux - Networking 0 05-27-2004 03:17 PM
Working with 'route' and unwanted route entries pioniere Linux - Networking 6 02-05-2003 12:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:20 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