UNIX Routing Tables


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers UNIX Routing Tables
# 8  
Old 11-14-2015
The phrase "which processes were addded to each route" makes little sense. Maybe if there was just a bit more context??
# 9  
Old 11-14-2015
Lets take a different route (sorry for the pun), but we need some clarifications first:

What is a "network"?

Todays hardware with its switched concoctions blurs this fact, but historically networks were (and conceptionally still are) a long wire with many computers connected to it:

Code:
      +---+     +---+     +---+     +---+
      |   |     |   |     |   |     |   |  
      +---+     +---+     +---+     +---+  
        |         |         |         |
<<------------------------------------------>>

Internetworking and Routing

All the computers on this wire "see" each other automatically, so there is no routing involved. Networks can only grow so large and if you want to connect a bigger number of computers you will have to connect different networks. A device that does that is a router:

Code:
      +---+     +---+     +---+     +---+
      | a |     | a |     | a |     | a |
      +---+     +---+     +---+     +---+
        |         |         |         |
<<------------------------------------------>>   network A
        |
        |
      +---+     +---+     +---+     +---+
      | R |     | b |     | b |     | b |
      +---+     +---+     +---+     +---+  
        |         |         |         |
<<------------------------------------------>>   network B

Before you ask: not every computer connected to more than one network is a router, but every router needs to be connected to more than one network. To make it a router it has to have "IP-forwarding" switched on, but that is only corollary for this here.

Why routing?

Say, you want to send some information in the diagram above from the rightmost system in network A to the rightmost system in network B. The information has to pass through the router "R", which will relay it from network A to network B. You could tell the station in network A how to do that (actually in historical network systems like Token Ring this was done, it was called "Source Routing Protocol", SRP), but then you would need to tell the same to all the other stations in network A too, otherwise they would still not know how to do it. You would also need to do this over and over for the all the stations in B separately.

The easier way is: The router itself is configured to know which station is where and how to pass information from network A to network B and vice versa. The only thing a client on network A will need to know is: if you want to send information to netwrok B, then send it to the router and it will take care of it.

The routing table
Coming back to your original problem: the routing table. It is a set of rules where to send a specific packet.Lets have a look at a more complex situation and see if we could formulate a ruleset:

Code:
      +---+     +---+     +---+     +---+
      | a |     | a |     | a |     | a |
      +---+     +---+     +---+     +---+
        |         |         |         |
<<------------------------------------------>>   network A
        |
        |
      +---+     +---+     +---+     +---+
      | R |     | b |     | b |     | b |
      +---+     +---+     +---+     +---+  
        |         |         |         |
<<------------------------------------------>>   network B
                     | - en0
                   +---+     
                   | X |     
                   +---+     
                     | - en1
<<------------------------------------------>>   network C
                  |         |         |
                +---+     +---+     +---+
                | c |     | c |     | R |
                +---+     +---+     +---+
                                      |
<<------------------------------------------>>   network D
                      |
                    +---+     
                    | d |     
                    +---+

We have network A and B connected via a router. There is also networks C and D, also connected via a router. Then we have system X, which participates in network B and C. Now we create the rules necessary for X to send packets everywhere.

1) Everything destined for network B should use interface en0
2) Everything destined for network C should use interface en1
3) Everything destined for network A should go to R on network B (R will know how to further deal with it)
4) Everything destined for network D should go to R on network C (R will know how to further deal with it)

Because the routers are (also) part of the adjacent networks they themselves can be reached exercising rules 1 and 2.

A routing table consists of such rules: each rule specifies a destination (either a network or a single system) and a "gateway" through which this network or system can be reached. A gateway is either one of your own interfaces or some IP-address representing a certain interface on the net.

Notice that for a rule to work the system needs to know (from previous rules) how to get to the specified gateway. It is a common error to specify the wrong interface. In the above diagram specifying the interface in network D (instead of the one in network C) of the router R as the gateway to network D will not work because to contact this interface (which is already in D) you'd first have to get there.

Lastly, what is the "default route"? This is the rule of last resort and often the only one necessary. If no other rules are applicable this one is exercised. Let us finally modify our diagram a last time:


Code:
      +---+     +---+     +---+     +---+
      | a |     | a |     | a |     | a |
      +---+     +---+     +---+     +---+
        |         |         |         |
<<------------------------------------------>>   network A
        |
        |
      +---+     +---+     +---+     +---+
      | R |     | b |     | b |     | b |
      +---+     +---+     +---+     +---+  
        |         |         |         |
<<------------------------------------------>>   network B
                     | - en0
                   +---+     
                   | X |     
                   +---+     
                     | - en1
<<------------------------------------------>>   network C
                  |         |         |
                +---+     +---+     +---+
                | c |     | c |     | R | ----> internet (=everything else)
                +---+     +---+     +---+
                                      |
