cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
7828
Views
45
Helpful
51
Replies

OSPF and BGP

skywalker_007
Spotlight
Spotlight

FOr one of our customer , they have two router one in each DC

The router in DC1 is connected to COre Switch in DC1 >> This is a Layer 2 connection

 

Similarly router in DC2 is connected to Core switch in DC 2 ( again L2 connection)

 

The DCs are connected over a Physical underground link .

 

Between Router 1 and Router 2 , we have defined a VLAN 11 where we run OSPF . BGP is also configured between two routers.

They use BGP peer Group . I want to understand how the failover will work in case ISP link goes down .

 

Both the router have a default route pointing to their respective ISP .

 

In OspF it have defined the redistribute connected and static plus network address for4 subnets also .

 

Below is the config

 

interface Port-channel1.11
encapsulation dot1Q 11
ip address 10.2.2.2 255.255.255.248
ip ospf message-digest-key 1 md5 7 XXXXXXXXXXXXXXX

!
router ospf 11
router-id 10.2.2.10
area 0 authentication message-digest
redistribute connected subnets
redistribute static subnets
passive-interface default
no passive-interface Port-channel1.11
network 10.2.2.0 0.0.0.255 area 0
network 10.2.3.0 0.0.0.255 area 0
network 10.2.4.0 0.0.0.255 area 0
network 10.2.5.0 0.0.0.255 area 0
!
router bgp 27272
bgp router-id 10.2.2.10
bgp log-neighbor-changes
bgp graceful-restart
bgp maxas-limit 100
timers bgp 10 30
neighbor TEST_GROUP peer-group
neighbor TEST_GROUP remote-as 27272
neighbor TEST_GROUP password 7 XXXXXXXXXXXXXXXXXX
neighbor TEST_GROUP update-source Loopback0
neighbor 10.2.2.11 peer-group TEST_GROUP   >>>> this IS router 2 loop back address in DC2

neighbor 22.2.22.12 remote-as XXXXX
neighbor 22.2.22.12 description ISP
neighbor 22.2.22.12 password 7 XXXX
!
address-family ipv4
network 10.2.2.0 mask 255.255.255.0 route-map INTERNAL-ROUTES
network 10.2.3.0 mask 255.255.255.0 route-map INTERNAL-ROUTES
network 10.2.4.0 mask 255.255.255.0 route-map INTERNAL-ROUTES
network 10.2.5.0 mask 255.255.255.0 route-map INTERNAL-ROUTES
neighbor TEST_GROUP send-community both
neighbor TEST_GROUP next-hop-self
neighbor TEST_GROUP soft-reconfiguration inbound
neighbor 10.2.2.11 activate
neighbor 22.2.22.12 activate
neighbor 22.2.22.12 send-community both
neighbor 22.2.22.12 prefix-list FILTER-OUT out
exit-address-family

ip route 0.0.0.0 0.0.0.0 22.2.22.12
ip route 10.2.2.0 255.255.255.0 Null0
ip route 10.2.3.0 255.255.255.0 10.2.3.254
ip route 10.2.4.0 255.255.255.0 Null0
ip route 10.2.5.0 255.255.255.0 Null0


ip prefix-list FILTER-OUT seq 10 permit 10.2.2.0/24
ip prefix-list FILTER-OUT seq 20 permit 10.2.3.0/24
ip prefix-list FILTER-OUT seq 30 permit 10.2.4.0/24
ip prefix-list FILTER-OUT seq 40 permit 10.2.5.0/24


interface Loopback0
description Loopback OSPFBGP
ip address 10.2.2.10 255.255.255.255
!
interface Port-channel1.14
encapsulation dot1Q 14
ip address 10.2.3.226 255.255.255.248
glbp 1 ip 10.2.3.227
glbp 1 priority 200
no glbp 1 load-balancing
glbp 1 authentication md5 key-chain glbp


interface GigabitEthernet0/0/4
description ISP
ip address 22.2.22.11 255.255.255.252
no negotiation auto
!
!

51 Replies 51

You have a lot of flexibility with BGP to filter incoming and outgoing updates.

Most common techniques is to use prefix-list in conjunction with route-map.

BGP allows to use prefix-list without route-maps however prefix-list will be able to match ip prefix only. This is the way how your devices are configured now.

