Sunday, December 1, 2013

BGP Route Reflector – Juniper

Configuring IBGP can be very painful because every router in network has to have peering session that must be manually configured and full mash is a must for IBGP.
There is a formula that you can calculate how many sessions is needed in network. Let’s say that you have 10 routers and that you have configure peer sessions with all routers in AS.
N*(N-1)/2
N represent total number of routers in AS. For example let’s say that we have 10 routers, we come up to 45 sessions that must be configured.
There is tool that help as to reduce number of needed sessions in network and that is route reflector.
Route reflection allows creating peer relationships only with designated route reflector router.
In that case you will need only IBGP peer session between route reflector clients and selected route reflector router.
Router reflector and router reflector clients must be in the same cluster.
You can have more than one router reflector router under same AS, also to enable connectivity for router reflector client and nonclient routers under AS, route reflector router must be full meshed with all routers in AS.











Since IBGP does not readvertise update to other IBGP enabled devices, as I mentioned IBGP devices need to be fully mashed (physical or logical).
To achieve full mash you will need to configure multiple neighbor statements on each IBGP device.
For that reason in large networks full mash does not scale well.
The best practice is to enable "route reflector", select one router on your network to be reflector router (Router_1), create peer relationships with all other routers under AS from route reflector router.
Then select routers that you want them to be clients for that router reflector (Router_2 and Router_3) all other routers are nonclient’s routers (Router_4 and Router_5).
Under Router reflector (Router_1) use cluster command and cluster ID (any 32 bit value); best practice is to use router loopback interface address.
Router reflector clients (Router_2 and Router_3) must form a peer relationship only with RF (Router_1) and RF clients don’t have to peer between them.

Nonclient routers (Router_4 and Router_5) must peer with each other and route reflection router (Router_1), use neighbor statement on each nonclient device (Router_4 to Router_5) and (Router_5 to Router_4), nonclient routers (Router_4 and Router_5) does not need to form peer relationship with router reflector clients (Router_2 and Router_3)
.


Set commands from routers:

Router_1


set routing-options router-id 192.168.6.5
set routing-options autonomous-system 200
set protocols bgp group INTERNAL-PEERS type internal
set protocols bgp group INTERNAL-PEERS local-address 192.168.6.5
set protocols bgp group INTERNAL-PEERS export SEND-OSPF
set protocols bgp group INTERNAL-PEERS cluster 192.168.6.5
set protocols bgp group INTERNAL-PEERS neighbor 192.168.6.4
set protocols bgp group INTERNAL-PEERS neighbor 192.168.40.4
set protocols bgp group INTERNAL-PEERS neighbor 192.168.5.5
set protocols bgp group INTERNAL-PEERS neighbor 192.168.0.1
set protocols ospf area 0.0.0.0 interface all
set protocols ospf area 0.0.0.0 interface lo0.1 passive
set policy-options policy-statement SEND-OSPF term 2 from protocol ospf
set policy-options policy-statement SEND-OSPF term 2 then accept


Router_2

set routing-options router-id 192.168.6.4
set routing-options autonomous-system 200
set protocols bgp group INTERNAL-PEERS type internal
set protocols bgp group INTERNAL-PEERS local-address 192.168.6.4
set protocols bgp group INTERNAL-PEERS export SEND-OSPF
set protocols bgp group INTERNAL-PEERS neighbor 192.168.6.5
set protocols ospf area 0.0.0.0 interface all
set protocols ospf area 0.0.0.0 interface lo0.2 passive
set policy-options policy-statement SEND-OSPF term 2 from protocol ospf
set policy-options policy-statement SEND-OSPF term 2 then accept



Router_3

set routing-options router-id 19.168.40.4
set routing-options autonomous-system 200
set protocols bgp group INTERNAL-PEERS type internal
set protocols bgp group INTERNAL-PEERS local-address 192.168.40.4
set protocols bgp group INTERNAL-PEERS export SENT-OSPF
set protocols bgp group INTERNAL-PEERS neighbor 192.168.6.5
set protocols ospf area 0.0.0.0 interface all
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set policy-options policy-statement SENT-OSPF term 2 from protocol ospf
set policy-options policy-statement SENT-OSPF term 2 then accept


Router_4


