Router1config#banner motd ^C Router1^C Router1config#line console 0 Router1config-line# logging synchronous Router1config-line# password cisco ISP1config-line# logging synchronous IS
Trang 16.1.2 Mục tiêu của bài thực hành
Bài lab này cấu hình BGP trao đổi thong tin định tuyến với 2 ISP
Trang 2Router1(config)#banner motd ^C Router1^C
Router1(config)#line console 0
Router1(config-line)# logging synchronous
Router1(config-line)# password cisco
ISP1(config-line)# logging synchronous
ISP1(config-line)# password cisco
Trang 3ISP2(config-line)# logging synchronous
ISP2(config-line)# password cisco
Bước 2 : Cấu hình BGP trên Router1, ISP1, ISP2
Cấu hình BGP trên Router1
B ước 3: kiểm tra BGP
Kiểm tra BGP trên Router1
Trang 4Router1#show ip route
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.16.0.0/30 is directly connected, Serial0
B 172.16.1.0/24 [20/0] via 172.16.0.1, 00:01:31
10.0.0.0/30 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, Serial1
C 192.168.0.0/24 is directly connected, Loopback0
12.0.0.0/24 is subnetted, 1 subnets
B 12.0.1.0 [20/0] via 10.0.0.1, 00:01:31
C 192.168.1.0/24 is directly connected, Loopback1
Router1#show ip bgp
BGP table version is 5, local router ID is 192.168.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
BGP table version is 5, local router ID is 10.0.0.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete
Trang 5Network Next Hop Metric LocPrf Weight Path
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.16.0.0/30 is directly connected, Serial1
C 172.16.1.0/24 is directly connected, Loopback0
BGP table version is 5, local router ID is 172.16.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
*> 12.0.1.0/24 172.16.0.2 0 100 200 i
*> 172.16.1.0/24 0.0.0.0 0 32768 i
*> 192.168.0.0 172.16.0.2 0 0 100 i
*> 192.168.1.0 172.16.0.2 0 0 100 i
Trang 6Bài 6.2 BGP & The AS_Path At ribute
6.2.2 Mục tiêu cùa bài thực hành
dùng AS_PATH Attribute to Filter Routes
6.2.3 Hướng dẫn cấu hình và hình vẽ minh họa
Bước 1: Cấu hình cơ bản cho ISP, Router1, Router2
Router1(config-line)# logging synchronous
Router1(config-line)# password cisco
Trang 7Router2(config-line)# logging synchronous
Router2(config-line)# password cisco
ISP(config-line)# logging synchronous
ISP(config-line)# password cisco
ISP(config-line)# login
ISP(config)#line vty 0 4
Trang 8ISP(config-line)# password cisco
C 192.168.1.4 is directly connected, Serial0/3/1
Cấu hình BGP trên Router2
Trang 9Gateway of last resort is 10.11.6.2 to network 0.0.0.0
C 202.0.0.0/24 is directly connected, Loopback0
C 192.168.1.4 is directly connected, Serial0/3/0
Bước 3: Remove the Private AS
ISP(config)#router bgp 300
ISP(config-router)#neighbor 192.168.1.5 remove-private-as
Trang 10Kiểm tra trên Router1
Hình 6.2.3-1: Show ip bgp trên Router1 để kiểm tra
Bước 4: dùng AS_PATH Attribute to Filter Routes
ISP(config)#ip as-path access-list 1 deny ^100$
ISP(config)#ip as-path access-list 1 permit *
ISP(config)#router bgp 300
ISP(config-router)#neighbor 172.25.1.17 filter-list 1 out
Hình 6.2.3-2: Show ip route trên Router1
Hình 6.2.3-3: Show ip route trên Router2
Trang 11Hình 6.2.3-4: Show ip bgp regexp ^100$
Trang 12Bài 6.3 eBGP multihop
6.3.1 Sơ đồ uận ý
10.0.0.0/30
Lo0 : 2.2.2.2/32 Lo1 : 192.168.1.1/24 10.0.0.4/30
6.3.2 Mục tiêu của bài thực hành
eBGP multihop có thể dùng loadshare traffic qua nhiều link eBGP peers
6.3.3 Hướng dẫn cấu hình và hình vẽ minh họa
Bước 1: Cấu hình cơ bản R1, R2
R1(config-line)# logging synchronous
R1(config-line)# password cisco
Trang 13R2(config-line)# logging synchronous
R2(config-line)# password cisco
Bước 2: Cấu hình eBGP multihop trên R1, R2
Cấu hình eBGP multihop trên Router1
R1(config)#router bgp 1
R1(config-router)# neighbor 2.2.2.2 remote-as 2
R1(config-router)# neighbor 2.2.2.2 ebgp-multihop 2
R1(config-router)# neighbor 2.2.2.2 update-source Loopback0
Trang 14R2(config-router)#network 192.168.1.0
R2(config-router)# neighbor 1.1.1.1 remote-as 1
R2(config-router)# neighbor 1.1.1.1 ebgp-multihop 2
R2(config-router)#neighbor 1.1.1.1 update-source Loopback0
R2(config-router)#exit
R2(config)#ip route 1.1.1.1 255.255.255.255 10.0.0.1
R2(config)#ip route 1.1.1.1 255.255.255.255 10.0.0.5
Bước 3: Kiểm tra cấu hình
Hình 6.3.3-1: Show ip route trên R1
Hình 6.3.3-2: Show ip cef 192.168.1.0
Trang 15Bài 6.4 Cấu hình IBGP và EBGP, Local Preference và MED
(Multi-Exit Dis riminator
192.168.1.0/30S0/3/1
S0/0/0
iBGP
EBGPEBGP
Hình 6.4.1-1: Hình vẽ sơ đồ luận lý
6.4.2 Mục tiêu của bài thực hành
Cấu hình IBGP và EBGP, Local Preference và MED (Multi-Exit Discriminator)
6.4.3 Hướng dẫn cấu hình và hình vẽ minh họa
Bước 1: Cấu hình cơ bản trên Router1, Router2, ISP
Router1
Router(config)#hostname Router1
Router1(config)#enable password cisco
Router1(config)#no ip domain-lookup
Trang 16Router1(config)#banner motd ^C Router1^C
Router1(config)#line console 0
Router1(config-line)# logging synchronous
Router1(config-line)# password cisco
Router2(config-line)# logging synchronous
Router2(config-line)# password cisco
Trang 17ISP(config-line)# logging synchronous
ISP(config-line)# password cisco
Bước 2 : Cấu hình EIGRP trên Router1 và Router2
Cấu hình EIGRP trên Router1
Router1(config)#router eigrp 64512
Router1(config-router)#network 172.16.1.1 0.0.0.0
Router1(config-router)#network 172.16.64.1 0.0.0.0
Router1(config-router)#no auto-summary
Hình 6.4.3-1: Show ip eirgp neighbors trên Router1
Cấu hình EIGRP trên Router2
Router2(config)#router eigrp 64512
Router2(config-router)#network 172.16.1.2 0.0.0.0
Router2(config-router)#network 172.16.32.1 0.0.0.0
Router2(config-router)#no auto-summary
Trang 18Hình 6.4.3-2: Show ip eirgp neighbors trên Router1
Bước 3: Cấu hình iBGP trên Router1 và Router2
Cấu hình iBGP trên Router1
Router1(config)#router bgp 64512
Router1(config-router)#neighbor 172.16.32.1 remote-as 64512
Router1(config-router)#neighbor 172.16.32.1 update-source loopback 0
Router1(config-router)#end
Hình 6.4.3-3: Show ip bgp neighbors trên Router1
Cấu hình iBGP trên Router2
Router2(config)#router bgp 64512
Router2(config-router)#neighbor 172.16.64.1 remote-as 64512
Router2(config-router)#neighbor 172.16.64.1 update-source loopback 0
Router2(config-router)#end
Hình 6.4.3-4: Show ip bgp neighbors trên Router2
Bước 4: Cấu hình EBGP (ISP run EBGP với Router1 và Router2)
Cấu hình EBGP trên ISP
Trang 19Cấu hình EBGP trên Router2
Bước 5: Kiểm tra BGP Neighbors
Hình 6.4.3-5: Show ip bgp neighbors trên ISP
Hình 6.4.3-6: Show ip bgp neighbors trên Router1
Hình 6.4.3-7: Show ip bgp neighbors trên Router2
Bước 6 Kiểm tra Which Path Traffic Takes
Hình 6.4.3-8: Show ip bgp trên ISP
Trang 20Hình 6.4.3-9: Show ip bgp trên Router1
Hình 6.4.3-10: Show ip bgp trên Router2
Bước 7: BGP Next-Hop-Self
Kiểm tra trước khi sử dụng Next-Hop-Seft
Hình 6.4.3-11: Show ip bgp Router1 trước khi dùng Next-Hop-Self
Trang 21Hình 6.4.3-12: Show ip route Router1 trước khi dùng Next-Hop-Self
Hình 6.4.3-13: Show ip bgp Router2 trước khi dùng Next-Hop-Self
Hình 6.4.3-14: Show ip route Router2 trước khi dùng Next-Hop-Self
Cấu hình Next-Hop-Self trên Router1
Router1(config)#router bgp 64512
Router1(config-router)#neighbor 172.16.32.1 next-hop-self
Cấu hình Next-Hop-Self trên Router2
Router2(config)#router bgp 64512
Trang 22Router2(config-router)#neighbor 172.16.64.1 next-hop-self
Kiểm tra sau khi sử dụng Next-Hop-Self
Hình 6.4.3-15: Show ip route Router1 sau khi dùng Next-Hop-Self
Hình 6.4.3-16: Show ip route Router2 sau khi dùng Next-Hop-Self
Bước 8: Set BGP Local Preference
Set BGP Local Preference trên Router1
Router1(config)#route-map PRIMARY_LocPrf_IN permit 10
Set BGP Local Preference trên Router2
Router2(config)#route-map SECONDARY_ LocPrf_IN permit 10
Router2(config-route-map)#set local-preference 125
Router2(config-route-map)#exit
Router2(config)#router bgp 64512
Trang 23Router2(config-router)#neighbor 192.168.1.1 route-map SECONDARY_ LocPrf_IN in
Router2(config-router)#end
Router2#clear ip bgp * soft
Kiểm tra kết quả sau khi set BGP Local Preference
Hình 6.4.3-17: Show ip bgp sau khi set BGP Local Preference trên Router1
Hình 6.4.3-18: Show ip bgp sau khi set BGP Local Preference trên Router2
Bước 9: Set BGP MED
Set BGP MED trên Router1
Router1(config)#route-map PRIMARY_MED_OUT permit 10
Set BGP MED trên Router2
Router2(config)#route-map SECONDARY_MED_OUT permit 10
Router2(config-route-map)#set metric 100
Router2(config-route-map)#exit
Trang 24Kiểm tra kết quả sau khi set BGP MED
Hình 6.4.3-19: Show ip bgp trên ISP sau khi set BGP MED
Bước 10: Establish a Default Network
Router1(config)#ip default-network 192.168.100.0
Router1(config)#router bgp 64512
Router1(config-router)#neighbor 172.16.32.1 default-originate
Router1(config-router)#end
Kiểm tra cấu hình trên Router1 và Rout2
Hình 6.4.3-20: Show ip route trên Router1 sau khi có default network
Trang 25Hình 6.4.3-21: Show ip route tren Router2 sau khi có default network
Trang 26SW1
192.168.34.0/30 192.168.14.0/30
Lo0 : 10.2.2.2/24 Lo1 : 10.20.0.1/24 Lo2 : 10.20.1.1/24 Lo3 : 10.20.2.1/24 Lo4 : 10.20.3.1/24
Lo1 : 172.16.0.1/22 Lo2 : 172.16.4.1/22 Lo3 : 172.16.8.1/22 Lo4 : 172.16.12.1/22
Fa0/2 Fa0/0 R4S0/3/0
Hình 6.5.1-1: Hình vẽ sơ đồ luận lý
6.5.2 Mục tiêu của bài thực hành
Cấu hình Provider network với EIGRP AS 65002 (Tắt chức năng automatic summarization trên cả 2 domain của EIGRP)
Trang 27Cấu hình International network với BGP AS 65001 và Provider network với BGP 65002
Quảng bá mạng 192.168.14.0/30 và 192.168.34.0/30 trên cả 2 AS của EIGRP
Tất cả router tham gia vào BGP Cấu hình tất cả router dạng full mest iBGP Quảng bá tất cả interface loopback vào BGP, ngoại trừ R2, chỉ quản bá loopback 10.2.2.0/24
Trên R2, tạo một static summary route cho các interface loopback còn lại và quản bá static route này vào BGP
R4 gửi một summary route của tất cả interface loopback tới vùng International
Những Router trong vùng International sử dụng đường đi tới vùng Provider thông qua liên kết Ethernet giữa R1 và R4 Để hoàn thành việc này, cần phải chỉnh sửa thông số Local Preference của các đường route đã quản bá từ Providers
6.5.3 Hướng dẫn cấu hình và hình vẽ minh họa
Bước 1: Cấu hình cơ bản cho R1, R2, R3, R4
R1(config-line)# logging synchronous
R1(config-line)# password cisco
Trang 28R2(config-line)# logging synchronous
R2(config-line)# password cisco
Trang 29R3(config-line)# logging synchronous
R3(config-line)# password cisco
Trang 30R4(config)#enable password cisco
R4(config)#no ip domain-lookup
R4(config)#banner motd ^C R4^C
R4(config)#line console 0
R4(config-line)# logging synchronous
R4(config-line)# password cisco
Bước 2 : Cấu hình International network với EIGRP AS 65001
Cấu hình EIGRP trên R1
R1(config)#router eigrp 65001
Trang 31Kiểm tra cấu hình
Hình 6.5.3-1: Show ip eigrp neighbors trên R1
Hình 6.5.3-2: Show ip route eigrp trên R1
Trang 32Hình 6.5.3-3: Show ip eigrp neighbors trên R2
Hình 6.5.3-4: Show ip route eigrp trên R2
Hình 6.5.3-5: Show ip eigrp neighbors trên R3
Hình 6.5.3-6: Show ip route eigrp trên R3
Bước 3: Cấu hình Provider network với EIGRP AS 65002 (Tắt chức
năng automatic summarization trên cả 2 domain của EIGRP)
Cấu hình EIGRP trên R1
Trang 33R4(config-router)#no auto-summary
R4(config-router)#exit
Bước 4: Cấu hình International network với BGP AS 65001 và
Provider network với BGP 65002
Cấu hình BGP trên R1
R1(config)#router bgp 65001
R1(config-router)#neighbor 10.2.2.2 remote-as 65001
R1(config-router)#neighbor 10.3.3.3 remote-as 65001
R1(config-router)#neighbor 10.2.2.2 update-source loopback 0
R1(config-router)#neighbor 10.3.3.3 update-source loopback 0
R2(config-router)#neighbor 10.1.1.1 update-source loopback 0
R2(config-router)#neighbor 10.3.3.3 update-source loopback 0
R3(config-router)#neighbor 10.1.1.1 update-source loopback 0
R3(config-router)#neighbor 10.2.2.2 update-source loopback 0
Kiểm tra cấu hình
Hình 6.5.3-7: Show ip bgp neighbors trên R1
Trang 34Hình 6.5.3-8: Show ip bgp neighbors trên R2
Hình 6.5.3-9: Show ip bgp neighbors trên R3
Hình 6.5.3-10: Show ip bgp neighbors trên R4
Bước 5: Quảng bá mạng 192.168.14.0/30 và 192.168.34.0/30 trên cả
Kiểm tra cấu hình
Hình 6.5.3-11: Show ip route eigrp trên R1
Trang 35Hình 6.5.3-12: Show ip route eigrp trên R3
Bước 6: Tất cả router tham gia vào BGP Cấu hình tất cả router dạng
full mest iBGP Quảng bá tất cả interface loopback vào BGP, ngoại trừ R2, chỉ quản bá loopback 10.2.2.0/24
R2(config-router)# network 10.1.102.0 mask 255.255.255.248
R2(config-router)# network 10.1.203.0 mask 255.255.255.248
Trang 37Hình 6.5.3-15: Show ip bgp trên R2
Hình 6.5.3-16: Show ip route bgp trên R2
Trang 38Hình 6.5.3-17: Show ip bgp trên R3
Hình 6.5.3-18: Show ip route bgp trên R3
Trang 39Hình 6.5.3-19: Show ip bgp trên R4
Hình 6.5.3-20: Show ip route bgp trên R4
Bước 7: Trên R2, tạo một static summary route cho các interface
loopback còn lại và quản bá static route này vào BGP
R2(config)#router bgp 65001
R2(config-router)#aggregate-address 10.20.0.0 255.255.252.0
R2(config-router)#exit
Trang 40Hình 6.5.3-21: Show ip bgp trên R2
Trang 41Hình 6.5.3-22: Show ip bgp trên R4
Hình 6.5.3-23: show ip route bgp trên R4
Bước 8: R4 gửi một summary route của tất cả interface loopback tới
vùng International
R4(config)#router bgp 65002
R4(config-router)#aggregate-address 172.16.0.0 255.255.240.0
R4(config-router)#end
Trang 42Hình 6.5.3-24: Show ip bgp trên R4
Trang 43Hình 6.5.3-25: Show ip bgp trên R2
Hình 6.5.3-26: Show ip route bgp trên R2
Bước 9: R4 sử dụng đường đến vùng International bằng liên kết giữa
R1 và R4 Hoàn thành việc này bằng việc thay đổi thông số MED quản
Trang 44R4(config-router)#neighbor 192.168.14.1 route-map PRIMARY_MED_OUT out
SECONDARY_MED_OUT out
R4(config-router)#end
R4#clear ip bgp * soft
Kiểm tra kết quả sau khi set BGP MED
Bước 10: Những Router trong vùng International sử dụng đường đi tới
vùng Provider thông qua liên kết Ethernet giữa R1 và R4 Để hoàn thành việc này, cần phải chỉnh sửa thông số Local Preference của các đường route đã quản bá từ Providers
Set BGP Local Preference trên Router1
R1(config)#route-map PRIMARY_LocPrf_IN permit 10
Set BGP Local Preference trên Router2
R3(config)#route-map SECONDARY_ LocPrf_IN permit 10
Trang 45Bài 6.6 BGP Route Reflectors & Fi ters
6.6.1 Sơ đồ uận ý
200.100.50.0/24
199.9.9.0/24
172.24.1.0/24 192.168.1.4/30
AS 100
S0/0/1 S0/3/0
R2
Hình 6.6.1-1: Hình vẽ sơ đồ luận lý
6.6.2 Mục tiêu bài thực hành
Bài lab này cấu hình IBGP routers dùng route reflector và route filter
6.6.3 Hướng dẫn cấu hình và hình vẽ minh họa
Bước 1: Cấu hình cơ bản cho R1, R2, R3
R1(config-line)# logging synchronous
R1(config-line)# password cisco
R1(config-line)# login
R1(config)#line vty 0 4
R1(config-line)# password cisco
Trang 46R2(config-line)# logging synchronous
R2(config-line)# password cisco
R3(config-line)# logging synchronous
R3(config-line)# password cisco
R3(config-line)# login