Route-map provide you additional filtering capabilities. You can match (and permit or deny) based on the interface, next-hop, bgp community, as-path, access-list, prefix-list, etc.

Either with prefix-lists or route-maps you control direction of the filtering by adding in / out statement at the end of the command.

 

If you want something quick and simple, then probably prefix-list is your choice. If you want something more hierarchical and advanced, then route-map is a better option. 

The original poster has asked about why OSPF is used. To answer that we need to know a bit more about this network. Originally we were told about 2 core switches and 2 routers. Now we know about 2 firewalls. Are there any other devices in this network?

 

We would like to know a bit more about OSPF on the routers. Would you post the output for these commands on both routers:

show ip ospf

show ip ospf neighbor

show ip route ospf

HTH

Rick

R1#show ip ospf
Routing Process "ospf 20" with ID 10.2.52.241
Start time: 00:01:38.345, Time elapsed: 2y14w
Supports only single TOS(TOS0) routes
Supports opaque LSA
Supports Link-local Signaling (LLS)
Supports area transit capability
Supports NSSA (compatible with RFC 3101)
Supports Database Exchange Summary List Optimization (RFC 5243)
Event-log enabled, Maximum number of events: 1000, Mode: cyclic
It is an autonomous system boundary router
Redistributing External Routes from,
connected, includes subnets in redistribution
static, includes subnets in redistribution
Router is not originating router-LSAs with maximum metric
Initial SPF schedule delay 50 msecs
Minimum hold time between two consecutive SPFs 200 msecs
Maximum wait time between two consecutive SPFs 5000 msecs
Incremental-SPF disabled
Initial LSA throttle delay 50 msecs
Minimum hold time for LSA throttle 200 msecs
Maximum wait time for LSA throttle 5000 msecs
Minimum LSA arrival 100 msecs
LSA group pacing timer 240 secs
Interface flood pacing timer 33 msecs
Retransmission pacing timer 66 msecs
EXCHANGE/LOADING adjacency limit: initial 300, process maximum 300
Number of external LSA 10. Checksum Sum 0x0400D1
Number of opaque AS LSA 0. Checksum Sum 0x000000
Number of DCbitless external and opaque AS LSA 0
Number of DoNotAge external and opaque AS LSA 0
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Number of areas transit capable is 0
External flood list length 0
IETF NSF helper support enabled
Cisco NSF helper support enabled
Reference bandwidth unit is 100 mbps
Area BACKBONE(0)
Number of interfaces in this area is 3 (1 loopback)
Area has message digest authentication
SPF algorithm last executed 1y19w ago
SPF algorithm executed 98 times
Area ranges are
Number of LSA 3. Checksum Sum 0x01D851
Number of opaque link LSA 0. Checksum Sum 0x000000
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0

 

 

 

 

R1#show ip ospf neighbor

Neighbor ID Pri State Dead Time Address Interface
10.2.52.240 1 FULL/BDR 00:00:33 10.2.52.233 Port-channel1.15

 

 

 


R1#show ip route ospf

Gateway of last resort is x.x.x.x to network 0.0.0.0


O E2 y.y.y.y/30 [110/20] via 10.2.52.233, 7w0d, Port-channel1.15
O 10.2.52.240/32 [110/2] via 10.2.52.233, 7w0d, Port-channel1.15

 

x.x.x.x is ISP1 IP address which is connected to R1
y.y.y.y is ISP2 IP address which is connected to R2

Thanks for the additional information. There are several things in the output that I find interesting:

- OSPF has been running for over 2 years

Start time: 00:01:38.345, Time elapsed: 2y14w

- OSPF has been extremely stable. Look at the last time the SPF algorithm executed

SPF algorithm last executed 1y19w ago

- there are 3 interfaces running OSPF of which 1 is the loopback

- there is only a single OSPF neighbor which is the other router

- there are only a few external LSA

Number of external LSA 10

and only 2 OSPF learned routes in the IP routing table

O E2 y.y.y.y/30 [110/20] via 10.2.52.233, 7w0d, Port-channel1.15
O 10.2.52.240/32 [110/2] via 10.2.52.233, 7w0d, Port-channel1.15

And the OSPF learned routes are for the other router ISP address and other router OSPF router ID. I am not sure that either of these entries are particularly important.

 