set routing-options router-id 192.168.0.1
set routing-options autonomous-system 200
set protocols bgp group INTERNAL-PEERS type internal
set protocols bgp group INTERNAL-PEERS local-address 192.168.0.1
set protocols bgp group INTERNAL-PEERS export SEND-OSPF
set protocols bgp group INTERNAL-PEERS neighbor 192.168.6.5
set protocols bgp group INTERNAL-PEERS neighbor 192.168.5.5
set protocols ospf area 0.0.0.0 interface all
set protocols ospf area 0.0.0.0 interface lo0.4 passive
set policy-options policy-statement SEND-OSPF term 2 from protocol ospf
set policy-options policy-statement SEND-OSPF term 2 then accept


Router_5

set routing-options router-id 192.168.5.5
set routing-options autonomous-system 200
set protocols bgp group INTERNEL-PEERS type internal
set protocols bgp group INTERNEL-PEERS local-address 192.168.5.5
set protocols bgp group INTERNEL-PEERS export SEND-OSPF
set protocols bgp group INTERNEL-PEERS neighbor 192.168.0.1
set protocols bgp group INTERNEL-PEERS neighbor 192.168.6.5
set protocols ospf area 0.0.0.0 interface all
set protocols ospf area 0.0.0.0 interface lo0.5 passive
set policy-options policy-statement SEND-OSPF term 2 from protocol ospf
set policy-options policy-statement SEND-OSPF term 2 then accep
t




Verifying BGP Neighbors


root@Router_1> show bgp summary
Groups: 1 Peers: 4 Down peers: 0
Table          Tot Paths  Act Paths Suppressed    History Damp State    Pending
inet.0                    26               0                0             0                0              0
Peer                     AS      InPkt     OutPkt    OutQ   Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
192.168.0.1             200        208        202       0       0     1:27:17         0/6/1/0                   0/0/0/0
192.168.5.5             200        187        182       0       0     1:20:00         0/7/7/0                   0/0/0/0
192.168.6.4             200        172        157       0       0     1:08:53         0/6/1/0                   0/0/0/0
192.168.40.4           200        168        156       0       0     1:08:53         0/7/7/0                   0/0/0/0





root@Router_1> show bgp neighbor
Peer: 192.168.0.1+50052 AS 200 Local: 192.168.6.5+179 AS 200
  Type: Internal    State: Established  (route reflector client)Flags: <ImportEval Sync>
  Last State: OpenConfirm   Last Event: RecvKeepAlive
  Last Error: None
  Export: [ SEND-OSPF ]
  Options: <Preference LocalAddress Cluster Refresh>
  Local Address: 192.168.6.5 Holdtime: 90 Preference: 170
  Number of flaps: 0
  Peer ID: 192.168.0.1     Local ID: 192.168.6.5       Active Holdtime: 90
  Keepalive Interval: 30         Peer index: 0
  BFD: disabled, down
  NLRI for restart configured on peer: inet-unicast
  NLRI advertised by peer: inet-unicast
  NLRI for this session: inet-unicast
  Peer supports Refresh capability (2)
  Stale routes from peer are kept for: 300
  Peer does not support Restarter functionality
  NLRI that restart is negotiated for: inet-unicast
  NLRI of received end-of-rib markers: inet-unicast
  NLRI of all end-of-rib markers sent: inet-unicast
  Peer supports 4 byte AS extension (peer-as 200)
  Peer does not support Addpath
  Table inet.0 Bit: 10000
    RIB State: BGP restart is complete
    Send state: in sync
    Active prefixes:              0
    Received prefixes:            6
    Accepted prefixes:            1
    Suppressed due to damping:    0
    Advertised prefixes:          6
  Last traffic (seconds): Received 4    Sent 6    Checked 68
  Input messages:  Total 212    Updates 9       Refreshes 0     Octets 4340
  Output messages: Total 205    Updates 7       Refreshes 0     Octets 4208
  Output Queue[0]: 0

