cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3264
Views
1
Helpful
13
Replies

BGP Default Route from 2 ISP

CCIE Aspirant
Level 1
Level 1

Hi,

 

we have one router that is connected to two ISP and we are running BGP with both of these two ISP. Both of these ISP are sending us only default route. The problem is that one ISP sending us default route with one AS path (their AS) but the other ISP is sending us the default route with two as path. 

so how we can make the one ISP to receive the default route with two ISP. So the end result we wants to receive the default route from two ISP with path having two ISP in it. so that we can perform load sharing.

 

 

 

 

13 Replies 13

pman
Spotlight
Spotlight

Hi,

 

you wrote "how we can make the one ISP to receive the default route with two ISP"

So I guess what you want to do is to prepend the ASN of ISP in such a way that the ASN will appear twice in AS-PATH instead of once in your router.

how to use the Inbound AS-Path Prepending command:

example:

The set as-path prepend last-as prepends the first AS in the AS-path (neighbor’s AS). You can use this command in an inbound route-map to simplify your configuration and make the route-map independent of the neighbor’s AS number.

neighbor 100.0.0.1 route-map prepend-In in
route-map prepend-In permit 10
set as-path prepend last-as 1

here is another example:

router bgp 2
bgp log-neighbor-changes
neighbor 1.1.1.1 remote-as 1
neighbor 1.1.1.1 ebgp-multihop 3
neighbor 1.1.1.1 update-source Loopback0
neighbor 1.1.1.1 route-map pre in

!

ip prefix-list DEFAULT seq 5 permit 0.0.0.0/0

!

route-map pre permit 10
  match ip address prefix-list DEFAULT
  set as-path prepend last-as 1

 

R2(config-route-map)# do show ip bgp
BGP table version is 2, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
                     r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
                     x best-external, a additional-path, c RIB-compressed,
                     t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network       Next Hop                 Metric   LocPrf   Weight   Path
*> 0.0.0.0       1.1.1.1                                         0   0           1 1 i

 

Hi @pman 

thanks for the reply.

 

we are getting default route from two isp and isp 1 is sending with one as path and isp2 is sending default route with two as path. so we wanted to make our router to receive the default route with two as path as well.

 

i have tried the method suggested by you. below is the result.

 

 

R2#sh route-map
route-map PREP_AS_ISP1, permit, sequence 10
Match clauses:
ip address prefix-lists: DEFAULT_ROUTE_ISP1
Set clauses:
as-path prepend last-as 2
Policy routing matches: 0 packets, 0 bytes

 


R2#sh ip prefix-li
ip prefix-list DEFAULT_ROUTE_ISP1: 1 entries
seq 5 permit 0.0.0.0/0
ip prefix-list def: 0 entries

 


R2#sh ip bgp nei 87.101.154.9 received- | b Netw
Network Next Hop Metric LocPrf Weight Path
* 0.0.0.0 87.101.154.9 0 35753 i

 

i need to have output like below

 

*> 0.0.0.0 87.101.154.9 0 35753 35753 i

 

 

Hi,

please set the number to 1: set as-path prepend last-as 1

try to clear route (better with the : clear ip bgp neighbor soft in)

Hi @pman 

i have changed it to set as-path prepend last-as 1 

but still no difference.

 

please attache BGP config

R1

 

R1#sh run | s bgp
router bgp 35753
bgp log-neighbor-changes
neighbor 87.101.154.10 remote-as 212758
neighbor 87.101.154.10 ebgp-multihop 3
neighbor 87.101.154.10 default-originate

R1#sh ip int br
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 10.10.10.2 YES manual up up
GigabitEthernet1/0 87.101.154.9 YES manual up up

 

 

 

R2

 

 

R2#sh run | s bgp
router bgp 212758
bgp log-neighbor-changes
neighbor 87.101.154.9 remote-as 35753
neighbor 87.101.154.9 ebgp-multihop 3
neighbor 87.101.154.9 soft-reconfiguration inbound
neighbor 87.101.154.9 route-map PREP_AS_ISP1 in
R2#
R2#
R2#sh ip int br
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
GigabitEthernet1/0 87.101.154.10 YES manual up up

Hi @CCIE Aspirant ,

 

In addition the aspath prepend solution proposed by the other poster, you also need to configure the following BGP statements:

 

router bgp 35753

bgp bestpath as-path multipath-relax    <+++++++++++ Allow load balancing between paths from different AS (hidden command)
maximum-paths 2    <++++++++++++++++++++++++++ Needed for BGP load balancing

 

Regards,

 

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

Hi @Harold Ritter 

thanks for the reply 

actually i can do load balancing only in case when i see both routes are coming to my router with same As path. Now if i do load balancing by using the above method it will  not work as one isp is sending default route with one as path and other isp sends with two as path so the one with one as path will wins and I can't do load balance

Hi @CCIE Aspirant ,

 

This why you need to configure the "bgp bestpath as-path multipath-relax". This will allow to load balance between prefixes coming from different ASN. The as path needs to be of the same length though, hence the aspath prepend to make both paths the same length. See the working example below:

 

router bgp 1
bgp log-neighbor-changes
bgp bestpath as-path multipath-relax
neighbor 192.168.12.2 remote-as 2
neighbor 192.168.12.2 route-map test in
neighbor 192.168.13.3 remote-as 3
maximum-paths 2

!

route-map test permit 10
set as-path prepend 2

!

 

