Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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 192.168.1.1
In machine D
---------------------
route add default gw 192.168.0.1
In machine B(gateway)
---------------------------------
route add -net 192.168.0.0 netmask 255.255.255.0 dev eth0
In machine C(another gateway)
-------------------------------------------
route add 192.168.1.1 dev eth0
route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0
----- After this I am able to connect from one network to another.
One of my friend said that This is not the correct way of routing.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 help me.And explain it.Any routing guides are there?.
Last edited by palanisaravanan; 04-12-2004 at 06:04 AM.
The problem with your setup is that you only configure two networks while the actual setup has three networks.
A & B are on one network say 192.168.1.0/24
B & C are on another network, your backbone. Call it 192.168.0.0/24
C & D are on the third network. 192.168.2.0/24
There can't be two networks using the same IP network as in your configuration.
The network you forgot is the one that B & C share.
On B you say that B is directly connected to network 192.168.0.0 network, but on C you say that the same network is 192.168.1.0, provided that both B & C use eth0 to connect to the other gateway.
Let say your setup is like this:
A (192.168.1.2) - (192.168.1.1)eth1 B (192.168.0.1)eth0 - (192.168.0.2)eth0 C (192.168.2.1)eth1 - (192.168.2.2) C
Then you setup for the various machines would be:
A
route add default gw 192.168.1.1
route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0
B
route add -net 192.168.0.0 netmask 255.255.255.0 dev eth0
route add -net 192.168.1.0 netmask 255.255.255.0 dev eth1
route add -net 192.168.2.0 netmask 255.255.255.0 dev eth0 gw 192.168.0.2
C
route add -net 192.168.0.0 netmask 255.255.255.0 dev eth0
route add -net 192.168.2.0 netmask 255.255.255.0 dev eth1
route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0 gw 192.168.0.1
D
route add default gw 192.168.2.1
route add -net 192.168.2.0 netmask 255.255.255.0 dev eth0
This should work. Some of the work may already be done at your computers by their network startup scripts.
Probably you will only have to add the route add -net 192.***** gw 192.168.0*** lines to B & C.
[QUOTE]Originally posted by ugge The problem with your setup is that you only configure two networks while the actual setup has three networks.
A & B are on one network say 192.168.1.0/24
B & C are on another network, your backbone. Call it 192.168.0.0/24
C & D are on the third network. 192.168.2.0/24
There can't be two networks using the same IP network as in your configuration.
The network you forgot is the one that B & C share.
On B you say that B is directly connected to network 192.168.0.0 network, but on C you say that the same network is 192.168.1.0, provided that both B & C use eth0 to connect to the other gateway. [/QUOTE
What u r meaning by saying "There can't be two networks using the same IP network as in your configuration."
In my case A and B are in 192.168.1.0/24 network
C and D are in 192.168.0.0/24 network.
How u r saying they are using the same IP network
Both B and C have two NICs, right?
The two cards need to be connected to different networks, that is different IP networks, like 192.168.0.0 and 192.168.1.0 for example.
That way if you count your networks, you need three as I mentioned earlier.
Originally posted by ugge Both B and C have two NICs, right?
The two cards need to be connected to different networks, that is different IP networks, like 192.168.0.0 and 192.168.1.0 for example.
That way if you count your networks, you need three as I mentioned earlier.
yes exactly!What u said is correct.My gateways have got two NIC's.But the gateways also not in the same IP network.Putting it simply I don't have 3 networks.IT is 4 networks.
A eth0 -192.168.1.2
B -eth0 -192.168.1.1/24
eth1 -172.16.1.1/255.255.0.0
Well, then you have to tweak the configuration for B & C accordingly.
For B that would be
[b]route add -net 192.168.0.0 netmask 255.255.255.0 dev eth1 gw <gateway of 172.16.1.0 network>
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.