ospf cost and route selection (openospfd)

Josef Pojsl jp at tns.cz
Wed Feb 6 06:56:51 PST 2008


Hello,

I am trying to use openospfd 4.0 over FreeBSD 6.2 in order
to provide redundancy for routing between LAN 1 and LAN 2.
The picture is as follows:


Locality 1 (LAN 1)                 Locality 2 (LAN 2)
                   WAN X
           ------------------------
 Router 1          WAN Y            Router 2
           ------------------------

Router 1 is connected to LAN 1 on one side
and to two WANs, X and Y, on the other side.
The same holds for Router 2, it is connected
to LAN 2, WAN X and WAN Y.

There are gre tunnels between the routers
over both WAN X and WAN Y. These tunnels get
encrypted with IPsec transport.

I have configured openospfd over both gre interfaces.
The preferred link that I would like to be used for routing
of LANs is the gre tunnel between 1 and 2 over WAN X.
The cost of that link is the least of both costs.
But, openospfd converges with routing between 1 and 2
over WAN Y, not WAN X. I have no clue why.

LAN 1 is 192.168.1.0/24, LAN 2 is 192.168.2.0/24.

gre30 is the link over WAN X, gre31 over WAN Y. 10.10.0.0/16 is WAN X,
10.20.0.0/16 is WAN Y.

Configuration of gre tunnels:
Router 1:
gre30: flags=b051<UP,POINTOPOINT,RUNNING,LINK0,LINK1,MULTICAST> mtu 1476
        tunnel inet 10.10.1.2 --> 10.10.2.2
        inet 10.30.1.2 --> 10.30.2.2 netmask 0xffffff00 
gre31: flags=b051<UP,POINTOPOINT,RUNNING,LINK0,LINK1,MULTICAST> mtu 1476
        tunnel inet 10.20.1.2 --> 10.20.2.2
        inet 10.31.1.2 --> 10.31.2.2 netmask 0xffffff00 

Router 2:
gre30: flags=b051<UP,POINTOPOINT,RUNNING,LINK0,LINK1,MULTICAST> mtu 1476
        tunnel inet 10.10.2.2 --> 10.10.1.2
        inet 10.30.2.2 --> 10.30.1.2 netmask 0xffffff00 
gre31: flags=b051<UP,POINTOPOINT,RUNNING,LINK0,LINK1,MULTICAST> mtu 1476
        tunnel inet 10.20.2.2 --> 10.20.1.2
        inet 10.31.2.2 --> 10.31.1.2 netmask 0xffffff00

Configuration of openospfd:
Router 1:
router-id 0.0.0.1
redistribute connected

area 0.0.0.0 {
    interface gre30 {
        metric 20
    }
    interface gre31 {
        metric 50
    }
}

Router 2:
router-id 0.0.0.2
redistribute connected

area 0.0.0.0 {
    interface gre30 {
        metric 20
    }
    interface gre31 {
        metric 50
    }
}

ospfctl show rib:
Router 1:
Destination          Nexthop           Path Type    Type      Cost    Uptime  
0.0.0.2              10.31.2.2         Intra-Area   Router    20      00:03:51
10.30.1.2/32         10.31.2.2         Intra-Area   Network   40      00:03:41
10.31.1.2/32         10.31.2.2         Intra-Area   Network   70      00:03:51
10.10.0.0/16         10.31.2.2         Type 1 ext   Network   120     00:03:51
10.20.0.0/16         10.31.2.2         Type 1 ext   Network   120     00:03:51
192.168.2.0/24       10.31.2.2         Type 1 ext   Network   120     00:03:51

Router 2:
Destination          Nexthop           Path Type    Type      Cost    Uptime  
0.0.0.1              10.31.1.2         Intra-Area   Router    20      00:04:51
10.30.2.2/32         10.31.1.2         Intra-Area   Network   40      00:04:44
10.31.2.2/32         10.31.1.2         Intra-Area   Network   70      00:04:51
10.10.0.0/16         10.31.1.2         Type 1 ext   Network   120     00:04:51
10.20.0.0/16         10.31.1.2         Type 1 ext   Network   120     00:04:51
192.168.1.0/24       10.31.1.2         Type 1 ext   Network   120     00:04:51

ospfctl show interface detail:
Router 1:
Interface gre31, line protocol is UP
  Internet address 10.31.1.2/24, Area 0.0.0.0
  Linkstate unknown
  Router ID 0.0.0.1, network type POINTOPOINT, cost: 50
  Transmit delay is 1 sec(s), state P2P, priority 1
  Designated Router (ID) 0.0.0.0, interface address 0.0.0.0
  Backup Designated Router (ID) 0.0.0.0, interface address 0.0.0.0
  Timer intervals configured, hello 10, dead 40, wait 40, retransmit 5
    Hello timer due in 00:00:06
    Uptime 00:06:04
  Neighbor count is 1, adjacent neighbor count is 1

Interface gre30, line protocol is UP
  Internet address 10.30.1.2/24, Area 0.0.0.0
  Linkstate unknown
  Router ID 0.0.0.1, network type POINTOPOINT, cost: 20
  Transmit delay is 1 sec(s), state P2P, priority 1
  Designated Router (ID) 0.0.0.0, interface address 0.0.0.0
  Backup Designated Router (ID) 0.0.0.0, interface address 0.0.0.0
  Timer intervals configured, hello 10, dead 40, wait 40, retransmit 5
    Hello timer due in 00:00:06
    Uptime 00:06:04
  Neighbor count is 1, adjacent neighbor count is 1

Router 2:
Interface gre31, line protocol is UP
  Internet address 10.31.2.2/24, Area 0.0.0.0
  Linkstate unknown
  Router ID 0.0.0.2, network type POINTOPOINT, cost: 50
  Transmit delay is 1 sec(s), state P2P, priority 1
  Designated Router (ID) 0.0.0.0, interface address 0.0.0.0
  Backup Designated Router (ID) 0.0.0.0, interface address 0.0.0.0
  Timer intervals configured, hello 10, dead 40, wait 40, retransmit 5
    Hello timer due in 00:00:09
    Uptime 00:06:02
  Neighbor count is 1, adjacent neighbor count is 1

Interface gre30, line protocol is UP
  Internet address 10.30.2.2/24, Area 0.0.0.0
  Linkstate unknown
  Router ID 0.0.0.2, network type POINTOPOINT, cost: 20
  Transmit delay is 1 sec(s), state P2P, priority 1
  Designated Router (ID) 0.0.0.0, interface address 0.0.0.0
  Backup Designated Router (ID) 0.0.0.0, interface address 0.0.0.0
  Timer intervals configured, hello 10, dead 40, wait 40, retransmit 5
    Hello timer due in 00:00:09
    Uptime 00:06:02
  Neighbor count is 1, adjacent neighbor count is 1

Why the LANs get routed over gre31, having cost 50, and not over gre30
with lower cost 20? Has anybody got any clue?

Thanks in advance for any comments,
--
Josef Pojsl


More information about the freebsd-net mailing list