[Xorp-users] Routes redistribution between OSPF and BGP

Atanu Ghosh atanu at ICSI.Berkeley.EDU
Tue Apr 8 19:06:41 PDT 2008


Hi,

I tried your configuration between two BGP routers, the remote BGP
router is announcing 10.10.10.0/24.

Xorp> show bgp routes 
Status Codes: * valid route, > best route
Origin Codes: i IGP, e EGP, ? incomplete

   Prefix                Nexthop                    Peer            AS Path
   ------                -------                    ----            -------
*> 10.10.10.0/24         192.168.1.40               192.168.1.40  65002 i
Xorp> show ospf4 database 
   OSPF link state database, Area 0.0.0.0
 Type       ID               Adv Rtr           Seq      Age  Opt  Cksum  Len
Router  *192.168.1.144    192.168.1.144    0x80000001   249  0x2  0x9d52  36
ASExt-2 *192.168.1.0      192.168.1.144    0x80000001   249  0x2  0xd49d  36
ASExt-2 *10.10.10.0       192.168.1.144    0x80000001   249  0x2  0x72b4  36

The incoming eBGP route is redistributed to OSPF, I have attached the
whole config file.

    Atanu.

----------------------------------------
interfaces {
	restore-original-config-on-shutdown: true
	interface em0 {
		vif em0 {
			address 192.168.1.144 {
				prefix-length: 24
			}
		}		

	}
}

protocols {
	bgp {
		bgp-id: 192.168.1.144
		local-as: 65001

		export "bgp_out"

		peer 192.168.1.40 {
			local-ip: 192.168.1.144
			as:  65002
			next-hop: 192.168.1.144
		}
	}
}

protocols {
    ospf4 {
        router-id: 192.168.1.144

	export "bgp2ospf,ospf_out"

        area 0.0.0.0 {
            interface em0 {
                vif em0 {
                    address 192.168.1.144 {
                    }
                }
            }
        }
    }
}

policy {
  network4-list myroutes {
    network 10.0.0.0/30
    network 10.0.0.16/30
  }
  policy-statement ospf_out {
    term 100 {
        from {
             protocol: "connected"
        }
    }
 }
  policy-statement bgp_out {
    term 200 {
        from {
             protocol: "ospf4"
        }
        to {
             neighbor: 10.0.0.6  /* not advertising OSPF routes to iBGP peers */
        }
        then {
             reject
        }
    }
    term 300 {
        from {
             protocol: "connected"
             network4-list: "myroutes"
        }
        to {
             neighbor: 10.0.0.6
        }
        then {
             reject
        }
    }
 }
  policy-statement bgp2ospf {
    term 400 {
        from {
             protocol: "bgp"
             neighbor: 192.168.1.40   /* eBGP peer */
        }
        then {
             accept
        }
    }
  }
}
----------------------------------------

>>>>> "Yue" == Yue Li <yueli.m at gmail.com> writes:

    Yue> Hi, Atanu
    Yue> I have this working now.

    Yue> And then I want to redistributing routes from BGP (learned from eBGP
    Yue> peers) to OSPF, I use this configurations on an AS border router:

    Yue> policy {
    Yue> network4-list myroutes {
    Yue> network 10.0.0.0/30
    Yue> network 10.0.0.16/30
    Yue> }
    Yue> policy-statement ospf_out {
    Yue> term 100 {
    Yue> from {
    Yue> protocol: "connected"
    Yue> }
    Yue> }
    Yue> }
    Yue> policy-statement bgp_out {
    Yue> term 200 {
    Yue> from {
    Yue> protocol: "ospf4"
    Yue> }
    Yue> to {
    Yue> neighbor: 10.0.0.6  /* not advertising OSPF routes to iBGP peers */
    Yue> }
    Yue> then {
    Yue> reject
    Yue> }
    Yue> }
    Yue> term 300 {
    Yue> from {
    Yue> protocol: "connected"
    Yue> network4-list: "myroutes"
    Yue> }
    Yue> to {
    Yue> neighbor: 10.0.0.6
    Yue> }
    Yue> then {
    Yue> reject
    Yue> }
    Yue> }
    Yue> }
    Yue> policy-statement bgp2ospf {
    Yue> term 400 {
    Yue> from {
    Yue> protocol: "bgp"
    Yue> neighbor: 10.0.0.66   /* eBGP peer */
    Yue> }
    Yue> then {
    Yue> accept
    Yue> }
    Yue> }
    Yue> }
    Yue> }

    Yue> But this doesn't work. Could you point out how to config correctly?
    Yue> Thanks!


    Yue> On Mon, Mar 31, 2008 at 10:15 PM, Atanu Ghosh <atanu at icsi.berkeley.edu> wrote:
    >> Hi,
    >> 
    >> When redistributing routes from OSPF to BGP only the routes that OSPF
    >> has learned from its neighbours will be redistributed. The connected
    >> routes will not be redistributed, so you are correct you also need to
    >> redistribute connected.
    >> 
    >> 
    >> Atanu.
    >> 



More information about the Xorp-users mailing list