2014年10月2日 星期四

Olive pratice lab-BGP multihop

bgp-multihop.jpeg 
 
基本設定
我習慣用group的方式建lab,之後要移除會比較快!
基本設定
set groups test-multihop logical-systems r1 interfaces em1 unit 12 vlan-id 12
set groups test-multihop logical-systems r1 interfaces em1 unit 12 family inet address 192.168.12.1/30
set groups test-multihop logical-systems r2 interfaces em2 unit 12 vlan-id 12
set groups test-multihop logical-systems r2 interfaces em2 unit 12 family inet address 192.168.12.2/30
set groups test-multihop logical-systems r2 interfaces em1 unit 23 vlan-id 23
set groups test-multihop logical-systems r2 interfaces em1 unit 23 family inet address 192.168.23.1/30
set groups test-multihop logical-systems r3 interfaces em2 unit 23 vlan-id 23
set groups test-multihop logical-systems r3 interfaces em2 unit 23 family inet address 192.168.23.2/30

確認用r2 ping r1 跟r2 ping r3,確認OK後於兩台r1/r3加入static route讓r1/r3能夠互ping
set groups test-multihop logical-systems r1 routing-options static route 192.168.23.0/24 next-hop 192.168.12.2
set groups test-multihop logical-systems r3 routing-options static route 192.168.12.0/24 next-hop 192.168.23.1
確認用r1 ping r3,確認OK後,加入bgp設定
1. as number
2. group name and type
3. bgp neighbor ip and local address ip
4. check bgp neighbor
set groups test-multihop logical-systems r1 protocols bgp group ebgp type external
set groups test-multihop logical-systems r1 protocols bgp group ebgp local-address 192.168.12.1
set groups test-multihop logical-systems r1 protocols bgp group ebgp peer-as 65001
set groups test-multihop logical-systems r1 protocols bgp group ebgp neighbor 192.168.23.2
set groups test-multihop logical-systems r1 routing-options autonomous-system 65000
set groups test-multihop logical-systems r3 protocols bgp group ebgp type external
set groups test-multihop logical-systems r3 protocols bgp group ebgp local-address 192.168.23.2
set groups test-multihop logical-systems r3 protocols bgp group ebgp peer-as 65000
set groups test-multihop logical-systems r3 protocols bgp group ebgp neighbor 192.168.12.1
set groups test-multihop logical-systems r3 routing-options autonomous-system 65001
此時show bgp summary會看到bgp neighbor狀態是idle
[edit groups test-multihop]
lab@RE0# run show bgp summary logical-system all   
logical-system: r2
BGP is not running
-----
logical-system: r3
Groups: 1 Peers: 1 Down peers: 1
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...
192.168.12.1          65000          0          0       0       0          16 Idle
-----
logical-system: r1
Groups: 1 Peers: 1 Down peers: 1
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...
192.168.23.2          65001          0          0       0       0          16 Idle
-----                                  

加入bgp multihop的設定
set groups test-multihop logical-systems r1 protocols bgp group ebgp multihop
set groups test-multihop logical-systems r3 protocols bgp group ebgp multihop
確認bgp neighbor狀態
lab@RE0# run show bgp summary logical-system all                    
logical-system: r2
BGP is not running
-----
logical-system: r3
Groups: 1 Peers: 1 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...
192.168.12.1          65000         92         92       0       0       40:20 0/0/0/0              0/0/0/0
-----
logical-system: r1
Groups: 1 Peers: 1 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...
192.168.23.2          65001         91         92       0       0       40:20 0/0/0/0              0/0/0/0
-----
                                  
logical-system: default
BGP is not running

結論是multihop通常是要增加TTL的數,因為ebgp的ttl是預設為1,所以如neighbor不是介面的IP的話,都必須要啟用multihop來增加彼此router的ttl數,來達到BGP TCP建立

ebgp要建立TCP的封包帶的ttl值為1,在enable multihop後,其值增加到64