Peer: 192.168.5.5+51392 AS 200 Local: 192.168.6.5+179 AS 200
  Type: Internal    State: Established  (route reflector client)Flags: <ImportEval Sync>
  Last State: OpenConfirm   Last Event: RecvKeepAlive
  Last Error: None
  Export: [ SEND-OSPF ]
  Options: <Preference LocalAddress Cluster Refresh>
  Local Address: 192.168.6.5 Holdtime: 90 Preference: 170
  Number of flaps: 0
  Peer ID: 192.168.5.5     Local ID: 192.168.6.5       Active Holdtime: 90
  Keepalive Interval: 30         Peer index: 1
  BFD: disabled, down
  NLRI for restart configured on peer: inet-unicast
  NLRI advertised by peer: inet-unicast
  NLRI for this session: inet-unicast
  Peer supports Refresh capability (2)
  Stale routes from peer are kept for: 300
  Peer does not support Restarter functionality
  NLRI that restart is negotiated for: inet-unicast
  NLRI of received end-of-rib markers: inet-unicast
  NLRI of all end-of-rib markers sent: inet-unicast
  Peer supports 4 byte AS extension (peer-as 200)
  Peer does not support Addpath
  Table inet.0 Bit: 10000
    RIB State: BGP restart is complete
    Send state: in sync
    Active prefixes:              0
    Received prefixes:            7
    Accepted prefixes:            7
    Suppressed due to damping:    0
    Advertised prefixes:          6
  Last traffic (seconds): Received 9    Sent 21   Checked 77
  Input messages:  Total 190    Updates 9       Refreshes 0     Octets 3927
  Output messages: Total 185    Updates 5       Refreshes 0     Octets 3768
  Output Queue[0]: 0

Peer: 192.168.6.4+179 AS 200   Local: 192.168.6.5+57627 AS 200
  Type: Internal    State: Established  (route reflector client)Flags: <ImportEval Sync>
  Last State: OpenConfirm   Last Event: RecvKeepAlive
  Last Error: None
  Export: [ SEND-OSPF ]
  Options: <Preference LocalAddress Cluster Refresh>
  Local Address: 192.168.6.5 Holdtime: 90 Preference: 170
  Number of flaps: 0
  Peer ID: 192.168.6.4     Local ID: 192.168.6.5       Active Holdtime: 90
  Keepalive Interval: 30         Peer index: 2
  BFD: disabled, down
  NLRI for restart configured on peer: inet-unicast
  NLRI advertised by peer: inet-unicast
  NLRI for this session: inet-unicast
  Peer supports Refresh capability (2)
  Stale routes from peer are kept for: 300
  Peer does not support Restarter functionality
  NLRI that restart is negotiated for: inet-unicast
  NLRI of received end-of-rib markers: inet-unicast
  NLRI of all end-of-rib markers sent: inet-unicast
  Peer supports 4 byte AS extension (peer-as 200)
  Peer does not support Addpath
  Table inet.0 Bit: 10000
    RIB State: BGP restart is complete
    Send state: in sync
    Active prefixes:              0
    Received prefixes:            6
    Accepted prefixes:            1
    Suppressed due to damping:    0
    Advertised prefixes:          6
  Last traffic (seconds): Received 7    Sent 1    Checked 15
  Input messages:  Total 176    Updates 5       Refreshes 0     Octets 3506
  Output messages: Total 160    Updates 4       Refreshes 0     Octets 3261
  Output Queue[0]: 0

Peer: 192.168.40.4+58282 AS 200 Local: 192.168.6.5+179 AS 200

  Type: Internal    State: Established  (route reflector client)Flags: <ImportEval Sync>
  Last State: OpenConfirm   Last Event: RecvKeepAlive
  Last Error: None
  Export: [ SEND-OSPF ]
  Options: <Preference LocalAddress Cluster Refresh>
  Local Address: 192.168.6.5 Holdtime: 90 Preference: 170
  Number of flaps: 0
  Peer ID: 19.168.40.4     Local ID: 192.168.6.5       Active Holdtime: 90
  Keepalive Interval: 30         Peer index: 3
  BFD: disabled, down
  NLRI for restart configured on peer: inet-unicast
  NLRI advertised by peer: inet-unicast
  NLRI for this session: inet-unicast
  Peer supports Refresh capability (2)
  Stale routes from peer are kept for: 300
  Peer does not support Restarter functionality
  NLRI that restart is negotiated for: inet-unicast
  NLRI of received end-of-rib markers: inet-unicast
  NLRI of all end-of-rib markers sent: inet-unicast
  Peer supports 4 byte AS extension (peer-as 200)
  Peer does not support Addpath
  Table inet.0 Bit: 10000
    RIB State: BGP restart is complete
    Send state: in sync
    Active prefixes:              0
    Received prefixes:            7
    Accepted prefixes:            7
    Suppressed due to damping:    0
    Advertised prefixes:          6
  Last traffic (seconds): Received 3    Sent 22   Checked 66
  Input messages:  Total 172    Updates 5       Refreshes 0     Octets 3475
  Output messages: Total 159    Updates 4       Refreshes 0     Octets 3242
  Output Queue[0]: 0

No comments:

Post a Comment