Csináltam egy viszonylag komplexebb topológiát, ahol a BGP-t fogom tesztelni. Egyelőre csak a felső négy routerre fókuszáljunk, a szürkével kitakart rész egy későbbi poszt témája lesz.
A fő elképzelés nagyvonalakban:
– R1-R2 között eBGP.
– R1 behirdeti a Loopback 1 IP címét (1.1.1.1/32) BGP-be
– R2 RR (Route Reflector lesz).
– AS200-on belül OSPF gondoskodik a Loopback címek hirdetéséről
Először nézzük a konfigurációkat, minimális magyarázattal:
***
R1
***
! interface Loopback1 ip address 1.1.1.1 255.255.255.255 ! interface FastEthernet0/0 ip address 10.0.0.1 255.255.255.0 duplex auto speed auto ! interface FastEthernet0/1 no ip address shutdown duplex auto speed auto ! router bgp 100 no synchronization ! nem szükséges a router ID definiálása, mert Lo1 lenne, de érdemes kézzel megadni bgp router-id 1.1.1.1 bgp log-neighbor-changes ! behirdetjük Lo1 subnetjét network 1.1.1.1 mask 255.255.255.255 ! R2 definiálása neighbor 10.0.0.2 remote-as 200 no auto-summary !
Már most láthatjuk, hogy R1 hirdeti a subnetet BGP-vel. Next-hop 0.0.0.0 (azaz local router), Weight 32768 (default), metric 0 (mivel local)
Már most láthatjuk, hogy R1 hirdeti a subnetet BGP-vel. Next-hop 0.0.0.0 (azaz local router), Weight 32768 (default), metric 0 (mivel local)
R1#sh ip bgp
BGP table version is 2, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 0.0.0.0 0 32768 i
R1#
***
R2
***
! ! interface Loopback1 ip address 2.2.2.2 255.255.255.255 ip ospf 1 area 0 ! interface FastEthernet0/0 ip address 10.0.0.2 255.255.255.0 duplex auto speed auto ! interface FastEthernet0/1 ip address 10.0.1.1 255.255.255.0 ! Mivel csak egy neighbor lesz ezen az interface-n, P2P ip ospf network point-to-point ! OSPF engedélyezése az interface-n ip ospf 1 area 0 duplex auto speed auto ! interface FastEthernet1/0 ip address 10.0.2.1 255.255.255.0 ip ospf network point-to-point ip ospf 1 area 0 duplex auto speed auto ! router ospf 1 ! Router-ID-t ajánlott kézzel megadni ! Más konfig nem kell, mivel interface alatt adtuk meg router-id 2.2.2.2 log-adjacency-changes ! router bgp 200 no synchronization bgp router-id 2.2.2.2 bgp log-neighbor-changes ! R3 és R4 route-reflector-client lesz, iBGP neighbor, és Lo1 interface-ről indítjuk a TCP session-t) neighbor 3.3.3.3 remote-as 200 neighbor 3.3.3.3 update-source Loopback1 neighbor 3.3.3.3 route-reflector-client neighbor 4.4.4.4 remote-as 200 neighbor 4.4.4.4 update-source Loopback1 neighbor 4.4.4.4 route-reflector-client ! R1 eBGP neighborként definálása neighbor 10.0.0.1 remote-as 100 no auto-summary !
R2-n már látszik is BGP-vel R1 Lo1 subnete. Next-hop 10.0.0.1, Path 100 i (azaz AS100-ból érkezett)
R2#sh ip bgp BGP table version is 2, local router ID is 2.2.2.2 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 1.1.1.1/32 10.0.0.1 0 0 100 i R2#
A ping működik, hiszen 10.0.0.1 számunkra locally connected.
R2#sh ip bgp 1.1.1.1 BGP routing table entry for 1.1.1.1/32, version 2 Paths: (1 available, best #1, table Default-IP-Routing-Table) Flag: 0x820 Advertised to update-groups: 2 100 10.0.0.1 from 10.0.0.1 (1.1.1.1) Origin IGP, metric 0, localpref 100, valid, external, best R2#
R2#ping 1.1.1.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 8/28/56 ms
Nézzük R3 és R4 konfigurációját:
***
R3
***
! ! interface Loopback1 ip address 3.3.3.3 255.255.255.255 ip ospf 1 area 0 ! interface FastEthernet0/0 no ip address shutdown duplex auto speed auto ! interface FastEthernet0/1 ip address 10.0.1.2 255.255.255.0 ip ospf network point-to-point ip ospf 1 area 0 duplex auto speed auto ! router ospf 1 router-id 3.3.3.3 log-adjacency-changes ! router bgp 200 no synchronization bgp router-id 3.3.3.3 bgp log-neighbor-changes neighbor 2.2.2.2 remote-as 200 neighbor 2.2.2.2 update-source Loopback1 no auto-summary !
*** R4 *** ! ! interface Loopback1 ip address 4.4.4.4 255.255.255.255 ip ospf 1 area 0 ! interface FastEthernet0/0 ip address 10.0.2.2 255.255.255.0 ip ospf network point-to-point ip ospf 1 area 0 duplex auto speed auto ! interface FastEthernet0/1 no ip address shutdown duplex auto speed auto ! router ospf 1 router-id 4.4.4.4 log-adjacency-changes ! router bgp 200 no synchronization bgp router-id 4.4.4.4 bgp log-neighbor-changes neighbor 2.2.2.2 remote-as 200 neighbor 2.2.2.2 update-source Loopback1 no auto-summary !
Főbb megjegyzések
– Update-source-t elég az egyik oldalon konfigurálni, de én szeretem ezt mindkét oldalon megtenni
– Az RR client-en nem kell semmi “különleges” konfiguráció, csak az RR-en kell a “route-reflector-client” paraméter
Nézzük R2-n, megvannak -e az OSPF neighborship-ek:
R2#sh ip ospf ne Neighbor ID Pri State Dead Time Address Interface 4.4.4.4 0 FULL/ - 00:00:32 10.0.2.2 FastEthernet1/0 3.3.3.3 0 FULL/ - 00:00:37 10.0.1.2 FastEthernet0/1 R2#
Eddig jó.
R3 tudja -e pingelni R4-et (kéne neki, mert a loopbackek be vannak hirdetve OSPF-be):
R3#sh ip route 4.4.4.4 Routing entry for 4.4.4.4/32 Known via "ospf 1", distance 110, metric 12, type intra area Last update from 10.0.1.1 on FastEthernet0/1, 00:12:21 ago Routing Descriptor Blocks: * 10.0.1.1, from 4.4.4.4, 00:12:21 ago, via FastEthernet0/1 Route metric is 12, traffic share count is 1 R3#sh ip ospf data router 4.4.4.4 OSPF Router with ID (3.3.3.3) (Process ID 1) Router Link States (Area 0) LS age: 752 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 4.4.4.4 Advertising Router: 4.4.4.4 LS Seq Number: 80000001 Checksum: 0x8429 Length: 60 Number of Links: 3 Link connected to: another Router (point-to-point) (Link ID) Neighboring Router ID: 2.2.2.2 (Link Data) Router Interface address: 10.0.2.2 Number of TOS metrics: 0 TOS 0 Metrics: 10 Link connected to: a Stub Network (Link ID) Network/subnet number: 10.0.2.0 (Link Data) Network Mask: 255.255.255.0 Number of TOS metrics: 0 TOS 0 Metrics: 10 Link connected to: a Stub Network (Link ID) Network/subnet number: 4.4.4.4 (Link Data) Network Mask: 255.255.255.255 Number of TOS metrics: 0 TOS 0 Metrics: 1 R3#
R3#ping 4.4.4.4 repe 5 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 48/59/64 ms R3#
eddig jó. iBGP neighborshipek is megvannak?
R2#sh ip bgp summary BGP router identifier 2.2.2.2, local AS number 200 BGP table version is 2, main routing table version 2 1 network entries using 120 bytes of memory 1 path entries using 52 bytes of memory 2/1 BGP path/bestpath attribute entries using 248 bytes of memory 1 BGP AS-PATH entries using 24 bytes of memory 0 BGP route-map cache entries using 0 bytes of memory 0 BGP filter-list cache entries using 0 bytes of memory Bitfield cache entries: current 1 (at peak 1) using 32 bytes of memory BGP using 476 total bytes of memory BGP activity 1/0 prefixes, 1/0 paths, scan interval 60 secs Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 3.3.3.3 4 200 13 14 2 0 0 00:10:13 0 4.4.4.4 4 200 13 14 2 0 0 00:10:15 0 10.0.0.1 4 100 14 13 2 0 0 00:10:16 1 R2#
Remek.
Kérdés: R3 tudja pingelni R1 Lo1-ét? Tippeket kérek…. :). Nem fogja tudni. Miért?
Bár látszik BGP-ből…
R3#sh ip bgp BGP table version is 1, local router ID is 3.3.3.3 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path * i1.1.1.1/32 10.0.0.1 0 100 0 100 i R3#
De…
R3#sh ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.1/32, version 0
Paths: (1 available, no best path)
Not advertised to any peer
100
10.0.0.1 (inaccessible) from 2.2.2.2 (2.2.2.2)
Origin IGP, metric 0, localpref 100, valid, internal
R3#
A next-hopot nem éri el? Miért? Mert az nincs behirdetve. Először érjük el, hogy R3 és R4 tudjon R1-ig csomagot küldeni (a vissza iránnyal még lesz gond):
a.) Next-hop-self beállítása R2-n vagy
b.) A transit link behirdetése OSPF-be
a.)
R2#conf t Enter configuration commands, one per line. End with CNTL/Z. R2(config)#router bgp 200 R2(config-router)#neighbor 3.3.3.3 next-hop-self R2(config-router)#neighbor 4.4.4.4 next-hop-self R2(config-router)#end R2#
Ezután R3-n
R3#sh ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.1/32, version 2
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0x820
Not advertised to any peer
100
2.2.2.2 (metric 11) from 2.2.2.2 (2.2.2.2)
Origin IGP, metric 0, localpref 100, valid, internal, best
De még mindig nem fog működni. R1-ig eljut a csomag, de onnan elhal.
R3(config-router)#do ping 1.1.1.1 source lo1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds: Packet sent with a source address of 3.3.3.3 ..... Success rate is 0 percent (0/5) R3(config-router)#do trace 1.1.1.1 source lo1 Type escape sequence to abort. Tracing the route to 1.1.1.1 1 10.0.1.1 44 msec 56 msec 16 msec 2 * * * 3 *
Ennek oka, hogy R1 nem tudja visszafelé küldeni a csomagot, mert a 3.3.3.3 IP számára ismeretlen.
R1#sh ip route 3.3.3.3 % Network not in table R1#sh ip cef 3.3.3.3 0.0.0.0/0, version 0, epoch 0, attached, default route handler 0 packets, 0 bytes via 0.0.0.0, 0 dependencies valid no route adjacency R1#
Itt több megoldás van, de mi most behirdetjük BGP-be a loopback címeket.
R2(config)#router bgp 200 R2(config-router)#net 2.2.2.2 mask 255.255.255.255 R2(config-router)#end R2#
R3(config)#router bgp 200 R3(config-router)#net 3.3.3.3 mask 255.255.255.255 R3(config-router)#end R3#
R4(config)#router bgp 200 R4(config-router)#net 4.4.4.4 mask 255.255.255.255 R4(config-router)#end R4#
Ezután R1-en:
R1#sh ip route 3.3.3.3 Routing entry for 3.3.3.3/32 Known via "bgp 100", distance 20, metric 0 Tag 200, type external Last update from 10.0.0.2 00:00:27 ago Routing Descriptor Blocks: * 10.0.0.2, from 10.0.0.2, 00:00:27 ago Route metric is 0, traffic share count is 1 AS Hops 1 Route tag 200
R1#sh ip cef 3.3.3.3 3.3.3.3/32, version 10, epoch 0, cached adjacency 10.0.0.2 0 packets, 0 bytes via 10.0.0.2, 0 dependencies, recursive next hop 10.0.0.2, FastEthernet0/0 via 10.0.0.2/32 valid cached adjacency R1#
És már megy is:
R3#ping 1.1.1.1 sou lo1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds: Packet sent with a source address of 3.3.3.3 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 24/43/60 ms R3#trace 1.1.1.1 source lo1 Type escape sequence to abort. Tracing the route to 1.1.1.1 1 10.0.1.1 40 msec 68 msec 24 msec 2 10.0.0.1 20 msec 64 msec 48 msec R3#
Végezetül nézzük meg R3 BGP tábláját:
R3#sh ip bgp BGP table version is 9, local router ID is 3.3.3.3 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *>i1.1.1.1/32 2.2.2.2 0 100 0 100 i r>i2.2.2.2/32 2.2.2.2 0 100 0 i *> 3.3.3.3/32 0.0.0.0 0 32768 i r>i4.4.4.4/32 4.4.4.4 0 100 0 i R3#
Az “r” RIB failure-t jelent, amely nem feltétlenül hiba. Ennek oka, hogy pl. a 2.2.2.2/32 IP OSPF-ből látszik, aminek AD-ja 110, ellentétben az iBGP 200-as AD-jával. Ezért a route nem BGP-ből kerül be a RIB-be.
R3#sh ip route 2.2.2.2 Routing entry for 2.2.2.2/32 Known via "ospf 1", distance 110, metric 11, type intra area Last update from 10.0.1.1 on FastEthernet0/1, 00:11:50 ago Routing Descriptor Blocks: * 10.0.1.1, from 2.2.2.2, 00:11:50 ago, via FastEthernet0/1 Route metric is 11, traffic share count is 1 R3#
A Route Reflector-okat azért találták ki, hogy ne kelljen minden iBGP router között kiépíteni a full mesh-t (erről a következő részben). A szabályok:
– eBGP route-kat hirdetjük client és non-client irányba
– non-client által tanult route-kat hirdetünk clientnek, eBGP-nek, de NEM hirdetünk non-clientnek.
– client-től tanult route-kat hirdetünk non-clientnek, client-nek, és eBGP-nek. A loop megelőzhető az Originator-ID beállításával az RR-n.
– Next-hop nem változik, azaz a RR nem nyúl bele az attribútumokba
Azaz non-client –> non-client nem hirdetünk. Ez loop megelőzés miatt van. Bővebben későbbi cikkben.
2 thoughts on “BGP lab”