You asked what benefit in running OSPF. At this point I think I am pretty close to being able to answer the question. I will note that there are still things about this environment that we do not know and something there might be significant and change my answer. But based on what we know so far I would say that there is very little benefit from running OSPF.

 

In the environment where you were using a static default route there might have been some benefit in running OSPF. With a static default route and with redistribute connected a router would have advertised its default route to its neighbor. If the neighbor experienced some problem and lost its own static default route it might have been able to use the OSPF learned route. Having said that it might be useful I will also say that its usefulness is pretty limited. To be useful a router would have to have lost its configured static default route. That would mean that its outside interface was in a down state. In a previous response I discussed the fact that a router might lose its BGP neighbor (and therefore lost its ability to forward outbound traffic) but for the outside interface to not be down. This is a much more likely scenario than having the outside interface to go completely down. The failover solution using the BGP advertised default route is a much more effective solution and the OSPF solution.

HTH

Rick

If External interface of Router 1 , R1 goes down or if there is a Problem at ISP1 ,

 

In both cases , BGP between R1 and ISP1 will be impacted  and traffic will flow through IBGP to Router 2 and then via ISP2 ( as explained in previous updates)

 

how OSPF is handling the default route ? as we cant see default route being sent over OSPF  , we can only see ISP2 IP address .

 

From my understanding , OSPF vlan 15 is only acting as carrier for IBGP .  

....

The story of BGP is clear and one router going down and other taking over is OK .

 

There is no need to use same ISP as this is not possible if one ISP link goes down ; Both are different ISPs and have different Public range.

 

Most of the things are clear . There is ofcourse no full proof failover as R1 and R2 are not learning default route but instead learning everything other than default route .

 

The only confusion left is purpose of OSPF .

 

FOr another time , i will post a more clear visio .

 

 

You ask this question "how OSPF is handling the default route ?" That is fairly straightforward. If you want OSPF to advertise a default route you must configure the OSPF command default-information originate. Perhaps this link will have some details that you would find helpful

https://www.cisco.com/c/en/us/support/docs/ip/open-shortest-path-first-ospf/47868-ospfdb9.html

 

You have made several references to OSPF as a carrier for IBGP. If you have a pair of routers that you want to run IBGP and those routers are not directly connected (if there are some routers in between them that are not running BGP) then you might need a protocol like OSPF to provide the IP connectivity between IBGP peers. But if router 1 and router 2 are directly connected using a common subnet between them then I do not see where OSPF would be needed for IBGP.

HTH

Rick

Ok understood .

 

I am also attaching the visio i quickly createdPIC1.png

and currently we are not injecting default route to OSPF as neither we are  advertising  0.0.0.0 into the OSPF domain

nor we are using default-information originate command . This is my understanding

I have gone back and read again all of the posts in this extensive discussion. And I realize that many of my posts have addressed this network in terms of how I would want it to process, and have not adequately recognized how it does currently process. So let me say some things about the current environment and then about what I would want it to be like.

 

Let me also say that part of the confusion has been that some things have shifted as the discussion has progressed. Originally OSPF was using vlan 11 and subnet 10.2.2.0 and in later posts OSPF is using vlan 15 and 10.2.52.0. Not sure what else might have shifted, and believe that ultimately the changes are not significant.

 

I believe that it might help to discuss this network design as having 2 major parts. One part is the routing logic for inside the network and the other part is the routing logic for getting outside of the network.

 

Routing inside of the network uses the switches (for vlan assignments and forwarding at layer 2) and the firewalls for layer 3 logic (and the routers have no role in any of this). The firewalls have knowledge of all inside subnets, have responsibility for routing between inside subnets, have responsibility for forwarding from inside subnets to outside. We have not seen any details about this but it is logical to assume that the firewalls set their default gateway for access outside to use the GLBP virtual address. 

 

Routing for getting outside of the network is on the routers (and the firewalls and the core switches have no role in this). In the environment at the beginning of the discussion each router had its own static default route with its BGP peer as the next hop. The forwarding logic of GLBP would decide which router received traffic from inside going outside and the router that received that traffic would forward outside using its static default route. So the failover mechanism is GLBP and static default route.

 

