Subject: routed, 2 routers and a [random routing network](tm) -> PLEASE HELP
To: None <tech-net@netbsd.org>
From: Andreas_Hallmann <hallmann@hallhard.darktech.org>
List: tech-net
Date: 05/03/2005 10:04:40
Hi everybody, PLEASE HELP!

I confused routed, which is now more and more confusing me!

Can't find a way out.....please (begging...wispering...slowly starving)

                             =============================
This is my first approach to 'random routing network' (tm) technology,
                             =============================
So please be patient.

Sorry for this longish posting. I wanted to give all necessary info's.
Hopefully thoose seeing will guide me out.


=============== The whole story =======================
For a few days now I'm triying to bring a redundant setup.

But any way I try, I run into trouble.

Plan:
    ___________________________________
   /                                   \
  (           I N T E R N E T           )
   \___________________________________/
      |                            |
    __|___                      ___|____
   /router\                    / router \
  (  ISP1  )                  (   ISP2   )
   \______/                    \________/
      |                            |
      | (Modem for backup)         | ADSL
    __|___                      ___|___
   /      \                    /       \
  ( ROUTER1)                  ( ROUTER2 )
   \______/                    \_______/
      |                            |             private network
------+----------------------------+----------------------------
                                                 with redundant 
                                                 Interet access
                                                   (some day)

Both routers are happily running NetBSD 1.6.2.

Both ISPs are not responding to RIP requests, so I have to use default routes.

Using ifconfig I'm able to set up interface METRICS so that routed should select
the faster,better,cheaper adsl path if available.

routed propergates this seting well, i.e. both routers ISP1 and ISP2 are propergated
with a preferable METRIC for ISP2.

Setting up a route with route  doesn't allow two default routes, OK, I understand that. 

So I decided to configure my clients without default routes.
Instead I run "routed -q" on each client.
This will allow for propergated default routes to fulfill my wishes.

Since I don't know how to propergate default routes to the ISP routers,
I set up ROUTER1 and ROUTER2  with "routed -F0/0,14" and "routed -F0/0,13"
to propergate a faked default route with better metric for the ADSL-route.

OK this setup works! 
rtquery shows that the better default route "wins" between the routers.
Changes in the metric result in a change rtquery's result w.r.t. the default route for my routers.
Only one ISP router shows up, since the other is behind a dial up connection.
-----------------------------------------------------------------------------------------------
newby.ahatec.de (192.168.0.26): RIPv2 84 bytes
  217.173.128.45/32  metric  1 adslgw01.loop03.Frankfurt.titan-networks.de
  217.173.147.11/32  metric  1 gw.ahatec.de
  192.168.0.0/16     metric  1           
  0.0.0.0            metric 12 default   

nda.ahatec.de (192.168.0.23): RIPv2 84 bytes
  217.173.128.45/32  metric  2 adslgw01.loop03.Frankfurt.titan-networks.de nhop=newby.ahatec.de
  217.173.147.11/32  metric  2 gw.ahatec.de nhop=newby.ahatec.de
  192.168.0.0/16     metric  1           
  0.0.0.0            metric 13 default    nhop=newby.ahatec.de
-----------------------------------------------------------------------------------------------

But having a look on a client [NetBSD 2.0.2] : (trace file)

-----------------------------------------------------------------------------------------------
-- 08:10:25 --
Tracing actions started
Add interface hme0 192.168.48.22  -->192.168.0.0/16  <RIPV2> 
RCVBUF=61440
turn on RIP
Add interface lo0  127.0.0.1      -->127.0.0.1/32    <LOOPBACK> <PASSIVE> 
Add    127.0.0.1/32    -->127.0.0.1        metric=0  lo0 <IF> 
Add    192.168.0.0/16  -->192.168.48.22    metric=0  hme0 <IF> 
-- 08:10:25 --
Add #1 192.168.0.0/16  -->192.168.0.23     metric=1  hme0 08:10:25 
Add    217.173.128.45/32-->192.168.0.26    metric=1  hme0 08:10:25 
Add    217.173.147.11/32-->192.168.0.26    metric=1  hme0 08:10:25 
Add #2 192.168.0.0/16  -->192.168.0.26     metric=1  hme0 08:10:25 
Add    0.0.0.0         -->192.168.0.26     metric=12 hme0 08:10:25 
-- 08:10:26 --
turn on Router Discovery client using 192.168.0.23 via hme0
Chg    0.0.0.0         -->192.168.0.26     metric=12 hme0 08:10:25 <> 
                          192.168.0.23     metric=15 08:10:26 <RDISC> 
turn off RIP
Del    217.173.128.45/32-->192.168.0.26    metric=1  hme0 08:10:25 
Del    217.173.147.11/32-->192.168.0.26    metric=1  hme0 08:10:25 
write(rt_sock) RTM_CHANGE 0.0.0.0         -->192.168.0.23    metric=15 flags=0x2: Too many references: can't splice
-- 08:15:12 --
Del #1 192.168.0.0/16  -->192.168.0.23     metric=1  hme0 08:10:25 
Del #2 192.168.0.0/16  -->192.168.0.26     metric=1  hme0 08:10:25 
write(rt_sock) RTM_CHANGE 0.0.0.0         -->192.168.0.23    metric=15 flags=0x2: Too many references: can't splice
write(rt_sock) RTM_CHANGE 0.0.0.0         -->192.168.0.23    metric=15 flags=0x2: Too many references: can't splice
[...]
-----------------------------------------------------------------------------------------------