AS1#sh bgp ipv4 uni 0.0.0.0
BGP routing table entry for 0.0.0.0/0, version 8
Paths: (2 available, best #2, table default)
Multipath: eBGP
Advertised to update-groups:
4
Refresh Epoch 1
3 3
192.168.13.3 from 192.168.13.3 (192.168.100.3)
Origin IGP, metric 0, localpref 100, valid, external, multipath(oldest)
rx pathid: 0, tx pathid: 0
Refresh Epoch 1
2 2
192.168.12.2 from 192.168.12.2 (192.168.100.2)
Origin IGP, metric 0, localpref 100, valid, external, multipath, best
rx pathid: 0, tx pathid: 0x0
AS1#

 

AS1#show ip route 0.0.0.0
Routing entry for 0.0.0.0/0, supernet
Known via "bgp 1", distance 20, metric 0, candidate default path
Tag 2, type external
Last update from 192.168.12.2 00:03:20 ago
Routing Descriptor Blocks:
* 192.168.13.3, from 192.168.13.3, 00:03:20 ago
Route metric is 0, traffic share count is 1
AS Hops 2
Route tag 2
MPLS label: none
192.168.12.2, from 192.168.12.2, 00:03:20 ago
Route metric is 0, traffic share count is 1
AS Hops 2
Route tag 2
MPLS label: none
AS1#

 

 

Regards,

 

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

Dear @Harold Ritter  @pman 

please go through the following configs and tell me where i am making mistake.

Appreciate your support.

 

 


[ISP1] (g1/0)<---->(g1/0) [MY_Router] (fa0/0) <-----> (fa0/0) [ISP2]


======================
*****ISP1 Router*****
======================
interface GigabitEthernet1/0
ip address 87.101.154.9 255.255.255.252


ip route 0.0.0.0 0.0.0.0 Null0


router bgp 35753
bgp log-neighbor-changes
neighbor 87.101.154.10 remote-as 212758
neighbor 87.101.154.10 default-originate


===========================================


======================
*****ISP2 Router*****
======================


interface FastEthernet0/0
ip address 172.17.4.137 255.255.255.252


ip route 0.0.0.0 0.0.0.0 Null0


router bgp 25299
bgp log-neighbor-changes
neighbor 172.17.4.138 remote-as 212758
neighbor 172.17.4.138 default-originate


===========================================


======================
*****MY Router*****
======================


interface GigabitEthernet1/0
ip address 87.101.154.10 255.255.255.252

interface FastEthernet0/0
ip address 172.17.4.138 255.255.255.252


router bgp 212758
bgp log-neighbor-changes
bgp bestpath as-path multipath-relax
neighbor 87.101.154.9 remote-as 35753
neighbor 87.101.154.9 soft-reconfiguration inbound
neighbor 87.101.154.9 route-map ISP1_DEF_PREP in
neighbor 172.17.4.137 remote-as 25299
neighbor 172.17.4.137 soft-reconfiguration inbound
maximum-paths 2

 


route-map ISP1_DEF_PREP permit 10

set as-path prepend 35753


===========================================

Results

MY_ROUTER#sh ip bgp neighbor 87.101.154.9 received- | b Net

Network Next Hop Metric LocPrf Weight Path
* 0.0.0.0 87.101.154.9 0 35753 i

 

 


MY_ROUTER#sh ip route bgp

Gateway of last resort is 172.17.4.137 to network 0.0.0.0

B* 0.0.0.0/0 [20/0] via 172.17.4.137, 00:13:12

 

MY_ROUTER#sh ip route 0.0.0.0
Routing entry for 0.0.0.0/0, supernet
Known via "bgp 212758", distance 20, metric 0, candidate default path
Tag 25299, type external
Last update from 172.17.4.137 00:13:53 ago
Routing Descriptor Blocks:
* 172.17.4.137, from 172.17.4.137, 00:13:53 ago
Route metric is 0, traffic share count is 1
AS Hops 1
Route tag 25299
MPLS label: none

 

 

 

 

HI @CCIE Aspirant ,

 

Your 2 paths do not have equal as path length. You prepend to the prefix received from 35753, but not the one received from 25299. If you want to recreate the situation where 35753 sends you an as path length of 2 and 25299 an as path length of 1, you should probably do the as path prepend from the 35753 side and on your side do the as path prepend for 25299 to ensure that both as path are of equal length. That is what I did in my working example.

 

To do the as path prepend on the 35753 side, I would suggest the following configuration:

 

router bgp 35753
bgp log-neighbor-changes

neighbor 87.101.154.10 remote-as 212758

neighbor 87.101.154.10 route-map prepend out

network 0.0.0.0

!

route-map prepend permit 10

set as-path prepend 35753

!

 

and to make sure that both paths have the same as path length on your side, you need to prepend the path received from 25299 with the following configuration:

 

router bgp 212758
neighbor 172.17.4.137 remote-as 25299
neighbor 172.17.4.137 route-map prepend in

!

route-map prepend permit 10

set as-path prepend 25299

!

 

 

 

 

Regards,

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

@Harold Ritter 

the problem is that we are receiving the default route from ISP2 with 2 AS Path. so all of these things i am doing for to achieve load balancing. ISP 1 is fine and they are sending Default route with One As Path. 

we asked ISP 2 to send us the default route with one AS Path but they did not do it for us. 

so either we have to ask ISP1 to send us the route with 2 AS Path. As i have tried all the method mentioned here or from any documents i searched. and above configurations i have done on GNS3 and in real environment i do not have access to ISP.

 

So if there is some other workaround for that i would really appreciate that.

 

 

 

 

Hi @CCIE Aspirant ,

 

But neither of the 35753 and 25299 are doing the prepend from the lab config you provided. Can you provide a "show bgp ipv4 uni 0.0.0.0" from the router with AS212758 from your lab.

 

Regards,

Regards,
Harold Ritter, CCIE #4168 (EI, SP)