I am seen funny behaviour with synchronization in bgp. sometimes when i turn synchronisation off and advertise prefixes through network statement and my IGP (OSPF) doesn't have those routes, BGP refuses to advertise the prefixes. sometimes, it does (regardless of the prefix being in IGP or not.
I know no synchronization is meant to disable the prefix check in the routing table and should allow BGP advetise prefixes.
I am advertising to an ebgp neighbour.
pls enlighten me on what is happening. could it be the IOS version?
The best way to find out the reason for the prefix not being advertised is to do a "show ip bgp x.x.x.x" for the specific prefix when this condition happens. This should tell you if synchronization has anything to do with it (it should not in principle since it it is disable).
My first statement is that BGP is having some very strange behavior sometimes (stuck and not recover until you do a hard clear, routes not to be advertise until you hard clear the peering to the neighboor and so on...).
In your case what I can ask to check:
- with synchronization off, check that the prefixes that you advertise in BGP are in the routing table; if they are not there, BGP will never advertise them;
- try to put a route to null0 for a network that you want to advertise in BGP and see if in that case the prefix is advertised
- try a hard clear after switching off the synchronization (if you are allowed to do that)
Please tell me if any of this advices above helped you!
Many thanks. But that it the whole reason for synchronization. to enable BGP advertise prefixes even though it is not in the routing table.
am I wrong guys?
You said: "sometimes when i turn synchronisation off and advertise prefixes through network statement and my IGP (OSPF) doesn't have those routes, BGP refuses to advertise the prefixes"
So I understand that you have "no synchronization" under BGP config, and you do a "network xxx.xxx.xxx.xxx mask yyy.yyy.yyy.yyy" and you want xxx.xxx.xxx.xxx to be advertise to eBGP peer. Right? But if xxx.xxx.xxx.xxx is not in the routing table BGP will not advertise it.
See the sychronization explained below:
A BGP router with synchronization enabled will not advertise iBGP-learned routes to other eBGP peers if it is not able to validate those routes in its IGP.Assuming that IGP has a route to iBGP-learned routes, the router will announce the iBGP routes to eBGP peers. Otherwise the router treats the route as not being synchronized with IGP and does not advertise it. Disabling synchronization using the no synchronization command under router BGP prevents BGP from validating iBGP routes in IGP. By default, synchronization is enabled on all BGP routers.
a BGP advertisement is accepted if the BGP next hop is known
so disabling synchronization is necessary but can be not enough to advertise successfully
try to add:
as suggested by Harold check with sh ip bgp x.x.x.x
If you can collect info about a case and post here you can find better help
Hope to help
Many thanks Giuseppe.
i am originating the routes so i am the next hop.
what i will really want to know is this. if synchronization is turned off and a prefix is not in the routing table. will BGP advertise the route if you advertise it using a network statement?
will be glad to clarify this once and for all.
if an IP prefix is not already present in the IP routing table the BGP router will not advertise it.
Conversly if the prefix is present by any means (connected, static route, another routing protocol, BGP itself) BGP will advertise it.
A BGP router is not allowed to lie: it can advertise a prefix only if present in the routing table and use its own best choice (if multiple BGP advertisements are present)
it cannot advertise to somebody else a path that is not used by itself.
the old method to advertise prefixes / aggregates is to use static routes using the null0 interface.
ip route x.x.x.0 y.y.y.0 null0 200
router bgp yourASN
this allows to advertise net x.x.x.0
Hope to help
Giuseppe (you have my credits for this) explain maybe better than me in the first post. Akin, you are confusing the functionality of synchronization with the mechanism which BGP is using to advertise prefixes.
I hope you understood now :)