with 

===========================================
moshus 202: route show
Routing tables

Internet:
Destination       Gateway            Flags 
default           192.168.0.26       UG     
===========================================

This seems OK, BUT @@@@!@@!$$#### what we always will see here is the first router to answer.
This only might be that with the better metric. (sic)

So on another host (NetBSD 1.6.2) I have

-----------------------------------------------------------------------------------------------
-- 09:04:39 --
Tracing actions started
Add interface le0  192.168.0.28   -->192.168.0.0/16  <RIPV2> 
RCVBUF=61440
turn on RIP
Add interface lo0  127.0.0.1      -->127.0.0.1/32    <LOOPBACK> <PASSIVE> 
Add    127.0.0.1/32    -->127.0.0.1        metric=0  lo0 <IF> 
Add    192.168.0.0/16  -->192.168.0.28     metric=0  le0 <IF> 
-- 09:04:39 --
Add #1 192.168.0.0/16  -->192.168.0.23     metric=1  le0 09:04:39 
Add    217.173.128.45/32-->192.168.0.26    metric=1  le0 09:04:39 
Add    217.173.147.11/32-->192.168.0.26    metric=1  le0 09:04:39 
Add #2 192.168.0.0/16  -->192.168.0.26     metric=1  le0 09:04:39 
Add    0.0.0.0         -->192.168.0.26     metric=12 le0 09:04:39 
-- 09:04:40 --
turn on Router Discovery client using 192.168.0.23 via le0
Chg    0.0.0.0         -->192.168.0.26     metric=12 le0 09:04:39 <> 
                          192.168.0.23     metric=15 09:04:40 <RDISC> 
turn off RIP
Del    217.173.128.45/32-->192.168.0.26    metric=1  le0 09:04:39 
Del    217.173.147.11/32-->192.168.0.26    metric=1  le0 09:04:39 
-- 09:09:39 --
Del #1 192.168.0.0/16  -->192.168.0.23     metric=1  le0 09:04:39 
Del #2 192.168.0.0/16  -->192.168.0.26     metric=1  le0 09:04:39 
-----------------------------------------------------------------------------------------------

 with the wrong default route in kernel table.


-----------------------------------------------------------------------------------------------
wawa 618: route show
Routing tables

Internet:
Destination       Gateway            Flags 
default           192.168.0.23       UG     
-----------------------------------------------------------------------------------------------

 Even more confusing rtquery shows both clients (moshus, wawa) have set up there default routes set wrong
 after a restart of there routed's:

-----------------------------------------------------------------------------------------------
newby.ahatec.de (192.168.0.26): RIPv2 84 bytes
  217.173.128.45/32  metric  1 adslgw01.loop03.Frankfurt.titan-networks.de
  217.173.147.11/32  metric  1 gw.ahatec.de
  192.168.0.0/16     metric  1           
  0.0.0.0            metric 12 default   
nda.ahatec.de (192.168.0.23): RIPv2 84 bytes
  217.173.128.45/32  metric  2 adslgw01.loop03.Frankfurt.titan-networks.de nhop=newby.ahatec.de
  217.173.147.11/32  metric  2 gw.ahatec.de nhop=newby.ahatec.de
  192.168.0.0/16     metric  1           
  0.0.0.0            metric 13 default    nhop=newby.ahatec.de
moshus.ahatec.de (192.168.48.22): RIPv2 44 bytes
  192.168.0.0/16     metric  1           
  0.0.0.0            metric 16 default    nhop=nda.ahatec.de  
wawa.ahatec.de (192.168.0.28): RIPv2 44 bytes
  192.168.0.0/16     metric  1           
  0.0.0.0            metric 16 default    nhop=nda.ahatec.de  
-----------------------------------------------------------------------------------------------
with 
	 kernel default route  on wawa set to nda
	 kernel default route  on moshus set to newby 
	 kernel default route  on newby set to adslgw01.loop03.Frankfurt.titan-networks.de
	 kernel default route  on nda set to newby 
===============================================================================================
==       Q U E S T I O N    S E C T I O N
===============================================================================================
In those [can't splice] lines can see that routed is trying to update the default route, 
but the kernel does not allow for this. Right?

Seams to be the same code which doesn't allow for setting a default route if one is allready set, right???
But WHY routed does tryies it? Why show a route with metric 12 (see above) be replaced by a route with metric 15?
15? Routers have metrics 12 and 13. Where does 15 come from.

Can't beleave, that I'm the first who want's some fall back functionality.

Things should be easier, if I could join router 1 and 2.
But since interoperation of pppd and in kernel ppp would destroy my ipv6 uplink (another story)
two router machines are better suited to me.
Moreover I feel a shamed, that NetBSD is failing in this setup.

What is going on here ???

Please all you wise guy's out there, I'm crying for help!

Andreas
-- 
NetBSD: If you happen to have any problem with your uptime.