DEVNET.

BGP automatic-tag & as-path tag

When redistributing BGP into an IGP we lose all our BGP attributes. In the diagram below, R2 redistributes BGP into OSPF. R3 then redistributes OSPF into BGP. When R4 finally receives the 100.100.100.0/24 prefix, it will appear as though AS 20 was the originating AS. It will also appear as though the origin code of the route is a ? (redistributed) because AS20 injected this route from OSPF into BGP. Obviously this is all wrong, as AS10 originated the prefix, and he did so with a BGP network statement; it wasn’t redistributed. In this lab we’re going to use the automatic-tag and as-path tag commands so that R3 will advertise the correct BGP AS_PATH & ORIGIN information to R4.

I have provided the BGP & OSPF configuration on each device (currently).

R1#sh run | s router
router bgp 10
no synchronization
bgp router-id 1.1.1.1
bgp log-neighbor-changes
network 14.14.14.0 mask 255.255.255.252
network 100.100.100.0 mask 255.255.255.0
neighbor 14.14.14.2 remote-as 20
no auto-summary
R2#sh run | s router
router ospf 1
log-adjacency-changes
redistribute bgp 20 subnets
passive-interface FastEthernet0/0
network 12.12.12.0 0.0.0.3 area 0
network 14.14.14.0 0.0.0.3 area 0
router bgp 20
no synchronization
bgp router-id 2.2.2.2
bgp log-neighbor-changes
redistribute ospf 1 match internal external 1 external 2
neighbor 14.14.14.1 remote-as 10
no auto-summary
R3#sh run | s router
router ospf 1
log-adjacency-changes
redistribute bgp 20 subnets
passive-interface FastEthernet1/0
network 12.12.12.0 0.0.0.3 area 0
network 26.26.26.0 0.0.0.3 area 0
router bgp 20
no synchronization
bgp router-id 3.3.3.3
bgp log-neighbor-changes
redistribute ospf 1 match internal external 1 external 2
neighbor 26.26.26.2 remote-as 30
no auto-summary
R4#sh run | s router
router bgp 30
no synchronization
bgp router-id 4.4.4.4
bgp log-neighbor-changes
neighbor 26.26.26.1 remote-as 20
no auto-summary
Let’s start by configuring the as-path tag. By default, when you redistribute BGP into an IGP, IOS will set the Tag field with the AS_PATH attribute. We can see this on R2 below:

R2#sh ip route 100.100.100.0
Routing entry for 100.100.100.0/24
Known via “bgp 20”, distance 20, metric 0
Tag 10, type external
Redistributing via ospf 1
Advertised by ospf 1 subnets
Last update from 14.14.14.1 00:49:31 ago
Routing Descriptor Blocks:
* 14.14.14.1, from 14.14.14.1, 00:49:31 ago
Route metric is 0, traffic share count is 1
AS Hops 1
Route tag 10
This value is propagated to R3. All we need to do, is bring the value in the Tag field back out when we advertise prefixes to R4. Let’s do that now. I’m also going to include a before and after shot of the BGP table on R4 for the 100.100.100.0/24 prefix. You will see that the AS_PATH gets adjusted.

//Before
R4#sh ip bgp 100.100.100.0
BGP routing table entry for 100.100.100.0/24, version 17
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0x820
Not advertised to any peer
20
26.26.26.1 from 26.26.26.1 (3.3.3.3)
Origin incomplete, metric 1, localpref 100, valid, external, best
R3#conf t
R3(config)#route-map GET_TAG permit 10
R3(config-route-map)#set as-path ?
prepend Prepend to the as-path
tag Set the tag as an AS-path attribute

R3(config-route-map)#set as-path tag

R3(config-route-map)#router bgp 20
R3(config-router)#redistribute ospf 1 match internal external 1 external 2 route-map GET_TAG
//After
R4#sh ip bgp 100.100.100.0
BGP routing table entry for 100.100.100.0/24, version 16
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0x820
Not advertised to any peer
20 10
26.26.26.1 from 26.26.26.1 (3.3.3.3)
Origin incomplete, metric 1, localpref 100, valid, external, best
Cool, so we’ve fixed the AS_PATH problem. However, our Origin code still says “incomplete”. The way we fix this is by setting the automatic-tag when the route was originally redistributed from BGP into OSPF on R2.

R2(config)#router bgp 20
R2(config-router)#table-map set_tag
R2(config-router)#
R2(config-router)#route-map set_tag permit 10
R2(config-route-map)#match as-path 1
R2(config-route-map)#set automatic-tag
R2(config-route-map)#exit
R2(config)#ip as-path access-list 1 permit .*
R2(config)#end
R2#clear ip bgp *
If we check R4, we cab now see that the origin code is now correct.

R4#sh ip bgp 100.100.100.0
BGP routing table entry for 100.100.100.0/24, version 19
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0x820
Not advertised to any peer
20 10
26.26.26.1 from 26.26.26.1 (3.3.3.3)
Origin IGP, metric 1, localpref 100, valid, external, best

Share:

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *

Become a member

Full Access to 739 Lessons. New Lessons Added Every Week!

Awesome Deal! Get 2 Months for FREE!

No Obligations. Cancel At Any Time!