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)