Monday, December 2, 2013

BGP redistribute-internal




Elements

In this example we will examine a hidden command: bgp redistribute-internal
R1 is running OSPF with R2, iBGP with R3 (EIGRP is for loopbacks connectivity) and eBGP with R4
As known, when we redistribute BGP into a routing protocol, only eBGP routes are redistributed, let us find and see


Configuration

R1
interface Loopback0
 ip address 1.1.1.1 255.255.255.255

interface FastEthernet0/0
 ip address 192.168.12.1 255.255.255.0
 speed 100
 full-duplex

interface FastEthernet0/1
 ip address 192.168.13.1 255.255.255.0
 speed 100
 full-duplex

interface Serial0/0
 ip address 192.168.14.1 255.255.255.0
 encapsulation ppp

router ospf 1
 router-id 1.1.1.1
 log-adjacency-changes
 redistribute bgp 1 subnets
 network 192.168.12.1 0.0.0.0 area 0

router eigrp 1
 network 1.1.1.1 0.0.0.0
 network 192.168.13.1 0.0.0.0
 no auto-summary

router bgp 1
 neighbor 3.3.3.3 remote-as 1
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 192.168.14.4 remote-as 4
 no auto-summary

R2

interface Loopback0
 ip address 2.2.2.2 255.255.255.255

interface FastEthernet0/0
 ip address 192.168.12.2 255.255.255.0
 speed 100
 full-duplex
router ospf 1
 router-id 2.2.2.2
 log-adjacency-changes
 network 2.2.2.2 0.0.0.0 area 0
 network 192.168.12.2 0.0.0.0 area 0

R3

interface Loopback0
 ip address 3.3.3.3 255.255.255.255

interface Loopback1
 ip address 13.13.13.13 255.255.255.255

interface FastEthernet0/0
 ip address 192.168.13.3 255.255.255.0
 speed 100
 full-duplex

R3#sh run | sec router eigrp
router eigrp 1
 network 3.3.3.3 0.0.0.0
 network 192.168.13.3 0.0.0.0
 no auto-summary

router bgp 1
network 3.3.3.3 mask 255.255.255.255
 network 13.13.13.13 mask 255.255.255.255
 neighbor 1.1.1.1 remote-as 1
 neighbor 1.1.1.1 update-source Loopback0
 no auto-summary

R4
interface Loopback0
 ip address 4.4.4.4 255.255.255.255

interface Serial0/0
 ip address 192.168.14.4 255.255.255.0
 encapsulation ppp
 clock rate 2000000

router bgp 4
network 4.4.4.4 mask 255.255.255.255
 neighbor 192.168.14.1 remote-as 1
 no auto-summary
Verification

Now let us check basic relations and route advertisements before we do the redistribution
 
R1#sh ip ospf neighbor 
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           1   FULL/DR         00:00:36    192.168.12.2    FastEthernet0/0
 
R1#sh ip route ospf 
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/2] via 192.168.12.2, 00:38:13, FastEthernet0/0
 
R1#sh ip bgp summary 
BGP router identifier 1.1.1.1, local AS number 1
BGP table version is 5, main routing table version 5
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 2 (at peak 2) using 64 bytes of memory
BGP using 976 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
3.3.3.3         4     1      42      41        5    0    0 00:36:19        2
192.168.14.4    4     4      41      42        5    0    0 00:37:13        1
 
R1#sh ip bgp 
BGP table version is 5, local router ID is 1.1.1.1
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
r>i3.3.3.3/32       3.3.3.3                  0    100      0 i
*> 4.4.4.4/32       192.168.14.4             0             0 4 i
*>i13.13.13.13/32   3.3.3.3                  0    100      0 i
 
R2#sh ip ospf neighbor 
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/BDR        00:00:39    192.168.12.1    FastEthernet0/0
R2#sh ip route ospf 
 
R2#
 