<<------------------------------------------>>   network D
                      |
                    +---+     
                    | d |     
                    +---+

The router in network C/D has also a connection to the rest of (all) the networks. A packet with destination "network F" will now go to this router and hopefully it will be able to make sense of it.

In most cases this defaultroute is the only one necessary because the situation looks like this:

Code:
                                    +---+
                                    | R | ----> internet (=everthing else)
                                    +---+
                                      |
<<------------------------------------------>>   (home) network
                      |
                    +---+     
                    |   |     
                    +---+

There are only two rules necessary:

1) send everything destined to the home network to your single interface.
2) send everything not on your home network to the router

Because there are no other rules necessary the last one could also be the "default route".

I hope this helps.

bakunin

Last edited by bakunin; 11-14-2015 at 01:52 AM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

Unable to send attachment with html tables in UNIX shell script

Heyy, any help would be grateful.... LOOKING FOR THE WAYS TO SEND AN EMAIL WITH ATTACHMENT & HTML TABLES IN BODY THROUGH SHELL SCRIPT (LINUX)..NOT SURE, IF WE HAVE ANY INBUILT HTML TAG OR UNIX COMMAND TO SEND THE ATTACHMENTS. KINDLY HELP below is small script posted for our understanding..... (2 Replies)
Discussion started by: Harsha Vardhan
2 Replies

2. Shell Programming and Scripting

How to use V$tables in UNIX shell script?

Hi All, In my script I have used the below code to retrieve the instance name V_INSTANCE_NAME=`sqlplus -s ${APPS_USR_PSWD} <<+ set pagesize 0 linesize 256 feedback off verify off head off echo off set serveroutput off select... (2 Replies)
Discussion started by: kalidoss
2 Replies

3. Shell Programming and Scripting

Howto compare the columns of 2 diff tables of 2 different schemas in UNIX shell script

HI All, I am new to Unix shell scripts.. Could you please post the unix shell script for for the below request., There are two different tables(sample1, sample2) in different schemas(s_schema1, s_schema2). Unix shell script to compare the columns of two different tables of two... (2 Replies)
Discussion started by: Rajkumar Gopal
2 Replies

4. UNIX for Advanced & Expert Users

HELP me please. UNIX Routing

Hello everybody, I need help: I have to make routing between two different LAN. I have the IP for first network 81.180.75.70 and the mask is 255.255.255.192 and for the second network: 192.168.1.1 and the mask 255.255.255.0 So, each network has only one PC with windows (this is for test),... (11 Replies)
Discussion started by: meorfi
11 Replies

5. UNIX for Dummies Questions & Answers

HELP me please. UNIX Routing

Hello everybody, I need help: I have to make routing between two different LAN. I have the IP for first network 81.180.75.70 and the mask is 255.255.255.192 and for the second network: 192.168.1.1 and the mask 255.255.255.0 So, each network has only one PC with windows (this is for test),... (0 Replies)
Discussion started by: meorfi
0 Replies

6. Shell Programming and Scripting

Converting tables of row data into columns of tables

I am trying to transpose tables listed in the format into format. Any help would be greatly appreciated. Input: test_data_1 1 2 90% 4 3 91% 5 4 90% 6 5 90% 9 6 90% test_data_2 3 5 92% 5 4 92% 7 3 93% 9 2 92% 1 1 92% ... Output:... (7 Replies)
Discussion started by: justthisguy
7 Replies

7. UNIX for Dummies Questions & Answers

Routing tables

Hey guys, I needed to add a route to my routing table and I got it to work but on reboot it gets removed. Anyone know what file I can add this route to so it stays on the machine after a reboot? (9 Replies)
Discussion started by: kingdbag
9 Replies

8. IP Networking

any system call in unix to access ip routing table

hi is there any system call by which ip routing table can be accessed. (1 Reply)
Discussion started by: vinodkumar
1 Replies

9. UNIX for Advanced & Expert Users

writing database tables into a file in unix

I want to collect the database tables(Ex: Emp,Sal,Bonus...etc) in a file & give this file at the command prompt, when prompted for the tables list at command prompt. How can i do that ? Ex:- Import jason/jason1 tables=emp,sal,bonus log=j1.log i want to change this into Ex:- Import... (3 Replies)
Discussion started by: dreams5617
3 Replies

10. UNIX for Dummies Questions & Answers

Routing DSL to Unix from Windows

I'm brand new to this forum AND Unix. For obvious reasons. I don't know much at all. I'm 14 and i just got my first UNIX SPARCstation5 SUN computer. Something like that. i set up Solaris 9.1(With the help from my dad), now that i've gotten pertty much everything settled, i would like to route my... (8 Replies)
Discussion started by: SoulCheese
8 Replies
Login or Register to Ask a Question