Networking Forums

Networking Forums > Computer Networking > Linux Networking > Why doesn't route support this???

Reply
Thread Tools Display Modes

Why doesn't route support this???

 
 
Justin Todd
Guest
Posts: n/a

 
      12-13-2005, 09:13 PM
Based on the following routing table, why can't I add a new network:
192.168.23.0/24 via gw 192.168.21.1? route complains that the "Network
is unreachble" when I try to add it. I tried setting the metric to 1,
and it still failed.

>route add -net 192.168.23.0 netmask 255.255.255.0 gw 192.168.21.1

SIOCADDRT: Network is unreachable


Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use
Iface
192.168.21.1 192.168.1.205 255.255.255.255 UGH 0 0 0
192.168.21.0 192.168.1.205 255.255.255.0 UG 0 0 0
192.168.1.0 * 255.255.255.0 U 0 0 0
loopback * 255.0.0.0 U 0 0 0
default 192.168.1.1 0.0.0.0 UG 0 0 0



Heres how my network is set up:

machine 1 machine 2 machine 3 machine 4
192.168.1.200 192.168.1.205 192.168.21.2 192.168.23.2
192.168.21.1 192.168.23.1
 
Reply With Quote
 
 
 
 
David Schwartz
Guest
Posts: n/a

 
      12-13-2005, 11:22 PM

"Justin Todd" <(E-Mail Removed)> wrote in message
news:PHHnf.146399$y_1.21214@edtnps89...

> Based on the following routing table, why can't I add a new network:
> 192.168.23.0/24 via gw 192.168.21.1? route complains that the "Network is
> unreachble" when I try to add it. I tried setting the metric to 1, and it
> still failed.
>
> >route add -net 192.168.23.0 netmask 255.255.255.0 gw 192.168.21.1

> SIOCADDRT: Network is unreachable
>
>
> Kernel IP routing table
> Destination Gateway Genmask Flags Metric Ref Use
> Iface
> 192.168.21.1 192.168.1.205 255.255.255.255 UGH 0 0 0
> 192.168.21.0 192.168.1.205 255.255.255.0 UG 0 0 0
> 192.168.1.0 * 255.255.255.0 U 0 0 0
> loopback * 255.0.0.0 U 0 0 0
> default 192.168.1.1 0.0.0.0 UG 0 0 0


TCP/IP routing just doesn't work that way. The origin device doesn't
choose the route all the way to the destination, just the next hop.

DS


 
Reply With Quote
 
Joe Pfeiffer
Guest
Posts: n/a

 
      12-13-2005, 11:28 PM
Justin Todd <(E-Mail Removed)> writes:

> Based on the following routing table, why can't I add a new network:
> 192.168.23.0/24 via gw 192.168.21.1? route complains that the "Network
> is unreachble" when I try to add it. I tried setting the metric to 1,
> and it still failed.
>
> >route add -net 192.168.23.0 netmask 255.255.255.0 gw 192.168.21.1

> SIOCADDRT: Network is unreachable
>
>
> Kernel IP routing table
> Destination Gateway Genmask Flags Metric Ref
> Use Iface
> 192.168.21.1 192.168.1.205 255.255.255.255 UGH 0 0 0
> 192.168.21.0 192.168.1.205 255.255.255.0 UG 0 0 0
> 192.168.1.0 * 255.255.255.0 U 0 0 0
> loopback * 255.0.0.0 U 0 0 0
> default 192.168.1.1 0.0.0.0 UG 0 0 0
>
>
>
> Heres how my network is set up:
>
> machine 1 machine 2 machine 3 machine 4
> 192.168.1.200 192.168.1.205 192.168.21.2 192.168.23.2
> 192.168.21.1 192.168.23.1


First, I assume this means machine 1 and machine 4 both have one
ethernet card each, while machine 2 and machine 3 each have two.
There's a wire from machine 1 to machine 2 (the 192.168.1 net), a wire
from machine 2 to machine 3 (the 192.168.21 net) and a wire from
machine 3 to machine 4 (the 192.168.23 net). I'll take it on faith
that there's a lot more network that you're not telling us about, or
some other sane reason for this setup.

