底辺エンジニアの備忘録

30過ぎて、記憶力低下が著しい為、メモ代わりにしていく予定。 自身のスキルが低いので、内容の正確さは保障できません・・・OTL

JUNOS_BGP1

BGPをいちから復習

構成は↓

f:id:klock_3rd:20181022221222p:plain

R1・・・AS1

R2、R3・・・AS2

便宜上、R1,R2,R3の全てのIFで、OSPFを有効化

 

まずは、Ciscoでやってみる。

R1

router bgp 1
bgp log-neighbor-changes
bgp router-id 1.1.1.1
neighbor 10.1.1.254 remote-as 2
!
address-family ipv4
neighbor 10.1.1.254 activate
exit-address-family

 R2

router bgp 2
bgp log-neighbor-changes
bgp router-id 2.2.2.2
neighbor 10.1.1.1 remote-as 1
neighbor 10.1.2.254 remote-as 2
!
address-family ipv4
neighbor 10.1.1.1 activate
neighbor 10.1.2.254 activate
exit-address-family
!

 R3

router bgp 2
bgp log-neighbor-changes
bgp router-id 3.3.3.3
neighbor 10.1.2.1 remote-as 2
!
address-family ipv4
neighbor 10.1.2.1 activate
exit-address-family

 

 R2で確認

R2#show bgp ipv4 unicast summary
BGP router identifier 2.2.2.2, local AS number 2
BGP table version is 1, main routing table version 1

Neighbor    V    AS MsgRcvd MsgSent  TblVer InQ OutQ Up/Down State/PfxRcd
10.1.1.1    4    1   14   14    1  0  0 00:09:40    0
10.1.2.254   4    2   13   13    1  0  0 00:08:53    0

 

今度はeBGP/iBGPのneighborをLoopback で指定してみる。

 

R1

router bgp 1
bgp router-id 1.1.1.1
bgp log-neighbor-changes
neighbor 2.2.2.2 remote-as 2
!
address-family ipv4
neighbor 2.2.2.2 activate
exit-address-family 

 R2

router bgp 2
bgp router-id 2.2.2.2
bgp log-neighbor-changes
neighbor 1.1.1.1 remote-as 1
neighbor 3.3.3.3 remote-as 3
!
address-family ipv4
neighbor 1.1.1.1 activate
neighbor 3.3.3.3 activate
exit-address-family 

 R3

router bgp 2
bgp router-id 3.3.3.3
bgp log-neighbor-changes
neighbor 2.2.2.2 remote-as 2
!
address-family ipv4
neighbor 2.2.2.2 activate
exit-address-family 

 R2で確認

R2#show bgp ipv4 unicast summary
BGP router identifier 2.2.2.2, local AS number 2
BGP table version is 1, main routing table version 1

Neighbor    V    AS MsgRcvd MsgSent  TblVer InQ OutQ Up/Down State/PfxRcd
1.1.1.1     4    1    0    0    1  0  0 never  Idle
3.3.3.3     4    3    0    0    1  0  0 never  Idle

 Loopbackにすると、Idle状態のまま

 

修正後

R1

router bgp 1
bgp router-id 1.1.1.1
bgp log-neighbor-changes
neighbor 2.2.2.2 remote-as 2
neighbor 2.2.2.2 ebgp-multihop 10
neighbor 2.2.2.2 update-source Loopback0
!
address-family ipv4
neighbor 2.2.2.2 activate
exit-address-family 

 R2

router bgp 2
bgp router-id 2.2.2.2
bgp log-neighbor-changes
neighbor 1.1.1.1 remote-as 1
neighbor 1.1.1.1 ebgp-multihop 10
neighbor 1.1.1.1 update-source Loopback0
neighbor 3.3.3.3 remote-as 2
neighbor 3.3.3.3 update-source Loopback0
!
address-family ipv4
neighbor 1.1.1.1 activate
neighbor 3.3.3.3 activate
exit-address-family 

 R3

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

