I have two machines A,B in different networks
A ----->
I want to access one from the other.For this I havae creaed a static route for machine A in machine B.

In Machine  B
route add dev eth0
route add -net netmask gw

In machine A
route add -net netmask dev eth0
Now I am able to connect from one to other.

Is there any other way to accomplish my task apart from static route?
Basically i want to connect to other network without using static route concept.How to do that?.
Who is Participating?

Improve company productivity with a Business Account.Sign Up

greg14unixConnect With a Mentor Commented:
The quick way to get this done is by runnig routed on the gateway host ( B, C ) and set the gateway on the outside host ( A, D ) to point to the host you are using as gateways.  Routed will enable the routing damon on the systems and start using RIP as its routing protocol.  Routed should detect the two networks it is connected to and route packets between it and the other routers( the other gateway host running routed ) runnig the RIP routing protocol.  Also, routed should automatically exchange routing info between the two host, giving you dynamic routing tables instead of the static setup you currently have.  

Hope this help :)
palanisaravananAuthor Commented:
I enabled IP forwardin in both the sides.There is no filre wall b/w the networks
What you have done is not clean at all :-))))

You force routes that should not be forced this way. So, there is no good method for doing this appart from static.

You could change the netmask on all the boxes from both networks to This way, you would not have to do routing.

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Are you trying to have one of these systems act as a gateway router between it's network and the other network?
Sorry, that "it's" is supposed to be "its".
palanisaravananAuthor Commented:
Yes exactly karwilbur.sorry for the misunderstanding in my question.I will explain it briefly.

My network is like this

I  have 4 Linux machines(Debian woody) A,B,C.
A and B are in same network.( )
C and D  are in diffrent network.(

       A  ------------------> B                                            C <----------------------D      |                                              |               
B and C are configures as gateways.

For A   , machine B is the default gateway.
For D ,   machine  C is the default gateway.
    Now I want to connect From machine A to Machine D and vice versa using their respective gateways(B and C).
                   MY routing is like this
In machine A
     route add    default gw
In machine D
  route add default gw
 In machine B(gateway)
route add -net netmask dev eth0

In machine C(another gateway)
      route add dev eth0
       route add -net netmask dev eth0

    -----  After this I am able to connect from one network to another.
  One of my friend said that These two networks are not physically separarted.By routing only I separated the network.He said another way of routing is there.I searched on net.But didn't get any ideas.Can Any network guruz  help me.
Sorry for the delay in posting

As I said, this is not clean at all.

If you want to avoid static route, and all your boxes are on the same network, just change the subnet mask.

Choose This way, all your boxes will be on the same "network", and you will not have to route.
palanisaravananAuthor Commented:
Let us forget the word static route in my thread starter.
How to route in the above mentioned scenario?.
You mention in your post that you did achieve to route the packets. So that is the first way of doing routing which is correct. Yes this is static because if there is any change in the network you will have to manually change the settings.

If you want that the router should learn of any change in the network and update its tables accordingly, then you should use any of the routing protocols. The simples that should fit for your needs is RIP. Here is what you will need to do.

Type the command "routed" in a terminal window on all the computers. The computers will then communicate and build the routing table. You can provide a default route for the host machines seprately if you wish.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.