So... are you trying to run the route command on machine 1? That's
the only one that seems vaguely reasonable for it... but why do you
have routes both to 192.168.21.0/24, and 192.168.21.1/32? The latter
seems superfluous. Why is your default route going to a nonexistent
gateway?

To finally get to your question, the man page implies (to me, anyway)
that it should work. But since the only way you're going to get to
192.168.21.1 is through 192.168.1.205, why not set your route to that
gateway in the first place, and let machine 2 deal with passing the
packets on to the 192.168.23 net?
--
Joseph J. Pfeiffer, Jr., Ph.D. Phone -- (505) 646-1605
Department of Computer Science FAX -- (505) 646-1002
New Mexico State University http://www.cs.nmsu.edu/~pfeiffer
skype: jjpfeifferjr
 
Reply With Quote
 
Justin Todd
Guest
Posts: n/a

 
      12-13-2005, 11:39 PM
David Schwartz wrote:
> "Justin Todd" <(E-Mail Removed)> wrote in message
> news:PHHnf.146399$y_1.21214@edtnps89...
>
>
>>Based on the following routing table, why can't I add a new network:
>>192.168.23.0/24 via gw 192.168.21.1? route complains that the "Network is
>>unreachble" when I try to add it. I tried setting the metric to 1, and it
>>still failed.
>>
>>
>>>route add -net 192.168.23.0 netmask 255.255.255.0 gw 192.168.21.1

>>
>>SIOCADDRT: Network is unreachable
>>
>>
>>Kernel IP routing table
>>Destination Gateway Genmask Flags Metric Ref Use
>>Iface
>>192.168.21.1 192.168.1.205 255.255.255.255 UGH 0 0 0
>>192.168.21.0 192.168.1.205 255.255.255.0 UG 0 0 0
>>192.168.1.0 * 255.255.255.0 U 0 0 0
>>loopback * 255.0.0.0 U 0 0 0
>>default 192.168.1.1 0.0.0.0 UG 0 0 0

>
>
> TCP/IP routing just doesn't work that way. The origin device doesn't
> choose the route all the way to the destination, just the next hop.
>
> DS
>
>


What is the point of having a metric then? Doesn't the metric define the
number of hops from the source to the destination?
 
Reply With Quote
 
Paul Colquhoun
Guest
Posts: n/a

 
      12-13-2005, 11:59 PM
On Tue, 13 Dec 2005 22:13:03 GMT, Justin Todd <(E-Mail Removed)> wrote:
| Based on the following routing table, why can't I add a new network:
| 192.168.23.0/24 via gw 192.168.21.1? route complains that the "Network
| is unreachble" when I try to add it. I tried setting the metric to 1,
| and it still failed.
|
| >route add -net 192.168.23.0 netmask 255.255.255.0 gw 192.168.21.1
| SIOCADDRT: Network is unreachable
|
|
| Kernel IP routing table
| Destination Gateway Genmask Flags Metric Ref Use
| Iface
| 192.168.21.1 192.168.1.205 255.255.255.255 UGH 0 0 0
| 192.168.21.0 192.168.1.205 255.255.255.0 UG 0 0 0
| 192.168.1.0 * 255.255.255.0 U 0 0 0
| loopback * 255.0.0.0 U 0 0 0
| default 192.168.1.1 0.0.0.0 UG 0 0 0
|
|
|
| Heres how my network is set up:
|
| machine 1 machine 2 machine 3 machine 4
| 192.168.1.200 192.168.1.205 192.168.21.2 192.168.23.2
| 192.168.21.1 192.168.23.1


I presume from the routing table that you are trying to create this
route on "machine 2". Is this correct?

If so, then it is failing because the gateway you give is a local IP
address. You need the *next*, (non-local but on a local network) address.

