Hello,
I recently used the ospf passive-interface in a setup like the following:
zebra.conf:
interface eth0
ip address 192.168.0.2/24
ip address 192.168.0.1/24 secondary
ospfd.conf:
router ospf
ospf router-id 192.168.0.2
passive-interface eth0 192.168.0.1
network 192.168.0.0/24 area 0
And similar on a another router except, that 192.168.0.2 is exchanged
with 192.168.0.3. Both routers have uplinks to the world, and the idea
is that non-OSPF aware systems use 192.168.0.1 as default gateway, and
if one of the routers should fail, the other will take over
automatically (after ARP timeout).
I had to make a few changes to the OSPF daemon before this worked though:
First of all, when doing a "write memory" in OSPF, it wrote:
router ospf
ospf router-id 192.168.0.2
passive-interface 192.168.0.1
network 192.168.0.0/24 area 0
But this form of "passive-interface" is not accepted as input, so I
patched it to include the interface name.
Second of all, when receiving OSPF updates from neighbours on this
interface, the passive-interface IP was used to receive them, and as it
was a passive interface, they were ignored.
The patch below makes ospfd prefer an active interface over a passive,
when receiving updates. I've just updated it to match the current
zebra-pj from CVS. I'm not sure if it is necessary to handle all the
special cases that the patch does, but if not, I'm sure that one of you,
who knows more about this than me can do so, or given a hint, I'll do it
myself.
Regards,
Anders K. Pedersen
--- zebra-pj/ospfd/ospf_interface.c.orig 2003-08-04
19:46:31.000000000 +0200
+++ zebra-pj/ospfd/ospf_interface.c 2003-08-04 19:46:31.000000000 +0200
@@ -427,7 +427,18 @@
if (prefix_match (oi->address, (struct prefix *) &addr))
{
if ( (match == NULL) ||
- (match->address->prefixlen < oi->address->prefixlen)
+ ( (OSPF_IF_PARAM (match, passive_interface)
+ == OSPF_IF_PASSIVE) &&
+ (OSPF_IF_PARAM (oi, passive_interface)
+ == OSPF_IF_ACTIVE)
+ ) ||
+ ( (match->address->prefixlen < oi->address->prefixlen) &&
+ ( (OSPF_IF_PARAM (match, passive_interface)
+ == OSPF_IF_PASSIVE) ||
+ (OSPF_IF_PARAM (oi, passive_interface)
+ == OSPF_IF_ACTIVE)
+ )
+ )
)
match = oi;
}
--- zebra-pj/ospfd/ospf_vty.c.orig 2003-08-04 19:27:39.000000000 +0200
+++ zebra-pj/ospfd/ospf_vty.c 2003-08-04 19:27:39.000000000 +0200
@@ -7326,7 +7326,8 @@
if (OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface) &&
oi->params->passive_interface == OSPF_IF_PASSIVE)
- vty_out (vty, " passive-interface %s%s",
+ vty_out (vty, " passive-interface %s %s%s",
+ oi->ifp->name,
inet_ntoa (oi->address->u.prefix4), VTY_NEWLINE);
}
--
The From: and Reply-To: addresses are internal news2mail gateway addresses.
Reply to the list or to "Anders K. Pedersen" <akp@cohaesio.com>
I recently used the ospf passive-interface in a setup like the following:
zebra.conf:
interface eth0
ip address 192.168.0.2/24
ip address 192.168.0.1/24 secondary
ospfd.conf:
router ospf
ospf router-id 192.168.0.2
passive-interface eth0 192.168.0.1
network 192.168.0.0/24 area 0
And similar on a another router except, that 192.168.0.2 is exchanged
with 192.168.0.3. Both routers have uplinks to the world, and the idea
is that non-OSPF aware systems use 192.168.0.1 as default gateway, and
if one of the routers should fail, the other will take over
automatically (after ARP timeout).
I had to make a few changes to the OSPF daemon before this worked though:
First of all, when doing a "write memory" in OSPF, it wrote:
router ospf
ospf router-id 192.168.0.2
passive-interface 192.168.0.1
network 192.168.0.0/24 area 0
But this form of "passive-interface" is not accepted as input, so I
patched it to include the interface name.
Second of all, when receiving OSPF updates from neighbours on this
interface, the passive-interface IP was used to receive them, and as it
was a passive interface, they were ignored.
The patch below makes ospfd prefer an active interface over a passive,
when receiving updates. I've just updated it to match the current
zebra-pj from CVS. I'm not sure if it is necessary to handle all the
special cases that the patch does, but if not, I'm sure that one of you,
who knows more about this than me can do so, or given a hint, I'll do it
myself.
Regards,
Anders K. Pedersen
--- zebra-pj/ospfd/ospf_interface.c.orig 2003-08-04
19:46:31.000000000 +0200
+++ zebra-pj/ospfd/ospf_interface.c 2003-08-04 19:46:31.000000000 +0200
@@ -427,7 +427,18 @@
if (prefix_match (oi->address, (struct prefix *) &addr))
{
if ( (match == NULL) ||
- (match->address->prefixlen < oi->address->prefixlen)
+ ( (OSPF_IF_PARAM (match, passive_interface)
+ == OSPF_IF_PASSIVE) &&
+ (OSPF_IF_PARAM (oi, passive_interface)
+ == OSPF_IF_ACTIVE)
+ ) ||
+ ( (match->address->prefixlen < oi->address->prefixlen) &&
+ ( (OSPF_IF_PARAM (match, passive_interface)
+ == OSPF_IF_PASSIVE) ||
+ (OSPF_IF_PARAM (oi, passive_interface)
+ == OSPF_IF_ACTIVE)
+ )
+ )
)
match = oi;
}
--- zebra-pj/ospfd/ospf_vty.c.orig 2003-08-04 19:27:39.000000000 +0200
+++ zebra-pj/ospfd/ospf_vty.c 2003-08-04 19:27:39.000000000 +0200
@@ -7326,7 +7326,8 @@
if (OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface) &&
oi->params->passive_interface == OSPF_IF_PASSIVE)
- vty_out (vty, " passive-interface %s%s",
+ vty_out (vty, " passive-interface %s %s%s",
+ oi->ifp->name,
inet_ntoa (oi->address->u.prefix4), VTY_NEWLINE);
}
--
The From: and Reply-To: addresses are internal news2mail gateway addresses.
Reply to the list or to "Anders K. Pedersen" <akp@cohaesio.com>