ネットワーク備忘録

アラフォーエンジニアのネットワーク系の備忘録。twitter:@deigo25374582

JUNOS_BGP4

Route Reflctorの確認

構成は↓

f:id:klock_3rd:20181022221222p:plain

R1、R2、R3がAS1(Lo0はOSPFで広告済み)
R1-R3、R2-R3でPeerを張った状態から確認

 

まずはCisco

R1

router bgp 1
bgp router-id 1.1.1.1
bgp log-neighbor-changes
neighbor 3.3.3.3 remote-as 1
neighbor 3.3.3.3 update-source Loopback0
!
address-family ipv4
network 4.4.4.4 mask 255.255.255.255
neighbor 3.3.3.3 activate
neighbor 3.3.3.3 soft-reconfiguration inbound
exit-address-family
!

 R2

router bgp 1
bgp router-id 2.2.2.2
bgp log-neighbor-changes
neighbor 3.3.3.3 remote-as 1
neighbor 3.3.3.3 update-source Loopback0
!
address-family ipv4
neighbor 3.3.3.3 activate
neighbor 3.3.3.3 soft-reconfiguration inbound
exit-address-family
!

 R3

router bgp 1
bgp router-id 3.3.3.3
bgp log-neighbor-changes
neighbor 1.1.1.1 remote-as 1
neighbor 1.1.1.1 update-source Loopback0
neighbor 2.2.2.2 remote-as 1
neighbor 2.2.2.2 update-source Loopback0
!
address-family ipv4
network 3.3.3.3 mask 255.255.255.255
neighbor 1.1.1.1 activate
neighbor 1.1.1.1 soft-reconfiguration inbound
neighbor 2.2.2.2 activate
neighbor 2.2.2.2 soft-reconfiguration inbound
exit-address-family
!

 R1で5.5.5.5/32の経路をR3に広告しているのでR3で確認

R3

R3#show bgp ipv4 unicast neighbors 1.1.1.1 received-routes

   Network     Next Hop   Metric LocPrf Weight Path
*>i 4.4.4.4/32    1.1.1.1      0  100   0 i

 

R3#show bgp ipv4 unicast neighbors 2.2.2.2 advertised-routes

Total number of prefixes 0

 R1から「4.4.4.4/32」の経路を受け取っているが、R2へは広告していない。
これはBGPのスプリットホライズン機能。

 

では、Route Reflectorの設定

R3

router bgp 1
bgp router-id 3.3.3.3
bgp cluster-id 3.3.3.3
bgp log-neighbor-changes
neighbor PEER-GROUP peer-group
neighbor 1.1.1.1 remote-as 1
neighbor 1.1.1.1 peer-group PEER-GROUP
neighbor 2.2.2.2 remote-as 1
neighbor 2.2.2.2 peer-group PEER-GROUP
!
address-family ipv4
neighbor PEER-GROUP route-reflector-client
neighbor PEER-GROUP soft-reconfiguration inbound
neighbor 1.1.1.1 activate
neighbor 2.2.2.2 activate
exit-address-family
!

R3で確認

 R3#show bgp ipv4 unicast neighbors

~~

For address family: IPv4 Unicast
 Session: 1.1.1.1
 BGP table version 4, neighbor version 4/0
 Output queue size : 0
 Index 9, Advertise bit 0
 Route-Reflector Client
 9 update-group member
 PEER-GROUP peer-group member

 

R3#show bgp ipv4 unicast neighbors 2.2.2.2 advertised-routes

   Network     Next Hop  Metric LocPrf Weight Path
*>i 4.4.4.4/32    1.1.1.1     0  100   0 i

 Route ReflectorのクライアントをPEER-GROUPでまとめている。
そして、Route Reflector設定後は、R3はR2へ「4.4.4.4/32」を広告

 

これをJUNOSでやってみる。

まずはRoute Reflector前

R1

set routing-options router-id 1.1.1.1
set routing-options autonomous-system 1
set protocols bgp group iBGP type internal
set protocols bgp group iBGP export to-iBGP
set protocols bgp group iBGP neighbor 3.3.3.3 local-address 1.1.1.1
set protocols bgp group iBGP neighbor 3.3.3.3 peer-as 1
set protocols bgp group iBGP neighbor 3.3.3.3 local-as 1
set policy-options policy-statement to-iBGP term 1 from route-filter 4.4.4.4/32 exact
set policy-options policy-statement to-iBGP term 1 then accept

 R2

set routing-options autonomous-system 1
set protocols bgp group iBGP type internal
set protocols bgp group iBGP neighbor 3.3.3.3 local-address 2.2.2.2
set protocols bgp group iBGP neighbor 3.3.3.3 peer-as 1
set protocols bgp group iBGP neighbor 3.3.3.3 local-as 1

 R3

set routing-options autonomous-system 1
set protocols bgp group iBGP type internal
set protocols bgp group iBGP neighbor 1.1.1.1 local-address 3.3.3.3
set protocols bgp group iBGP neighbor 1.1.1.1 peer-as 1
set protocols bgp group iBGP neighbor 1.1.1.1 local-as 1
set protocols bgp group iBGP neighbor 2.2.2.2 local-address 3.3.3.3
set protocols bgp group iBGP neighbor 2.2.2.2 peer-as 1
set protocols bgp group iBGP neighbor 2.2.2.2 local-as 1 

 そして、R3で確認

 admin@R3# run show route receive-protocol bgp 1.1.1.1

inet.0: 14 destinations, 14 routes (14 active, 0 holddown, 0 hidden)
 Prefix     Nexthop   MED   Lclpref  AS path
* 4.4.4.4/32   1.1.1.1       100    I

 

admin@R3# run show route advertising-protocol bgp 2.2.2.2

[edit]
admin@R3#

 Ciscoと同様。 そこで、Route Reflectorの設定投入

R3

set routing-options autonomous-system 1
set protocols bgp group iBGP type internal
set protocols bgp group iBGP cluster 3.3.3.3
set protocols bgp group iBGP neighbor 1.1.1.1 local-address 3.3.3.3
set protocols bgp group iBGP neighbor 1.1.1.1 peer-as 1
set protocols bgp group iBGP neighbor 1.1.1.1 local-as 1
set protocols bgp group iBGP neighbor 2.2.2.2 local-address 3.3.3.3
set protocols bgp group iBGP neighbor 2.2.2.2 peer-as 1
set protocols bgp group iBGP neighbor 2.2.2.2 local-as 1

 Ciscoと違い「cluster」の設定を入れるだけで、Route Reflectorになる。

R3で確認

 admin@R3# run show bgp neighbor
Peer: 1.1.1.1+179 AS 1     Local: 3.3.3.3+62961 AS 1
 Group: iBGP         Routing-Instance: master
 Forwarding routing-instance: master
 Type: Internal  State: Established (route reflector client)Flags: <Sync>
 Last State: OpenConfirm  Last Event: RecvKeepAlive
 Last Error: None
 Options: <Preference LocalAddress Cluster PeerAS LocalAS Refresh>
 Local Address: 3.3.3.3 Holdtime: 90 Preference: 170 Local AS: 1 Local System AS: 1

 

admin@R3# run show route advertising-protocol bgp 2.2.2.2

inet.0: 14 destinations, 14 routes (14 active, 0 holddown, 0 hidden)
 Prefix     Nexthop   MED   Lclpref  AS path
* 4.4.4.4/32   1.1.1.1       100    I

 R3→R2へも広告している。