BGP – konfiguracja CISCO
by admin · Grudzień 6, 2017
We wpisie BGP – podstawy opisałem zasadę działania protokołu BGP. Teraz zobaczmy to na przykładzie prostej topologii i skonfigurujmy BGP na routerach CISCO.
TOPOLOGIA
KONFIGURACJA
Wstępna konfiguracja adresów IP:
hostname R1
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.12.1 255.255.255.0
duplex full
!
interface FastEthernet1/0
ip address 192.168.13.1 255.255.255.0
duplex full
!
hostname R2
!
interface FastEthernet0/0
ip address 192.168.12.2 255.255.255.0
duplex full
!
interface FastEthernet1/0
ip address 192.168.23.2 255.255.255.0
duplex full
!
hostname R3
!
interface FastEthernet0/0
ip address 192.168.23.3 255.255.255.0
duplex full
!
interface FastEthernet1/0
ip address 192.168.13.3 255.255.255.0
duplex full
!
Teraz przystąpmy do konfiguracji BGP. W tym celu na routerze wydajemy w trybie konfiguracji komendę: router bgp ASN, gdzie ASN to numer AS.
R1(config)#router bgp 65200
R1(config-router)#neighbor 192.168.12.2 remote-as 65100
R1(config)#router bgp 65200
R1(config-router)#neighbor 192.168.12.2 remote-as 65100
R1(config-router)#neighbor 192.168.13.3 remote-as 65200
R2(config)#router bgp 65100
R2(config-router)#neighbor 192.168.12.1 remote-as 65200
R2(config-router)#neighbor 192.168.23.3 remote-as 65200
R3(config)#router bgp 65200
R3(config-router)#neighbor 192.168.13.1 remote-as 65200
R3(config-router)#neighbor 192.168.23.2 remote-as 65100
R1#show ip bgp sum
BGP router identifier 192.168.13.1, local AS number 65200
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.168.12.2 4 65100 2 2 1 0 0 00:00:26 0
192.168.13.3 4 65200 3 3 1 0 0 00:00:59 0
R2#show ip bgp summary
BGP router identifier 192.168.23.2, local AS number 65100
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.168.12.1 4 65200 2 2 1 0 0 00:00:30 0
192.168.23.3 4 65200 2 2 1 0 0 00:00:10 0
R3#show ip bgp summary
BGP router identifier 192.168.23.3, local AS number 65200
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.168.13.1 4 65200 4 4 1 0 0 00:01:57 0
192.168.23.2 4 65100 4 4 1 0 0 00:01:03 0
R1(config)#int loopback 0
R1(config-if)#ip address 1.1.1.1 255.255.255.255
R1(config)#router bgp 65200
R1(config-router)#network 1.1.1.1 mask 255.255.255.255
R1#show ip bgp
BGP table version is 2, local router ID is 192.168.13.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 0.0.0.0 0 32768 i
R2#show ip bgp
BGP table version is 2, local router ID is 192.168.23.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
* 1.1.1.1/32 192.168.23.3 0 65200 i
*> 192.168.12.1 0 0 65200 i
R3#show ip bgp
BGP table version is 2, local router ID is 192.168.23.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*>i 1.1.1.1/32 192.168.13.1 0 100 0 i
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 0.0.0.0 0 32768 i
Network Next Hop Metric LocPrf Weight Path
* 1.1.1.1/32 192.168.23.3 0 65200 i
*> 192.168.12.1 0 0 65200 i
R2#show ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.1/32, version 2
Paths: (2 available, best #2, table default)
Advertised to update-groups:
1
Refresh Epoch 1
65200
192.168.23.3 from 192.168.23.3 (192.168.23.3)
Origin IGP, localpref 100, valid, external
rx pathid: 0, tx pathid: 0
Refresh Epoch 1
65200
192.168.12.1 from 192.168.12.1 (192.168.13.1)
Origin IGP, metric 0, localpref 100, valid, external, best
rx pathid: 0, tx pathid: 0x0
Network Next Hop Metric LocPrf Weight Path
* 1.1.1.1/32 192.168.23.3 0 65200 i
*> 192.168.12.1 0 0 65200 i
PODSUMOWANIE
Podstawowa konfiguracja BGP na routerach CISCO jest dosyć prosta, w następnych wpisać postaram się pokazać bardziej zaawansowanej konfiguracji BGP, oraz metody sterowania ruchem w BGP.1
faktycznie, błąd poprawiony. dzięki za zwrócenie uwagi 🙂
W konfiguracji sasiadów BGP jest błędnie skonfigurowany remote-as w 3-im wierszu R3. Poprawna konfiguracja to remote-as 65100, poza tym bardzo dobry poradnik:)