赤字・・・eBGPでLoopbackでネイバー張る時の設定

青地・・・iBGPでLoopbackでネイバー張る時の設定

R2で確認

 

R2#show bgp ipv4 unicast summary
BGP router identifier 2.2.2.2, local AS number 2
BGP table version is 1, main routing table version 1

Neighbor    V    AS MsgRcvd MsgSent  TblVer InQ OutQ Up/Down State/PfxRcd
1.1.1.1     4    1    7    7    1  0  0 00:03:02    0
3.3.3.3     4    2    8    7    1  0  0 00:04:28    0
R2#

 

本題はこれから・・・

今の流れをJUNOSでやってみる

R1

set routing-options router-id 1.1.1.1
set routing-options autonomous-system 1
set protocols bgp group EBGP type external
set protocols bgp group EBGP peer-as 2
set protocols bgp group EBGP neighbor 10.1.1.254

 R2

set routing-options router-id 2.2.2.2
set routing-options autonomous-system 2
set protocols bgp group EBGP type external
set protocols bgp group EBGP peer-as 1
set protocols bgp group EBGP neighbor 10.1.1.1
set protocols bgp group IBGP type internal
set protocols bgp group IBGP peer-as 2
set protocols bgp group IBGP neighbor 10.1.2.254 

 R3

set routing-options router-id 3.3.3.3
set routing-options autonomous-system 2
set protocols bgp group IBGP type internal
set protocols bgp group IBGP peer-as 2
set protocols bgp group IBGP neighbor 10.1.2.1 

 R2で確認

admin@R2# run show bgp summary
Groups: 2 Peers: 2 Down peers: 0
Table     Tot Paths Act Paths Suppressed  History Damp State  Pending
inet.0
            0     0     0     0     0     0
Peer       AS  InPkt  OutPkt  OutQ  Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
10.1.1.1     1    3    3    0    0     49 0/0/0/0       0/0/0/0
10.1.2.254    2    9    7    0    1    2:49 0/0/0/0       0/0/0/0 

 

ネイバーをLoopbackに変えてみる

R1

set routing-options router-id 1.1.1.1
set routing-options autonomous-system 1
set protocols bgp group EBGP type external
set protocols bgp group EBGP local-address 1.1.1.1
set protocols bgp group EBGP peer-as 2
set protocols bgp group EBGP neighbor 2.2.2.2 multihop ttl 10 

 R2

set routing-options router-id 2.2.2.2
set routing-options autonomous-system 2
set protocols bgp group EBGP type external
set protocols bgp group EBGP multihop ttl 10
set protocols bgp group EBGP local-address 2.2.2.2
set protocols bgp group EBGP peer-as 1
set protocols bgp group EBGP neighbor 1.1.1.1
set protocols bgp group IBGP type internal
set protocols bgp group IBGP local-address 2.2.2.2
set protocols bgp group IBGP peer-as 2
set protocols bgp group IBGP neighbor 3.3.3.3 

 R3

set routing-options router-id 3.3.3.3
set routing-options autonomous-system 2
set protocols bgp group IBGP type internal
set protocols bgp group IBGP local-address 3.3.3.3
set protocols bgp group IBGP peer-as 2
set protocols bgp group IBGP neighbor 2.2.2.2 

 R2で確認

admin@R2# run show bgp summary
Groups: 2 Peers: 2 Down peers: 0
Table     Tot Paths Act Paths Suppressed  History Damp State  Pending
inet.0
            0     0     0     0     0     0
Peer       AS   InPkt   OutPkt  OutQ  Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
1.1.1.1      1     9     8    0    0    3:26 0/0/0/0       0/0/0/0
3.3.3.3      2     16     15    0    1    6:05 0/0/0/0       0/0/0/0 

 

無駄にCiscoでの確認を長くしてしまい、JUNOSでの確認をするのを忘れてた・・・