OSPF Route Tag Configuration example [GNS3 Lab]
Topology:
R1 configuration:
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
ip address 10.20.0.1 255.255.255.252
ip ospf 10 area 0
duplex full
!
router ospf 10
router-id 1.1.1.1
!
R2 configuration:
interface FastEthernet0/0
ip address 10.10.0.1 255.255.255.252
speed auto
duplex auto
!
interface FastEthernet0/1
ip address 10.20.0.2 255.255.255.252
ip ospf 10 area 0
speed auto
duplex auto
!
router ospf 10
router-id 2.2.2.2
redistribute connected
redistribute bgp 65545 subnets route-map BGP_to_OSPF
!
router bgp 65545
bgp log-neighbor-changes
bgp redistribute-internal
neighbor 10.10.0.2 remote-as 65545
!
ip prefix-list BGP_To_OSPF seq 5 permit 3.3.3.3/32
ip prefix-list BGP_To_OSPF seq 15 permit 4.4.4.4/32
!
route-map BGP_to_OSPF permit 10
match ip address prefix-list BGP_To_OSPF
set tag 10
R3 configuration:
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface Loopback1
ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
ip address 10.10.0.2 255.255.255.252
duplex full
!
router bgp 65545
bgp log-neighbor-changes
network 3.3.3.3 mask 255.255.255.255
network 4.4.4.4 mask 255.255.255.255
neighbor 10.10.0.1 remote-as 65545
- Verification on R1:
R1#show ip route
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 not set
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
O E2 3.3.3.3 [110/1] via 10.20.0.2, 00:17:24, FastEthernet0/0
4.0.0.0/32 is subnetted, 1 subnets
O E2 4.4.4.4 [110/1] via 10.20.0.2, 00:17:24, FastEthernet0/0
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.20.0.0/30 is directly connected, FastEthernet0/0
L 10.20.0.1/32 is directly connected, FastEthernet0/0
- We can see the tag when specifying the route:
R1#show ip route 3.3.3.3
Routing entry for 3.3.3.3/32
Known via "ospf 10", distance 110, metric 1
Tag 10, type extern 2, forward metric 1
Last update from 10.20.0.2 on FastEthernet0/0, 00:17:48 ago
Routing Descriptor Blocks:
* 10.20.0.2, from 2.2.2.2, 00:17:48 ago, via FastEthernet0/0
Route metric is 1, traffic share count is 1
Route tag 10
R1#show ip route 4.4.4.4
Routing entry for 4.4.4.4/32
Known via "ospf 10", distance 110, metric 1
Tag 10, type extern 2, forward metric 1
Last update from 10.20.0.2 on FastEthernet0/0, 00:17:54 ago
Routing Descriptor Blocks:
* 10.20.0.2, from 2.2.2.2, 00:17:54 ago, via FastEthernet0/0
Route metric is 1, traffic share count is 1
Route tag 10