LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 04-12-2004, 05:59 AM   #1
palanisaravanan
Member
 
Registered: Oct 2003
Location: India
Distribution: Debian
Posts: 95

Rep: Reputation: 15
A routing question


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


192.168.1.2/24

A ---------------------------------------------------> B
192.168.1.1/24 (Gateway)


192.168.0.2/24
D------------------------------------------------------->C
192.168.0.1/24 (Gateway)


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 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.
 
Old 04-12-2004, 08:09 AM   #2
ugge
Senior Member
 
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028

Rep: Reputation: 45
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.
 
Old 04-12-2004, 08:28 AM   #3
ugge
Senior Member
 
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028

Rep: Reputation: 45
Had to leave the computer for a brief moment.

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.
 
Old 04-12-2004, 10:52 AM   #4
palanisaravanan
Member
 
Registered: Oct 2003
Location: India
Distribution: Debian
Posts: 95

Original Poster
Rep: Reputation: 15
[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
 
Old 04-12-2004, 10:59 AM   #5
ugge
Senior Member
 
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028

Rep: Reputation: 45
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.
 
Old 04-12-2004, 11:35 AM   #6
palanisaravanan
Member
 
Registered: Oct 2003
Location: India
Distribution: Debian
Posts: 95

Original Poster
Rep: Reputation: 15
Quote:
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

C- eth0 -192.168.0.1/24
eth1-172.17.5.5/255.255..0.0

D- eth0 192.168.0.2

Here only I have routing problem
 
Old 04-12-2004, 12:36 PM   #7
ugge
Senior Member
 
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028

Rep: Reputation: 45
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>
 
Old 04-12-2004, 12:45 PM   #8
palanisaravanan
Member
 
Registered: Oct 2003
Location: India
Distribution: Debian
Posts: 95

Original Poster
Rep: Reputation: 15
fine.
 
  


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 question jeffvph Linux - Networking 2 11-07-2005 07:14 PM
routing question jeffvph Linux - Networking 9 07-24-2005 07:09 PM
routing question hsegtreas Linux - Networking 2 08-28-2004 05:19 PM
routing question gubak Linux - Newbie 1 07-23-2004 02:41 AM
Routing Question brokenflea Linux - Networking 2 12-05-2003 03:15 PM

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

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