Try:

route add -net 192.168.23.0 netmask 255.255.255.0 gw 192.168.21.2
^
|
Note: only 1 character different from your command.

i.e. to reach network 192.168.23.0 from machine-2, send the packet to
ip 192.168.21.2, configured on machine-3.


--
Reverend Paul Colquhoun, ULC. http://andor.dropbear.id.au/~paulcol
Asking for technical help in newsgroups? Read this first:
http://catb.org/~esr/faqs/smart-questions.html#intro
 
Reply With Quote
 
Allen McIntosh
Guest
Posts: n/a

 
      12-14-2005, 02:58 AM

> What is the point of having a metric then? Doesn't the metric define the
> number of hops from the source to the destination?


The manual page for "route" says:

Metric The 'distance' to the target (usually counted in hops).
It is not used by recent kernels, but may be needed
by routing daemons.
 
Reply With Quote
 
Floyd L. Davidson
Guest
Posts: n/a

 
      12-14-2005, 10:11 AM
Justin Todd <(E-Mail Removed)> wrote:
>Based on the following routing table, why can't I add a new network:
>192.168.23.0/24 via gw 192.168.21.1? route complains that the
>"Network is unreachble" when I try to add it. I tried setting
>the metric to 1, and it still failed.


You haven't shown how your system is physically wired, nor have
you indicated where this new host fits into the picture
physically, nor which machine this route table is for.

I'll make a few assumptions here... and if they are wrong, post
something indicating what you do want and I'll redraw this for
the actual topology needed.

> >route add -net 192.168.23.0 netmask 255.255.255.0 gw 192.168.21.1

>SIOCADDRT: Network is unreachable
>
>Kernel IP routing table
>Destination Gateway Genmask Flags Metric Ref
>Use Iface
>192.168.21.1 192.168.1.205 255.255.255.255 UGH 0 0 0


Note that the above entry is redundant, 192.168.21.1 and
192.168.1.205 are the same host.

>192.168.21.0 192.168.1.205 255.255.255.0 UG 0 0 0
>192.168.1.0 * 255.255.255.0 U 0 0 0


You have trimmed off the final column from the route table
display, which gave the device name. I'll assume in all cases
that eth0 looks to the right, and eth1 looks to the left on all
machines in your diagram (down and up, respectively in my diagrams).

Given the above two entries, and the "network is unreachable"
error above, I assume this route table is on "machine 1". Note
that "machine 2" must have entries which look like this:

192.168.1.0 * 255.255.255.0 U 0 0 0 eth1
192.168.21.0 * 255.255.255.0 U 0 0 0 eth0
192.168.23.0 192.168.21.2 255.255.255.0 UG 0 0 0 eth0

"Machine 3" must have a route table which looks like this:

192.168.23.0 * 255.255.255.0 U 0 0 0 eth0
192.168.21.0 * 255.255.255.0 U 0 0 0 eth1
192.168.1.0 192.168.21.1 255.255.255.0 UG 0 0 0 eth1

While "machine 4" must have a route table like this:

192.168.23.0 * 255.255.255.0 U 0 0 0 eth1
192.168.21.0 192.168.23.1 255.255.255.0 UG 0 0 0 eth1
192.168.1.0 192.168.23.1 255.255.255.0 UG 0 0 0 eth1

Those last two lines could be replaced with just one:

192.168.0.0 192.168.23.1 255.255.255.0 UG 0 0 0 eth1

Of course your "machine 1" has to have a route table something very
similar to this one for "machine 4". It would look like this:

192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
192.168.21.0 192.168.1.205 255.255.255.0 UG 0 0 0 eth0
192.168.23.0 192.168.1.205 255.255.255.0 UG 0 0 0 eth0

>loopback * 255.0.0.0 U 0 0 0
>default 192.168.1.1 0.0.0.0 UG 0 0 0
>
>Heres how my network is set up:
>
>machine 1 machine 2 machine 3 machine 4
>192.168.1.200 192.168.1.205 192.168.21.2 192.168.23.2
> 192.168.21.1 192.168.23.1