It seems to me that this architecture works ok as long as all its parts are working. But I am concerned about what happens when something is not working as intended.

1) The logic that we have seen for GLBP will choose one of the routers to be the active router. We have not seen any logic that would recognize a problem on the active router (especially loss of connectivity to its BGP peer) and shift the active router to the other router. Does that logic exist?

2) As I discussed in a previous post there are issues with a static default route, especially  the possibility that you could lose connectivity to the BGP peer but the interface not go to the down state. In that situation the default route would continue to be active, but would be trying to forward traffic to a next hop that is not reachable.

 

So my opinion is that is some circumstances the routers might failover (as apparently was tested at one point) if an interface was shut down or the router taken out of service. But in some other circumstances failover might not work as expected. 

 

In terms of how I might want to see this network operate I would prefer that the failover mechanism be based on BGP rather than GLBP and static default routes. Assuming that each ISP does advertise a default route then each router would learn a default route and if there was a problem with one of the ISP then its default route would be withdrawn and the routers would realize that they need to use the other router to get outside.

 

In several respects I believe that the network configuration is more complex than it needs to be and would suggest some simplification. It appears that both ISP are advertising the full BGP set of Internet routes. I do not see a reason why this organization needs to receive 2 sets of complete routes. Receiving the full Internet set of routes makes sense for an organization that wants to use both ISP in a load sharing operation where some routes are best through one ISP while other routes are best through the other ISP. But clearly this organization is operating in an active BGP/backup BGP where all traffic is sent through one ISP and the second ISP is used only for failover. Requesting each ISP to advertise just a default route would significantly reduce the processing overhead on each router and would achieve the primary/backup relationship more efficiently.

 

I also think the IBGP is more complex than it needs to be. For example the use of peer groups in the IBGP would be appropriate when there are more than 2 IBGP routers. But when there are only 2 I do not see much benefit from peer groups. Another example of unnecessary complexity is the use of the Loopback interface for the IBGP peer. Using loopback interface addresses makes good sense when there are more than one path to reach the peer (if the primary path fails there could be a second path to reach the IBGP peer). On these routers there are 2 vlans that connect them. But clearly vlan 14 is for only Inside traffic and vlan 11/15 is for outside traffic. If there is no alternate path then there is no advantage in using loopback interfaces for IBGP peering.

 

And using the vlan 11/15 interface address as the IBGP peering address would remove the need for OSPF. I have been quite slow to recognize that in the current environment that OSPF is indeed required for IBGP - because it is OSPF that lets one router know how to reach the IBGP peer address. If the IBGP peering used the vlan interface address then there is no need for OSPF.

HTH

Rick

Hello Richard ;

 

Thanks for the detailed explanation .

 

It is indeed vlan 15 (ospf) and not vlan 11   . And correct Network is 10.2.52. and not 10.2.2  . ( It was a mistake from my end).

 

FW is sending the traffic to GLBP VIP . Whosoever Router is holding the VIP will handle the traffic .

 

The point here is that From FW point of view, it can forward the traffic to active router holding the glpb VIP . But what if external Interface of the router goes down . The GLBP is not monitoring or polling (health check)the external interface . It is purely on the basis of prirotity configured on GLB config on both the routers.

 

The point of receieving so many routes from both ISP seems not a good decision as you mentioned and it only increases the processing power of router . I will highlight this to customer .

 

 

You are also right , there is only 1 path for both routers to reach their loopbacks 

Cant we use simply the VLAN 15 address as loopback .

 

I dont understand the statement you made

in the current environment that OSPF is indeed required for IBGP - because it is OSPF that lets one router know how to reach the IBGP peer address. If the IBGP peering used the vlan interface address then there is no need for OSPF.

 

OSPF is having two routes - the vlan 15 interface and ISP address ,  how it is helping BGP ? This is the only point not clicking to me still . I am confused as OSPF routes never say anything about default ( or so many routes sent by ISP)

 

 

 

There are several things I would like to address. First you ask this question "Cant we use simply the VLAN 15 address as loopback." Perhaps it is simply a confusion about terminology. A loopback is a particular type of virtual interface. A vlan interface is a particular type of virtual interface. And they are not interchangeable. A vlan interface can not be a loopback and a loopback interface can not be a vlan.

 