R3#sh ip bgp summary 
BGP router identifier 3.3.3.3, local AS number 1
BGP table version is 3, main routing table version 3
3 network entries using 360 bytes of memory
3 path entries using 156 bytes of memory
3/1 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
1.1.1.1         4     1      41      42        3    0    0 00:36:40        1
 
R3#sh ip bgp 
BGP table version is 3, local router ID is 3.3.3.3
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
*> 3.3.3.3/32       0.0.0.0                  0         32768 i
* i4.4.4.4/32       192.168.14.4             0    100      0 4 i
*> 13.13.13.13/32   0.0.0.0                  0         32768 i
 
R4#sh ip bgp summary 
BGP router identifier 4.4.4.4, local AS number 4
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.14.1    4     1      42      41        4    0    0 00:37:42        2
 
R4#sh ip bgp         
BGP table version is 4, local router ID is 4.4.4.4
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
*> 3.3.3.3/32       192.168.14.1                           0 1 i
*> 4.4.4.4/32       0.0.0.0                  0         32768 i
*> 13.13.13.13/32   192.168.14.1                           0 1 i
 
So , all is functioning normal , now let us do one way redistribution from BGP into OSPF on R1 , R2 should according to the rule we mentioned above receive only 4.4.4.4/32 (which is the prefix learned via eBGP)
 
R1(config)#router ospf 1
R1(config-router)#redistribute bgp 1 subnets
 
R2#sh ip route ospf 
     4.0.0.0/32 is subnetted, 1 subnets
O E2    4.4.4.4 [110/1] via 192.168.12.1, 00:00:10, FastEthernet0/0
 
Which is true, we cannot see the 13.13.13.13/32 prefix which is learned via iBGP, now let us add the hidden command
 
R1(config-router)#router bgp 1
R1(config-router)#bgp redistribute-internal
 
R2#sh ip route ospf 
     4.0.0.0/32 is subnetted, 1 subnets
O E2    4.4.4.4 [110/1] via 192.168.12.1, 00:00:51, FastEthernet0/0
     13.0.0.0/32 is subnetted, 1 subnets
O E2    13.13.13.13 [110/1] via 192.168.12.1, 00:00:03, FastEthernet0/0
 
And yes, this command also takes the iBGP learned routes and redistributes them
 
And we can see the command as well in the show running configuration
 
R1#sh run | sec router bgp
router bgp 1
 no synchronization
 bgp log-neighbor-changes
 bgp redistribute-internal
 neighbor 3.3.3.3 remote-as 1
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 192.168.14.4 remote-as 4
 no auto-summary

Wednesday, October 9, 2013

IPv6 Routing Example #1





R1
interface Loopback0
ipv6 address 2001::1/128
 ipv6 ospf 1 area 0

interface Loopback1
ipv6 address 2001:DB8::1/128
 ipv6 ospf 1 area 0

interface FastEthernet0/0
 ipv6 address 2001:192:12::1/64
 ipv6 ospf network point-to-point
 ipv6 ospf 1 area 0

ipv6 router ospf 1
 router-id 1.1.1.1

R2

interface Loopback0
ipv6 address 2001::2/128
 ipv6 ospf 1 area 0

interface Loopback1
ipv6 address 2001:DB8::2/128
 ipv6 ospf 1 area 0

interface FastEthernet0/0
ipv6 address 2001:192:12::2/64
 ipv6 ospf network point-to-point
 ipv6 ospf 1 area 0

interface FastEthernet0/1
ipv6 address 2001:192:23::2/64
 ipv6 rip RIPng enable

ipv6 router ospf 1
 router-id 2.2.2.2
redistribute rip RIPng include-connected

ipv6 router rip RIPng
 redistribute ospf 1 include-connected

R3

interface Loopback0
 ipv6 address 2001::3/128
 ipv6 rip RIPng enable

interface Loopback1
ipv6 address 2001:DB8::3/128
 ipv6 rip RIPng enable

interface FastEthernet0/0
ipv6 address 2001:192:23::3/64
 ipv6 rip RIPng enable