I am assuming this is wired as:

machine 1
===================
192.168.1.200 eth0 <=+
=================== |
|
|
machine 2 |
=================== |
192.168.1.205 eth1 <=+

192.168.21.1 eth0 <=+
=================== |
|
|
machine 3 |
=================== |
192.168.21.2 eth1 <=+

192.168.23.1 eth0 <=+
=================== |
|
|
=================== |
machine 4 |
192.168.23.2 eth1 <=+
===================

The above assumes you have physically separate subnets each
with a unique NIC as shown. If you actually have one physical
subnet and the distinct IP addresses are assigned to virtual
interfaces on a single NIC per host... then it all changes.

The only place that makes sense for a new host with an ip
address in the subnet 192.168.23.xxx is on the same Ethernet
segment as used between Host 3 and Host 4. (You could put such
addresses on other physical links, but that would be asking for
a huge headache.)

Hence "machine 3" and "machine 4" would then look like this:

To machine 2
^
machine 3 |
=================== |
192.168.21.2 eth1 <=+

192.168.23.1 eth0 <=+
=================== |
| machine 5
| ===================
+=> eth1 192.168.23.3
| ===================
machine 4 |
=================== |
192.168.23.2 eth1 <=+
===================


The routing table for machine 5 would be identical to machine 4,
and no others would require modification.

None of the above indicates what to do about a default route! You
didn't mention it, or show it in your diagram, but you have a default
to 192.168.1.1 in the route table you show. Assuming that is indeed
an Internet connection...

Machine 1 stays the same (default with a gateway to 192.168.1.1) as
your table, and machine 2 should have the same added to what I've
shown. Machine3 should have a default with 192.168.21.1 as the
gateway. Machine 4 and machine 5 should have 192.168.23.1 as the
gateway for the default route.

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) (E-Mail Removed)
 
Reply With Quote
 
Floyd L. Davidson
Guest
Posts: n/a

 
      12-14-2005, 10:27 AM
Allen McIntosh <(E-Mail Removed)> wrote:
>> What is the point of having a metric then? Doesn't the metric
>> define the number of hops from the source to the destination?

>
>The manual page for "route" says:
>
>Metric The 'distance' to the target (usually counted in hops).
> It is not used by recent kernels, but may be needed
> by routing daemons.


Specifically it is used for dynamic routing.

http://www.tldp.org/LDP/nag/node32.html

If RIP or gated is being use to set routing, the metric value is
set to provide an indication of which route is preferred when more
than one might be available.

With static routing, which is what this thread discusses, the metric
value is not used.

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) (E-Mail Removed)
 
Reply With Quote
 
David Schwartz
Guest
Posts: n/a

 
      12-14-2005, 07:02 PM

"Justin Todd" <(E-Mail Removed)> wrote in message
news:qRJnf.160237$yS6.99218@clgrps12...

>> TCP/IP routing just doesn't work that way. The origin device doesn't
>> choose the route all the way to the destination, just the next hop.


> What is the point of having a metric then? Doesn't the metric define the
> number of hops from the source to the destination?


The metric helps the machine decide what the next hop should be.
However, a packet is always routed to its next hop.

DS


 
Reply With Quote
 
 
 
Reply

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Static route in Routing and Remote Access doesn't work joenahmias@gmail.com Windows Networking 9 11-19-2008 08:01 PM
driver doesn't support WPA? johnny Wireless Internet 0 10-28-2006 10:08 PM
route add don't support CIDR route add �支�CIDR Windows Networking 2 02-15-2006 02:05 AM
RRAS VPN client doesn't get route update Scott Windows Networking 1 10-02-2004 01:50 AM
Should route, but doesn't Dale Pontius Linux Networking 10 01-07-2004 03:43 AM



1 2 3 4 5 6 7 8 9 10 11