basic routing problem

This is a discussion on basic routing problem within the Linux Networking forums, part of the Linux Forums category; Hello, I have three debian machines and just for my experiments I want to configure static routing like that: Deb01 (...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-03-2006
mark
 
Posts: n/a
Default basic routing problem

Hello,

I have three debian machines and just for my experiments I want to
configure static routing like that:

Deb01 (10.0.1.1) --> (10.0.2.1) Deb02 (10.0.2.2) --> Deb03(10.0.3.1)

(i.e. packets from Deb01 goest to Deb03 through Deb03). I tried to set
up some route rules but with no success. Could you help me with that?
Thanks.

Regards, mark

Reply With Quote
  #2 (permalink)  
Old 10-03-2006
Robert Harris
 
Posts: n/a
Default Re: basic routing problem

mark wrote:
> Hello,
>
> I have three debian machines and just for my experiments I want to
> configure static routing like that:
>
> Deb01 (10.0.1.1) --> (10.0.2.1) Deb02 (10.0.2.2) --> Deb03(10.0.3.1)
>
> (i.e. packets from Deb01 goest to Deb03 through Deb03). I tried to set
> up some route rules but with no success. Could you help me with that?
> Thanks.
>
> Regards, mark
>

You will find your routing easier if your subnets have the top n many
bits in common, so use, for example:

Deb01 (10.0.1.2) --> (10.0.1.1) Deb02 (10.0.2.2) --> Deb03(10.0.2.1)

[conventionally gateways live at addresses ending .1]

Then your /etc/network/interfaces files should contain:

For Deb01:

iface eth0 inet static
address 10.0.1.2
netmask 255.255.255.0
gateway 10.0.1.1

For Deb02:

iface eth0 inet static
address 10.0.1.1
netmask 255.255.255.0

iface eth1 inet static
address 10.0.2.2
netmask 255.255.255.0
gateway 10.0.2.1

For Deb03:

iface eth0 inet static
address 10.0.2.1
netmask 255.255.0.0

Robert
Reply With Quote
  #3 (permalink)  
Old 10-03-2006
Moe Trin
 
Posts: n/a
Default Re: basic routing problem

On Tue, 03 Oct 2006, in the Usenet newsgroup comp.os.linux.networking, in
article <uusUg.28500$r61.8677@text.news.blueyonder.co.uk >, Robert Harris wrote:

>You will find your routing easier if your subnets have the top n many
>bits in common, so use, for example:
>
>Deb01 (10.0.1.2) --> (10.0.1.1) Deb02 (10.0.2.2) --> Deb03(10.0.2.1)


That arrangement is certainly better than the one that the O/P was using,
but I'd interchange 10.0.2.2 and 10.0.2.1 so that 10.0.x.1 is on the same
host.

>[conventionally gateways live at addresses ending .1]


Since when? (And that doesn't match your assignments, as the gateway for
Deb03 is 10.0.2.2). There is no requirement, convention, tradition, or
what-ever that the gateway be at any specific address. In fact, Red Hat
and some clones _used_ to configure their networks with the primary DNS
server on the lowest address on the network, and the default gateway on
the highest usable address - for a /24 or 255.255.255.0 mask, that would
be x.y.z.1 and x.y.z.254. But then, there is also no requirement,
convention, tradition, or what-ever about the address mask used on a
private (RFC1918) network. If you want to use a /8 (255.0.0.0) on a
10.0.0.0 network, or /12 (255.240.0.0) on a 172.16.0.0 network, or even
a /16 (255.255.0.0) on a 192.168.0.0 network, it's your network and
perfectly OK as long as all systems on that network are using the same
mask. You could also use a /29 (255.255.255.248) on a 10.20.30.40
network (that would be 10.20.30.40 to 10.20.30.48), if you wanted to
confuse a skript kiddie.

Old guy
Reply With Quote
  #4 (permalink)  
Old 10-03-2006
mark
 
Posts: n/a
Default Re: basic routing problem

Hello,

Unfortunately I cannot change these IP addresses (it is all about
topology generation and assigning them to virtual linuxes, so it won't
be so easy. The numeration goes like 10.0.host.port).
The specification you gave me doesn't work :(. I am trying with route
command but still no success... Could you help me out how to set these
routes for these three workstations so that I could understand it and
extend to more workstations).

Thank you in advance, mark

Reply With Quote
  #5 (permalink)  
Old 10-04-2006
Llanzlan Klazmon the 15th
 