interface FastEthernet0/1
ipv6 address 2001:192:34::3/64

ipv6 router rip RIPng
 redistribute bgp 300

router bgp 300
bgp router-id 3.3.3.3
 bgp log-neighbor-changes
 neighbor 2001:192:34::4 remote-as 400
address-family ipv6
  neighbor 2001:192:34::4 activate
  redistribute rip RIPng include-connected

R4
interface Loopback0
ipv6 address 2001::4/128

R4#sh run int lo1
interface Loopback1
 no ip address
 ipv6 address 2001:DB8::4/128

interface FastEthernet0/0
ipv6 address 2001:192:34::4/64

router bgp 400
bgp router-id 4.4.4.4
 bgp log-neighbor-changes
 neighbor 2001:192:34::3 remote-as 300
address-family ipv6
  neighbor 2001:192:34::3 activate
  network 2001::4/128
  network 2001:DB8::4/128


Tasks

Filter the prefix 2001:DB8::1/128 from being installed in R2 routing table

ipv6 prefix-list MSSK seq 5 deny 2001:DB8::1/128
ipv6 prefix-list MSSK seq 10 permit ::/0 le 128
 
ipv6 router ospf 1
distribute-list prefix-list MSSK in FastEthernet0/0
 
R2#sh ipv6 route ospf 
IPv6 Routing Table - 12 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
       U - Per-user Static route, M - MIPv6
       I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
       O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
       ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
       D - EIGRP, EX - EIGRP external
O   2001::1/128 [110/10]
     via FE80::C000:74FF:FEF5:0, FastEthernet0/0
 
Assign a metric of 5 to the prefix 2001::1/128 when propagated to the RIP domain
 
ipv6 prefix-list METRIC seq 5 permit 2001::1/128
 
route-map MAP permit 10
 match ipv6 address prefix-list METRIC
 set metric 5
route-map MAP permit 20
 
 
R2(config-route-map)#ipv6 router rip RIPng
R2(config-rtr)#redistribute ospf 1 route-map MAP include-connected
 
R3#sh ipv6 route rip 
IPv6 Routing Table - 13 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
       U - Per-user Static route, M - MIPv6
       I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
       O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
       ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
       D - EIGRP, EX - EIGRP external
R   2001::1/128 [120/6]
     via FE80::C001:74FF:FEF5:1, FastEthernet0/0
R   2001::2/128 [120/2]
     via FE80::C001:74FF:FEF5:1, FastEthernet0/0
R   2001:192:12::/64 [120/2]
     via FE80::C001:74FF:FEF5:1, FastEthernet0/0
R   2001:DB8::2/128 [120/2]
     via FE80::C001:74FF:FEF5:1, FastEthernet0/0
 
On R3 assign the 2001:DB8::2/128 prefix a weight of 16384
 
R3(config)#ipv6 prefix-list WEIGHT seq 5 permit 2001:DB8::2/128
 
R3(config)#route-map MAP1 permit 10
R3(config-route-map)#match ipv6 address prefix-list WEIGHT
R3(config-route-map)#set weight 16384
R3(config-route-map)#route-map MAP1 permit 20
 
R3(config-route-map)#router bgp 300
R3(config-router)#address-family ipv6 
R3(config-router-af)#redistribute rip RIPng include-connected route-map MAP1
 
R3#sh bgp ipv6 unicast 
BGP table version is 14, local router ID is 3.3.3.3
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
*> 2001::1/128      ::                       6         32768 ?
*> 2001::2/128      ::                       2         32768 ?
*> 2001::3/128      ::                       0         32768 ?
*> 2001::4/128      2001:192:34::4           0             0 400 i
*> 2001:192:12::/64 ::                       2         32768 ?
*> 2001:192:23::/64 ::                       0         32768 ?
*> 2001:DB8::2/128  ::                       2         16384 ?
*> 2001:DB8::3/128  ::                       0         32768 ?
*> 2001:DB8::4/128  2001:192:34::4           0             0 400 i