Below are router configuration fragments for redistribution between OSPF network and BGP network.
PRI-P2P
!
router
ospf 1
router-id 10.35.1.254
area 0 authentication
redistribute bgp 65210 subnets route-map
B2O-IN
network 10.35.1.96 0.0.0.7 area 0
network 10.35.1.104 0.0.0.7 area 0
network 192.168.249.254 0.0.0.0 area 0
!
router
bgp 65210
bgp log-neighbor-changes
network 10.35.1.252 mask 255.255.255.252
network 192.168.249.254 mask 255.255.255.255
redistribute ospf 1 route-map O2B-OUT
neighbor 10.35.1.253 remote-as 65211
neighbor 10.35.1.253 password 7
xxxxxxxxxxxxxxxx
neighbor 10.35.1.253 send-community
neighbor 10.35.1.253 soft-reconfiguration
inbound
neighbor 10.35.1.253 route-map P2P-IN in
neighbor 10.35.1.253 route-map P2P-OUT out
!
!IP Ranges on BGP network side.
!
ip
prefix-list B2O seq 10 permit 97.0.0.0/11 ge 16
ip
prefix-list B2O seq 20 permit 10.64.0.0/11 ge 12
ip
prefix-list B2O seq 30 permit 192.168.97.0/24 ge 29
!
!IP Ranges on OSPF network side
!
ip
prefix-list O2B seq 10 permit 192.168.249.254/32
ip
prefix-list O2B seq 20 permit 10.0.0.0/10 ge 11
ip
prefix-list O2B seq 30 permit 10.96.0.0/11 ge 12
ip
prefix-list O2B seq 40 permit 10.128.0.0/9 ge 10
!
!Inbound filter - only accept advertisements of networks to be distributed.
!
ip
prefix-list P2P-IN-LIST seq 5 deny 0.0.0.0/0
ip
prefix-list P2P-IN-LIST seq 10 permit 97.0.0.0/11 ge 16
ip
prefix-list P2P-IN-LIST seq 20 permit 10.64.0.0/11 ge 12
ip
prefix-list P2P-IN-LIST seq 30 permit 192.168.97.0/24 ge 29
!
!Outbound filter - do not advertise DMVPN endpoint IPs, do not advertise default, permit anything else.
!
ip
prefix-list P2P-OUT-LIST seq 10 deny 192.168.255.0/24 ge 25
ip
prefix-list P2P-OUT-LIST seq 15 deny 0.0.0.0/0
ip
prefix-list P2P-OUT-LIST seq 20 permit 0.0.0.0/0 le 32
!
!
!
route-map
B2O-IN deny 5
match community 400 <== do not distribute BGP routes that have already been distributed.
!
route-map
B2O-IN permit 7
set tag 300 <== tag traffic that will be distributed into OSPF.
!
!
route-map
B2O-IN permit 10
match ip address prefix-list B2O
!
!
!Inbound filter - do not accept advertisements that this router will not redistribute.
!
!
route-map
P2P-IN deny 5
match community 400
!
route-map
P2P-IN permit 10
match ip address prefix-list P2P-IN-LIST
!
route-map
P2P-OUT permit 10
match ip address prefix-list P2P-OUT-LIST
!
route-map
O2B-OUT deny 5
match tag 300
!
route-map
O2B-OUT permit 7
set community 400
!
route-map
O2B-OUT permit 10
match ip address prefix-list O2B
!
PH-L3
!
router
ospf 1
router-id 172.17.1.20
log-adjacency-changes
area 0 authentication
redistribute bgp 65020 metric-type 1 subnets
route-map B2O-IN
network 10.35.244.0 0.0.0.3 area 0
network 172.17.1.0 0.0.0.255 area 0
!
router
bgp 65020
no synchronization
bgp router-id 10.35.1.241
bgp log-neighbor-changes
network 10.35.1.40 mask 255.255.255.252
network 192.168.255.20 mask 255.255.255.255
redistribute ospf 1 route-map O2B-OUT
neighbor 10.35.1.42 remote-as 10
neighbor 10.35.1.42 send-community
neighbor 10.35.1.42 soft-reconfiguration
inbound
neighbor 10.35.1.42 route-map CORE-IN in
neighbor 10.35.1.42 route-map B2O-DENY out
neighbor 10.35.1.245 remote-as 3549
neighbor 10.35.1.245 password 7
XXXXXXXXXXXXXXXXXXX
neighbor 10.35.1.245 route-map MPLS-FILTER-OUT
out
no auto-summary
!
ip
prefix-list B2O seq 10 permit 97.0.0.0/11 ge 16
ip
prefix-list B2O seq 90 permit 192.168.97.0/24 ge 29
ip
prefix-list B2O seq 100 permit 10.64.0.0/11 ge 12
!
ip
prefix-list B2O-DENY seq 10 deny 192.168.255.0/24 ge 25
ip
prefix-list B2O-DENY seq 15 deny 0.0.0.0/0
ip
prefix-list B2O-DENY seq 20 permit 0.0.0.0/0 le 32
!
ip
prefix-list B2O-DENY2 seq 10 permit 192.168.255.0/24 ge 25
ip
prefix-list B2O-DENY2 seq 20 permit 0.0.0.0/0
!
ip
prefix-list MPLS-OUT seq 10 permit 192.168.255.0/24 ge 25
!
ip
prefix-list O2B seq 10 permit 10.10.0.0/16
ip
prefix-list O2B seq 20 permit 10.1.0.0/16
ip
prefix-list O2B seq 30 permit 10.6.1.0/24
!
!
!
!
route-map
B2O-DENY permit 10
match ip address prefix-list B2O-DENY
!
route-map
B2O-IN deny 5
match community 400
!
route-map
B2O-IN deny 6
match ip address prefix-list B2O-DENY2
!
route-map
B2O-IN permit 7
set tag 300
!
route-map
B2O-IN permit 10
match ip address prefix-list B2O
!
route-map
CORE-IN deny 5
match community 400
!
route-map
CORE-IN permit 10
match ip address prefix-list B2O
!
route-map
MPLS-FILTER-OUT deny 10
match community 400
!
route-map
MPLS-FILTER-OUT deny 20
match ip address prefix-list B2O
!
route-map
MPLS-FILTER-OUT permit 30
match ip address prefix-list MPLS-OUT
!
route-map
O2B-OUT deny 5
match tag 300
!
route-map
O2B-OUT permit 7
set community 400
!
route-map
O2B-OUT permit 10
match ip address prefix-list O2B
!
route-map
DENY-OUT deny 5
match community 400
!