Posts: n/a
Default Re: basic routing problem

"mark" <mkazmierski@gmail.com> wrote in news:1159909811.784976.178010
@e3g2000cwe.googlegroups.com:

> Hello,
>
> Unfortunately I cannot change these IP addresses (it is all about
> topology generation and assigning them to virtual linuxes, so it won't
> be so easy.


Then it cannot possibly work. In your original picture you had deb2 with
two different interfaces that had addresses in the same subnet that doesn't
make any sense at all unless both interfaces were physically connected to
the same Lan in which case the whole excercise is moot.

> The numeration goes like 10.0.host.port).


That would only work if all hosts are on the same Lan and the subnet
encompasses all possible values of 'host'. The the subnet would have to be
at least sixteen bits wide. ie. 10.0.0.0/16 (i.e mask 255.255.0.0)


> The specification you gave me doesn't work :(. I am trying with route
> command but still no success... Could you help me out how to set these
> routes for these three workstations so that I could understand it and
> extend to more workstations).


The bottom line is that devices can only talk directly to devices that are
in the same subnets - to get outside of that the local subnet you need a
route to a machine (gateway) that connects to a different subnet (or nets).

e.g

subnet1 10.0.1.0/24 (i.e an eight bit wide subnet, mask 255.255.255.0)
subnet2 10.0.2.0/24 (i.e an eight bit wide subnet, mask 255.255.255.0)

(PC1 10.0.1.1/24 ) -- (10.0.1.2/24 PC2 10.0.2.5/24) -- (10.0.2.20/24 PC3)

PC1 can talk to PC2 by virtue of subnet 10.0.1.0/24 being directly
connected to both. Ditto PC2 to PC3 with respect to subnet 10.0.2.0/24).
For PC1 to talk to PC3, You need to have a static route on PC1 that tells
it how to get to the subnet that PC3 lives on. There are two ways to do
this. You could have a route on PC1 like this:

route add to 10.0.2.20/24 via 10.0.1.2 protocol static

or

route add to 0.0.0.0/0 via 10.0.1.2 proctocol static

This second route is what is known as the default gateway. Basically
anything that PC1 doesn't know how to get to via a specific route is
handled by this catch all route.

Once the packet arrives at 10.0.1.2 (PC2), it already knows how to get to
PC3 because it is on a directly connected subnet. When PC3 gets the packet
and wants to respond to it, you now have the opposite problem - it needs a
route to tell it how to get back to PC1 i.e on PC3 you need a route like:

route add to 10.0.1.0/24 via 10.0.2.5 protocol static

Klazmon.





>
> Thank you in advance, mark
>
>


Reply With Quote
  #6 (permalink)  
Old 10-04-2006
Llanzlan Klazmon the 15th
 
Posts: n/a
Default Re: basic routing problem

Llanzlan Klazmon the 15th <Klazmon@llurdiaxorb.govt> wrote in
news:Xns98528E16FD3EFKlazmonllurdiaxorbgo@203.97.3 7.6:

> "mark" <mkazmierski@gmail.com> wrote in news:1159909811.784976.178010
> @e3g2000cwe.googlegroups.com:
>
>> Hello,
>>
>> Unfortunately I cannot change these IP addresses (it is all about
>> topology generation and assigning them to virtual linuxes, so it won't
>> be so easy.

>
> Then it cannot possibly work. In your original picture you had deb2 with
> two different interfaces that had addresses in the same subnet that
> doesn't make any sense at all unless both interfaces were physically
> connected to the same Lan in which case the whole excercise is moot.
>
>> The numeration goes like 10.0.host.port).

>
> That would only work if all hosts are on the same Lan and the subnet
> encompasses all possible values of 'host'. The the subnet would have to
> be at least sixteen bits wide. ie. 10.0.0.0/16 (i.e mask 255.255.0.0)
>
>
>> The specification you gave me doesn't work :(. I am trying with route
>> command but still no success... Could you help me out how to set these
>> routes for these three workstations so that I could understand it and
>> extend to more workstations).

