cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
13060
Views
0
Helpful
26
Replies

BGP default route route-map

Krasnoperov
Level 1
Level 1

Please advise

I have BGP peer with upstaream ISP

I need recieve default route only

I want to do this via route-map with prefix-list (not just perfix-list)

How can I do this?

Now I do next (but it doesn't work)

router bgp 5xxxx

bgp log-neighbor-changes

bgp deterministic-med

neighbor 193.xxx.zzz.xx remote-as 900

neighbor 193.xxx.zzz.xx description ISP UpStream

neighbor 193.xxx.zzz.xx version 4

address-family ipv4

  network 193.0.0.0 mask 255.255.252.0

  neighbor 193.xxx.zzz.xx activate

  neighbor 193.xxx.zzz.xx soft-reconfiguration inbound

  neighbor 193.xxx.zzz.xx route-map map-900-ISP-in in

  neighbor 193.xxx.zzz.xx route-map map-900-ISP-out out

sh route-map map-900-ISP-in

route-map map-900-ISP-in, permit, sequence 30

  Match clauses:

    ip address prefix-lists: def_only

  Set clauses:

  Policy routing matches: 0 packets, 0 bytes

route-map map-900-ISP-in, permit, sequence 40

  Match clauses:

  Set clauses:

    local-preference 90

  Policy routing matches: 0 packets, 0 bytes

sh ip prefix-list def_only

ip prefix-list def_only: 2 entries

   seq 15 deny 0.0.0.0/0 ge 1

   seq 20 permit 0.0.0.0/0

2 Accepted Solutions

Accepted Solutions

Best option will be to ask your ISP to give you only default route.

Apart from that, I have found that as-path access-list are very handy for such situation. Just permit ^$ in AS-PATH access-list and you are done.

However, as per your requirement ( assuming your ISP do give you default route).

ip prefix-list DEFAULT permit 0.0.0.0/0

route-map MATCH_DEFAULT

match ip address prefix DEFAULT

router bgp AS_NUMBER

neighbour X.X.X.X route-map MATCH_DEFAULT in

above mention commands, will do the trick

PS: The rest of the routes will still be in BGP stable, however routing table will install only default learning via BGP in its routing table.

Regards,

Smitesh

PS: Please rate helpful posts.

View solution in original post

Hi,

get rid of the permit 30 statement in your inbound route-map

Regards.

Alain

Don't forget to rate helpful posts.

Don't forget to rate helpful posts.

View solution in original post

26 Replies 26

Best option will be to ask your ISP to give you only default route.

Apart from that, I have found that as-path access-list are very handy for such situation. Just permit ^$ in AS-PATH access-list and you are done.

However, as per your requirement ( assuming your ISP do give you default route).

ip prefix-list DEFAULT permit 0.0.0.0/0

route-map MATCH_DEFAULT

match ip address prefix DEFAULT

router bgp AS_NUMBER

neighbour X.X.X.X route-map MATCH_DEFAULT in

above mention commands, will do the trick

PS: The rest of the routes will still be in BGP stable, however routing table will install only default learning via BGP in its routing table.

Regards,

Smitesh

PS: Please rate helpful posts.

----------------------------------------------

However, as per your requirement ( assuming your ISP do give you default route).

ip prefix-list DEFAULT permit 0.0.0.0/0

route-map MATCH_DEFAULT

match ip address prefix DEFAULT

router bgp AS_NUMBER

neighbour X.X.X.X route-map MATCH_DEFAULT in

above mention commands, will do the trick

----------------------------------------------------

I tried this, unfortunatly I stil receive all routes that provider push me

In routing table or in BGP table ??

Meanwhile, I will just lab it to confirm the same.

Regards,

Smitesh

both

Ahhh...

Please remove seq 15 from your prefix-list and check

Don't forget to soft clear bgp after you modify you configs.

Regards,

Smitesh

Hi,

do this : clear ip bgp * in and it will work

Regards.

Alain

Don't forget to rate helpful posts.

Don't forget to rate helpful posts.

is that ok if do

neigbour x.x.x.x shut

no neigbour x.x.x.x shut

same result

Hi,

Yes, it will result same, however with taking your bgp peer down.

If you are logging into router from some remote location and if you only have one ISP link, you will lose the connectivity to router as soon as neig X.X.X.X shut command is issued.

In my opinion best will be to do

clear ip bgp * soft in

Regards,

Smitesh

Hi,

no just do a soft clear like i proposed.

Regards.

Alain

Don't forget to rate helpful posts.

Don't forget to rate helpful posts.

I can't do that to *

Is that ok

clear ip bgp 193.xxx.zzz.xx soft in

same result

I guess, Cadet had typo error.

Yup you can do the command which you have suggested; however as informed by you in one of the thred that you shut/no-shutted bgp peer; but still the same status.

Then, even if you soft clear the bgp peer will not get you any better results.

But again there  is not harm in doing the same.

clear ip bgp * soft in

Regards,

Smitesh

I just did a quick lab, and as I suggested earlier, it works !!!

I made simple topology as R1--------------R2.

Please see config below and show command outputs:

---

R1

---

int lo0

ip add 1.1.1.1 255.255.255.0

int lo1

ip add 11.11.11.11 255.255.255.0

int fa0/0

ip add 192.168.1.1 255.255.255.0

no shut

router bgp 100

net 1.1.1.0 mask 255.255.255.0

net 11.11.11.0 mask 255.255.255.0

net 0.0.0.0 mask 0.0.0.0

nei 192.168.1.2 remote 200

exit

ip route 0.0.0.0 0.0.0.0 Null0

end

----

R2

----

int lo0

ip add 2.2.2.2 255.255.255.0

int lo1

ip add 22.22.22.22 255.255.255.0

int fa0/0

ip add 192.168.1.2 255.255.255.0

no shut

router bgp 200

net 2.2.2.0 mask 255.255.255.0

net 22.22.22.0 mask 255.255.255.0

nei 192.168.1.1 remote 100

nei 192.168.1.1 route-map DEF in

ip prefix DEF permit 0.0.0.0/0

route-map DEF

match ip add prefix DEF

exit

end

R2#sh ip bgp regexp ^[^$]

BGP table version is 4, local router ID is 22.22.22.22

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path

*> 0.0.0.0          192.168.1.1              0             0 100 i

R2#sh ip bgp summ

BGP router identifier 22.22.22.22, local AS number 200

BGP table version is 4, main routing table version 4

3 network entries using 360 bytes of memory

3 path entries using 156 bytes of memory

3/2 BGP path/bestpath attribute entries using 372 bytes of memory

1 BGP AS-PATH entries using 24 bytes of memory

0 BGP route-map cache entries using 0 bytes of memory

0 BGP filter-list cache entries using 0 bytes of memory

Bitfield cache entries: current 1 (at peak 1) using 32 bytes of memory

BGP using 944 total bytes of memory

BGP activity 3/0 prefixes, 3/0 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd

192.168.1.1     4   100       9       9        4    0    0 00:05:33        1

R2#

R2#sh ip route bgp

B*   0.0.0.0/0 [20/0] via 192.168.1.1, 00:05:15

R2#

Regards,

Smitesh

router bgp 5xxxx

bgp log-neighbor-changes

bgp deterministic-med

neighbor 193.xxx.zzz.xx remote-as 900

neighbor 193.xxx.zzz.xx description ISP UpStream

neighbor 193.xxx.zzz.xx version 4

address-family ipv4

  network 193.xxx.zzz.00 mask 255.255.252.0

  neighbor 193.xxx.zzz.xx activate

  neighbor 193.xxx.zzz.xx soft-reconfiguration inbound

  neighbor 193.xxx.zzz.xx route-map map-900-ISP-in in

  neighbor 193.xxx.zzz.xx route-map map-900-ISP-out out

sh route-map map-900-ISP-in

route-map map-900-ISP-in, deny, sequence 10

  Match clauses:

    as-path (as-path filter): 1

  Set clauses:

  Policy routing matches: 0 packets, 0 bytes

route-map map-900-ISP-in, permit, sequence 30

  Match clauses:

    ip address prefix-lists: def_only

  Set clauses:

  Policy routing matches: 0 packets, 0 bytes

route-map map-900-ISP-in, permit, sequence 40

  Match clauses:

  Set clauses:

    local-preference 90

  Policy routing matches: 0 packets, 0 bytes

sh ip as-path-access-list 1

AS path access list 1

    permit _6451[2-9]_

    permit _645[2-9][0-9]_

    permit _64[6-9][0-9][0-9]_

    permit _65[0-9][0-9][0-9]_

sh ip prefix-list def_only

ip prefix-list def_only: 1 entries

   seq 20 permit 0.0.0.0/0

sh ip route bgp

Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP

       + - replicated route, % - next hop override

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

B*    0.0.0.0/0 [20/0] via x.x.x.x, 01:38:58

B     193.xxx.zzz.00/22 [20/0] via 193.xxx.zzz.xx, 00:34:01

sh ip bgp

BGP table version is 62, local router ID is

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale, m multipath, b backup-path, x best-external, f RT-Filter

Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path

*  0.0.0.0          193.xxx.zzz.xx                         0 888 i

*>                  x.x.x.x                       200      0 777 i

*> 193.xxx.zzz.00/22 193.xxx.zzz.xx           0     90      0 900 i

I do neighbor 193.xxx.zzz.xx  shut

and no neighbor 193.xxx.zzz.xx  shut

still have route

Hi,

Not too sure why you are still receiving other routes apart from default.

Any chance, if you can reload the router and check if issue persists.

Apart from reload, you can also try using only prefix-list in route-map as suggested in my sample configs.

Regards,

Smitesh

Review Cisco Networking products for a $25 gift card