Sunday 25 August 2019

Originating BGP advertisements and BGP community tagging (Juniper and Cisco(IOS-XR) configuration)

Originating BGP advertisement can be configured to any iBGP peer router. Here's the sample configuration of originating BGP routes and community tagging in Cisco and Juniper.






Assuming these are the summarized prefixes that you want to advertise via BGP.
111.111.0.0/16
222.222.0.0/16


Juniper:

 routing-options {
 graceful-restart;
  router-id 1.1.1.1;
    autonomous-system 11111;

protocols {
 bgp {
        group RR-IBGP {
            type internal;
            description RR-IPv4;
            local-address 192.168.100.6;
            family inet {
                unicast;
            }
            authentication-key "$1$N3tBioBwfdFsFVwgoGDh.3C0oL"; ## SECRET-DATA
            export bgp-statement;
            neighbor 192.168.100.5 {
                description iBGP to Route Reflector;
            }

policy-statement bgp-statement {
     term SITE1 {
            from {
                route-filter 111.111.0.0/16 exact;
                route-filter 222.222.0.0/16 exact;
   }
            then {
                community add SITE1;
              accept;
            }


 community SITE1 members 12345:111;


In display set:
set routing-options graceful-restart


set routing-options router-id 1.1.1.1
set routing-options autonomous-system 11111

set protocols bgp group RR-IBGP type internal
set protocols bgp group RR-IBGP description RR-IPv4
set protocols bgp group RR-IBGP local-address 192.168.100.6
set protocols bgp group RR-IBGP family inet unicast
set protocols bgp group RR-IBGP authentication-key "$1$N3tBioBwfdFsFVwgoGDh.3C0oL"
set protocols bgp group RR-IBGP export bgp-statement
set protocols bgp group RR-IBGP neighbor 192.168.100.5 description iBGP to Route Reflector

set policy-options policy-statement bgp-statement term SB from route-filter 111.111.0.0/16 exact
set policy-options policy-statement bgp-statement term SB from route-filter 222.222.0.0/16  exact
set policy-options policy-statement bgp-statement term SITE1 then community add SB
set policy-options policy-statement bgp-statement term SITE1 then accept

set policy-options community SITE1 members 12345:111


Cisco:

 prefix-set SITE1
 111.111.0.0/16,
 222.222.0.0/16
end-set

route-policy bgp-statement
 if destination in SITE1 then
  set community (12345:111)
  endif
end-policy



router bgp 11111
 nsr
 bgp router-id 1.1.1.1
 bgp graceful-restart
  address-family ipv4 unicast
  network 111.111.0.0/16
  network 222.222.0.0/16

 neighbor-group RR-IBG
  remote-as 11111
  password encrypted 2185073C7B74154C
  description RR IBGP GROUP IPV4
  update-source Loopback0
  address-family ipv4 unicast
   soft-reconfiguration inbound
 !
 neighbor 192.168.100.5
  use neighbor-group RR-IBG
  description RR-IPv4
  address-family ipv4 unicast
   route-policy iBGP-policy-in in
   route-policy bgp-statement out


In Formal:

prefix-set SITE1
 111.111.0.0/16,
 222.222.0.0/16,
end-set

route-policy bgp-statement
 if destination in SITE1 then
  set community (12345:111)
  endif
end-policy


router bgp 11111 nsr
router bgp 11111 bgp router-id 1.1.1.1
router bgp 11111 bgp graceful-restart
router bgp 11111 address-family ipv4 unicast
router bgp 11111 address-family ipv4 unicast network 111.111.0.0/16
router bgp 11111 address-family ipv4 unicast network 222.222.0.0/16
router bgp 11111 neighbor-group RR-IBG
router bgp 11111 neighbor-group RR-IBG remote-as 11111
router bgp 11111 neighbor-group RR-IBG password encrypted 2185073C7B74154C
router bgp 11111 neighbor-group RR-IBG description RR IBGP GROUP IPV4
router bgp 11111 neighbor-group RR-IBG update-source Loopback0
router bgp 11111 neighbor-group RR-IBG address-family ipv4 unicast
router bgp 11111 neighbor-group RR-IBG address-family ipv4 unicast soft-reconfiguration inbound
router bgp 11111 neighbor 192.168.100.5
router bgp 11111 neighbor 192.168.100.5 use neighbor-group RR-IBG
router bgp 11111 neighbor 192.168.100.5 description RR-IPv4
router bgp 11111 neighbor 192.168.100.5 address-family ipv4 unicast
router bgp 11111 neighbor 192.168.100.5 address-family ipv4 unicast route-policy iBGP-policy-in in
router bgp 11111 neighbor 192.168.100.5 address-family ipv4 unicast route-policy bgp-statement out

No comments:

Post a Comment