>
> The bottom line is that devices can only talk directly to devices that
> are in the same subnets - to get outside of that the local subnet you
> need a route to a machine (gateway) that connects to a different subnet
> (or nets).
>
> e.g
>
> subnet1 10.0.1.0/24 (i.e an eight bit wide subnet, mask 255.255.255.0)
> subnet2 10.0.2.0/24 (i.e an eight bit wide subnet, mask 255.255.255.0)
>
> (PC1 10.0.1.1/24 ) -- (10.0.1.2/24 PC2 10.0.2.5/24) -- (10.0.2.20/24
> PC3)
>
> PC1 can talk to PC2 by virtue of subnet 10.0.1.0/24 being directly
> connected to both. Ditto PC2 to PC3 with respect to subnet 10.0.2.0/24).
> For PC1 to talk to PC3, You need to have a static route on PC1 that
> tells it how to get to the subnet that PC3 lives on. There are two ways
> to do this. You could have a route on PC1 like this:
>
> route add to 10.0.2.20/24 via 10.0.1.2 protocol static


Whoops - this might work but was meant to be:

route add to 10.0.2.0/24 via 10.0.1.2 protocol static

K.
<SNIP>
Reply With Quote
  #7 (permalink)  
Old 10-04-2006
Floyd L. Davidson
 
Posts: n/a
Default Re: basic routing problem

"mark" <mkazmierski@gmail.com> wrote:
>Hello,
>
>Unfortunately I cannot change these IP addresses (it is all about
>topology generation and assigning them to virtual linuxes, so it won't
>be so easy. The numeration goes like 10.0.host.port).


You need to have a *very* serious (knock 'em down, drag 'em out)
argument with whoever is setting that policy.

>The specification you gave me doesn't work :(. I am trying with route
>command but still no success... Could you help me out how to set these
>routes for these three workstations so that I could understand it and
>extend to more workstations).


As soon as you extend that subnetworking scheme to more
workstations, things become unbelievably compicated. The policy
needs changing, and the person setting it needs an education.

Two rules that you need to follow are:

1) All hosts on a *physical* network get IP addresses in
the same subnet.

2) See Item 1.

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@apaflo.com
Reply With Quote
  #8 (permalink)  
Old 10-04-2006
mark
 
Posts: n/a
Default Re: basic routing problem

Hello,

Thank you for all your answers!

I have changed it to:
DEB01 (10.0.1.1) <--> (10.0.1.2) DEB2 (10.0.2.1) <--> DEB3 (10.0.2.2)

is it okay like that (with mask 255.255.255.0)??

Then I try to define routing:
DEB01: route add -net 10.0.2.0 netmask 255.255.255.0 gw 10.0.1.2
DEB03: route add -net 10.0.1.0 netmask 255.255.255.0 gw 10.0.2.1

but still no success here (i.e. DEB02 can ping every host, but DEB01 &
DEB03 only DEB02). Could you tell me what is wrong here??

Regards, mark

Reply With Quote
  #9 (permalink)  
Old 10-04-2006
Robert Harris
 
Posts: n/a
Default Re: basic routing problem

mark wrote:
> Hello,
>
> Unfortunately I cannot change these IP addresses (it is all about
> topology generation and assigning them to virtual linuxes, so it won't
> be so easy. The numeration goes like 10.0.host.port).


Your numeration needs to be like 10.0.subnet.host

Otherwise you won't be able to specify subnet address ranges. You can,
if you are masochistic, specify each host individually in your routing
table but, if you do, then every time you add a new host to the network
you will have to modify the routing table of every other machine on the
network.

Robert

> The specification you gave me doesn't work :(. I am trying with route
> command but still no success... Could you help me out how to set these
> routes for these three workstations so that I could understand it and
> extend to more workstations).
>
> Thank you in advance, mark
>

Reply With Quote
  #10 (permalink)  
Old 10-04-2006
Robert Harris
 
Posts: n/a
Default Re: basic routing problem

mark wrote:
> Hello,
>
> Thank you for all your answers!
>
> I have changed it to:
> DEB01 (10.0.1.1) <--> (10.0.1.2) DEB2 (10.0.2.1) <--> DEB3 (10.0.2.2)
>
> is it okay like that (with mask 255.255.255.0)??
>
> Then I try to define routing:
> DEB01: route add -net 10.0.2.0 netmask 255.255.255.0 gw 10.0.1.2
> DEB03: route add -net 10.0.1.0 netmask 255.255.255.0 gw 10.0.2.1
>
> but still no success here (i.e. DEB02 can ping every host, but DEB01 &
> DEB03 only DEB02). Could you tell me what is wrong here??
>
> Regards, mark
>

DEB02 needs to have IP forwarding enabled. (type:

echo 1 > /proc/sys/net/ipv4/ip_forward

).

Robert
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:58 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0