Then let me address this statement that you make "OSPF is having two routes - the vlan 15 interface and ISP address" This is not correct. It is not the vlan 15 address that is advertised but is the loopback interface address that is used. (note that the loopback interface address is used both as the OSPF Router ID and used as the IBGP peer address.

 

Then let me try to clarify my statement about OSPF and IBGP. Looking into the configuration of IBGP we find that one router defines the IBGP neighbor as 10.2.52.240. This address is the loopback interface address of the peer router. To form the IBGP peer relationship the router must know how to reach the peer address. So how does this router know how to reach 10.2.52.240? That address is advertised by OSPF. So this is the basis of my statement about OSPF and IBGP. If OSPF did not advertise that address then IBGP would not work. So OSPF is necessary for this implementation of IBGP.

 

It does not have to be done this way. I suggest an alternative: configure IBGP so that the IBGP neighbor address is the vlan 15 address of the peer router (rather than as the loopback address). If the neighbor address is the vlan 15 address then the router knows how to reach that address (it is in a directly connected subnet) and there is no need for OSPF.

 

This is one example of making things more complex than they need to be. There are some good reasons why you might choose to make the IBGP neighbor address be on a loopback interface. But those reasons are not present in this network. By changing the IBGP neighbor address to the vlan interface rather than the loopback interface we remove the requirement for OSPF and make the configuration more simple.

HTH

Rick

Thanks @Richard Burts  . That was a long thread but people like you make things understand . I am vey much thankful to you and all othes involved .

 

Note : I would be interested to know the reasons may be at a  high level why loopback interface  for bgp neighbours. What are those scenarios

 

Onec again, thank you .

You are welcome. It has been a long discussion and I am glad that our explanations have been helpful.  This community is an excellent place to ask questions and to learn about networking. I hope to see you continue to be active in the community.

 

I tried to explain about BGP neighbors using loopback addresses or not in a previous response. It seems that was not so clear so let me try again from a slightly different perspective. Let us think about 2 routers, routerA and routerB who want to become BGP neighbors (it might be IBGP or it might be EBGP, same things apply to both). Let us assume that the routers are connected using vlan 15. The simple way is for both routers in their bgp neighbor commands to use the vlan 15 interface IP address. When it is configured this way there is no need for any other routing protocol to be running on the routers. The routers are attempting to access the neighbor on a connected subnet and all they need to do is to arp for each other. When this is configured the BGP neighbor relationship will be negotiated and they become active neighbors and remain active neighbors as long as vlan 15 continues to work. But if something happens on vlan 15 and it stops working then the BGP neighbor relationship is terminated. 

 

That is the more simple approach for BGP neighbors (to use directly connected subnet addresses as neighbor address). But let us think about routerA and routerB and what might happen if both routers are also connected using vlan 10 (in addition to vlan 15). If the routers continue to use the subnet address of vlan 15 as the neighbor address then they are dependent on vlan 15 to maintain the neighbor relationship. But if the routers were to use some IP address on the other router that was reachable using either vlan 10 or vlan 15 then the routers are not dependent on a single connection and can take advantage of the redundancy of their connections. A loopback interface address is frequently used for this. 

 

So using a loopback interface address as the BGP neighbor address takes advantage of possible redundant connections. Since the routers are now using an address that is not directly connected they can no longer simply arp for the neighbor address but must have some routing information about how to reach the neighbor. It might use some routing protocol like OSPF or might use something simple like static routes.

 

So configuring BGP neighbor statements with loopback interfaces is more complicated but takes advantage of potential redundancy. And configuring BGP neighbor statements with a connected subnet address is more simple, but does not provide redundancy. It is a choice to be made when the network design is being done.

 

So let us now think about your discussion. Your routers were configured with loopback interface addresses in the BGP neighbor statements, which suggests redundancy. And OSPF was being used and the loopback interface addresses were being advertised which also suggests redundancy. But you were using only vlan 15. It was quite clear that in the network design of your network that vlan 14 was for inside traffic and vlan 15 was for outside traffic (like BGP). So you had the more complex configuration (loopback interfaces and OSPF) but were using only a single connection. So my advice was to use the more simple configuration of BGP neighbor using the vlan 15 interface addresses. 

HTH

Rick
Review Cisco Networking for a $25 gift card