Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 49 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
49
Dung lượng
0,96 MB
Nội dung
Giáo trình thựchành BSCI Chương 6 -BGP 197 C C h h ư ư ơ ơ n n g g 6 6 -- B B G G P P B B à à i i 6 6 . . 1 1 C C ấ ấ u u h h ì ì n n h h B B G G P P v v ớ ớ i i d d e e f f a a u u l l t t r r o o u u t t i i n n g g 6 6 . . 1 1 . . 1 1 S S ơ ơ đ đ ồ ồ l l u u ậ ậ n n l l ý ý S0 S1 S0 S1 10.0.0.0/30 172.16.0.0/30 12.0.1.0/24 172.16.1.0/24 192.168.0.0/24 192 . 168.1. 0/ 24 ISP1 ISP2 Router1 AS 200 AS 300 AS 100 Hình 6.1.1-1: Hình vẽ sơ đồ luận lý 6 6 . . 1 1 . . 2 2 M M ụ ụ c c t t i i ê ê u u c c ủ ủ a a b b à à i i t t h h ự ự c c h h à à n n h h Bài lab này cấu hình BGP trao đổi thong tin địnhtuyến với 2 ISP. 6 6 . . 1 1 . . 3 3 H H ư ư ớ ớ n n g g d d ẫ ẫ n n c c ấ ấ u u h h ì ì n n h h Bước 1: Cấu hình cơ bản cho Router1, ISP1, ISP2. Router1 Router(config)#hostname Router1 Router1(config)#enable password cisco Router1(config)#no ip domain-lookup Giáo trình thựchành BSCI Chương 6 -BGP 198 Router1(config)#banner motd ^C Router1^C Router1(config)#line console 0 Router1(config-line)# logging synchronous Router1(config-line)# password cisco Router1(config-line)# login Router1(config)#line vty 0 4 Router1(config-line)# password cisco Router1(config-line)# login Router1(config)#interface Serial 1 Router1(config-if)#ip address 10.0.0.2 255.255.255.252 Router1(config-if)#no shutdown Router1(config-if)#exit Router1(config)#interface loopback 0 Router1(config-if)#ip address 192.168.0.1 255.255.255.0 Router1(config-if)#exit Router1(config)#interface loopback 1 Router1(config-if)#ip address 192.168.1.1 255.255.255.0 Router1(config-if)#exit ISP1 Router(config)#hostname ISP1 ISP1(config)#enable password cisco ISP1(config)#no ip domain-lookup ISP1(config)#banner motd ^C ISP1^C ISP1(config)#line console 0 ISP1(config-line)# logging synchronous ISP1(config-line)# password cisco ISP1(config-line)# login ISP1(config)#line vty 0 4 ISP1(config-line)# password cisco ISP1(config-line)# login IPS1(config)#interface Serial 0 IPS1(config-if)#ip address 10.0.0.1 255.255.255.252 IPS1(config-if)#clock rate 64000 IPS1(config-if)#no shutdown IPS1(config)#int loopback 0 IPS1(config-if)#ip address 12.0.1.1 255.255.255.0 Giáo trình thựchành BSCI Chương 6 -BGP 199 IPS2 Router(config)#hostname ISP2 ISP2(config)#enable password cisco ISP2(config)#no ip domain-lookup ISP2(config)#banner motd ^C ISP2^C ISP2(config)#line console 0 ISP2(config-line)# logging synchronous ISP2(config-line)# password cisco ISP2(config-line)# login ISP2(config)#line vty 0 4 ISP2(config-line)# password cisco ISP2(config-line)# login ISP2(config)#interface serial 1 ISP2(config-if)#ip address 172.16.0.1 255.255.255.252 ISP2(config-if)#no shutdown ISP2(config)#interface loopback 0 ISP2(config-if)#ip address 172.16.1.1 255.255.255.0 Bước 2 : Cấu hình BGP trên Router1, ISP1, ISP2. Cấu hình BGP trên Router1 Router1(config)#router bgp 100 Router1(config-router)#neighbor 10.0.0.1 remote-as 200 Router1(config-router)#neighbor 172.16.0.1 remote-as 300 Router1(config-router)#network 192.168.0.0 Router1(config-router)#network 192.168.1.0 Router1(config-router)#exit Cấu hình BGP trên ISP1 IPS1(config)#router bgp 200 IPS1(config-router)#neighbor 10.0.0.2 remote-as 100 IPS1(config-router)#network 12.0.1.0 mask 255.255.255.0 IPS1(config-router)#exit Cấu hình BGP trên ISP2 ISP2(config)#router bgp 300 ISP2(config-router)#neighbor 172.16.0.2 remote-as 100 ISP2(config-router)#network 172.16.1.0 mask 255.255.255.0 IPS2(config-router)#exit Bước 3: kiểm tra BGP. Kiểm tra BGP trên Router1 Giáo trình thựchành BSCI Chương 6 -BGP 200 Router1#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 bgpBGP 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 *> 12.0.1.0/24 10.0.0.1 0 0 200 i *> 172.16.1.0/24 172.16.0.1 0 0 300 i *> 192.168.0.0 0.0.0.0 0 32768 i *> 192.168.1.0 0.0.0.0 0 32768 i Kiểm tra BGP trên ISP1 IPS1#show ip route Gateway of last resort is not set 172.16.0.0/24 is subnetted, 1 subnets B 172.16.1.0 [20/0] via 10.0.0.2, 00:03:07 10.0.0.0/30 is subnetted, 1 subnets C 10.0.0.0 is directly connected, Serial0 B 192.168.0.0/24 [20/0] via 10.0.0.2, 00:03:36 12.0.0.0/24 is subnetted, 1 subnets C 12.0.1.0 is directly connected, Loopback0 B 192.168.1.0/24 [20/0] via 10.0.0.2, 00:02:37 IPS1#show ip bgpBGP 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 Giáo trình thựchành BSCI Chương 6 -BGP 201 Network Next Hop Metric LocPrf Weight Path *> 12.0.1.0/24 0.0.0.0 0 32768 i *> 172.16.1.0/24 10.0.0.2 0 100 300 i *> 192.168.0.0 10.0.0.2 0 0 100 i *> 192.168.1.0 10.0.0.2 0 0 100 i Kiểm tra BGP trên ISP2 ISP2#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, Serial1 C 172.16.1.0/24 is directly connected, Loopback0 B 192.168.0.0/24 [20/0] via 172.16.0.2, 00:02:53 12.0.0.0/24 is subnetted, 1 subnets B 12.0.1.0 [20/0] via 172.16.0.2, 00:02:53 B 192.168.1.0/24 [20/0] via 172.16.0.2, 00:02:00 ISP2#show ip bgpBGP 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 Giáo trình thựchành BSCI Chương 6 -BGP 202 B B à à i i 6 6 . . 2 2 B B G G P P & & T T h h e e A A S S _ _ P P a a t t h h A A t t t t r r i i b b u u t t e e 6 6 . . 2 2 . . 1 1 S S ơ ơ đ đ ồ ồ l l u u ậ ậ n n l l ý ý S0/3/1 S0/3/0 S0/3/1 S0/0/0 192.168.1.4/30 172.25.1.16/30 12.0.1.0/24 172.16.1.0/24 202.0.0.0/24 Router1 Router2 ISP AS 100 AS 65000 AS 300 Hình 6.2.1-1: Hình vẽ sơ đồ luận lý 6 6 . . 2 2 . . 2 2 M M ụ ụ c c t t i i ê ê u u c c ù ù a a b b à à i i t t h h ự ự c c h h à à n n h h dùng AS_PATH Attribute to Filter Routes 6 6 . . 2 2 . . 3 3 H H ư ư ớ ớ n n g g d d ẫ ẫ n n c c ấ ấ u u h h ì ì n n h h v v à à h h ì ì n n h h v v ẽ ẽ m m i i n n h h h h ọ ọ a a Bước 1: Cấu hình cơ bản cho ISP, Router1, Router2 Router1 Router(config)#hostname Router1 Router1(config)#enable password cisco Router1(config)#no ip domain-lookup Router1(config)#banner motd ^C Router1^C Router1(config)#line console 0 Router1(config-line)# logging synchronous Router1(config-line)# password cisco Giáo trình thựchành BSCI Chương 6 -BGP 203 Router1(config-line)# login Router1(config)#line vty 0 4 Router1(config-line)# password cisco Router1(config-line)# login Router1(config)#interface serial 0/3/1 Router1(config-if)#ip address 192.168.1.5 255.255.255.252 Router1(config-if)#no shutdown Router1(config)#interface loopback 0 Router1(config-if)#ip address 12.0.1.1 255.255.255.0 Router1(config-if)#exit Router2 Router(config)#hostname Router2 Router2(config)#enable password cisco Router2(config)#no ip domain-lookup Router2(config)#banner motd ^C Router2^C Router2(config)#line console 0 Router2(config-line)# logging synchronous Router2(config-line)# password cisco Router2(config-line)# login Router2(config)#line vty 0 4 Router2(config-line)# password cisco Router2(config-line)# login Router2(config)#interface Serial 0/0/0 Router2(config-if)#ip address 172.24.1.17 255.255.255.252 Router2(config-if)#clock rate 64000 Router2(config-if)#no shutdown Router2(config)#interface loopback 0 Router2(config-if)#ip address 172.16.1.1 255.255.255.0 ISP Router(config)#hostname ISP1 ISP(config)#enable password cisco ISP(config)#no ip domain-lookup ISP(config)#banner motd ^C ISP1^C ISP(config)#line console 0 ISP(config-line)# logging synchronous ISP(config-line)# password cisco ISP(config-line)# login ISP(config)#line vty 0 4 Giáo trình thựchành BSCI Chương 6 -BGP 204 ISP(config-line)# password cisco ISP(config-line)# login IPS(config)#interface Serial 0/3/0 IPS(config-if)#ip address 192.168.1.6 255.255.255.252 IPS(config-if)#clock rate 64000 IPS(config-if)#no shutdown IPS(config)#interface interface Serial 0/3/1 IPS(config-if)#ip address 172.25.1.18 255.255.255.252 IPS(config-if)#no shutdown IPS(config)#int loopback 0 IPS(config-if)#ip address 202.0.0.1 255.255.255.0 Bước 2: Cấu hình BGP Cấu hình BGP trên Router1 Router1(config)#router bgp 100 Router1(config-router)#neighbor 192.168.1.6 remote-as 300 Router1(config-router)#network 12.0.1.0 mask 255.255.255.0 Router1(config-router)#exit Router1#show ip route Gateway of last resort is not set B 202.0.0.0/24 [20/0] via 192.168.1.6, 00:00:39 172.16.0.0/24 is subnetted, 1 subnets B 172.16.1.0 [20/0] via 192.168.1.6, 00:00:39 12.0.0.0/24 is subnetted, 1 subnets C 12.0.1.0 is directly connected, Loopback0 192.168.1.0/30 is subnetted, 1 subnets C 192.168.1.4 is directly connected, Serial0/3/1 Cấu hình BGP trên Router2 Router2(config)#router bgp 65000 Router2(config-router)#neighbor 172.25.1.18 remote-as 300 Router2(config-router)#network 172.16.1.0 mask 255.255.255.0 Router2(config-router)#exit Router2#show ip route Gateway of last resort is not set Giáo trình thựchành BSCI Chương 6 -BGP 205 B 202.0.0.0/24 [20/0] via 172.25.1.18, 00:01:55 172.16.0.0/24 is subnetted, 1 subnets C 172.16.1.0 is directly connected, Loopback0 172.25.0.0/24 is subnetted, 1 subnets C 172.25.1.0 is directly connected, Serial0/0/0 12.0.0.0/24 is subnetted, 1 subnets B 12.0.1.0 [20/0] via 172.25.1.18, 00:01:24 Cấu hình BGP trên ISP ISP(config)#router bgp 300 ISP(config-router)#neighbor 192.168.1.5 remote-as 100 ISP(config-router)#neighbor 172.26.1.17 remote-as 65000 ISP(config-router)#network 202.0.0.0 mask 255.255.255.0 ISP(config-router)#exit ISP#show ip route Gateway of last resort is 10.11.6.2 to network 0.0.0.0 C 202.0.0.0/24 is directly connected, Loopback0 172.16.0.0/24 is subnetted, 1 subnets B 172.16.1.0 [20/0] via 172.25.1.17, 00:00:37 172.25.0.0/30 is subnetted, 1 subnets C 172.25.1.16 is directly connected, Serial0/3/1 10.0.0.0/24 is subnetted, 1 subnets C 10.11.6.0 is directly connected, GigabitEthernet0/0 12.0.0.0/24 is subnetted, 1 subnets B 12.0.1.0 [20/0] via 192.168.1.5, 00:00:02 192.168.1.0/30 is subnetted, 1 subnets 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 Giáo trình thựchành BSCI Chương 6 -BGP 206 Kiể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 [...]... 215 Giáo trình thựchành BSCI Chương 6 -BGP Hình 6.4. 3-9 : Show ip bgp trên Router1 Hình 6.4. 3-1 0: 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-1 1: Show ip bgp Router1 trước khi dùng Next-Hop-Self 216 Giáo trình thựchành BSCI Chương 6 -BGP Hình 6.4. 3-1 2: Show ip route Router1 trước khi dùng Next-Hop-Self Hình 6.4. 3-1 3: Show ip bgp Router2 trước... trước khi dùng Next-Hop-Self Hình 6.4. 3-1 4: 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 217 Giáo trình thựchành BSCI Chương 6 -BGP Router2(config-router)#neighbor 172.16.64.1 next-hop-self Kiểm tra sau... hình BGP trên R4 R4(config)#router bgp 65002 R4(config-router)#neighbor 192.168.14.1 remote-as 65001 R4(config-router)#neighbor 192.168.34.1 remote-as 65001 R4(config-router)#exit Kiểm tra cấu hình Hình 6.5. 3-7 : Show ip bgp neighbors trên R1 229 Giáo trình thựchành BSCI Chương 6 -BGP Hì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-1 0: Show ip bgp. .. Next-Hop-Self Hình 6.4. 3-1 5: 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 Router1(config-route-map)#set local-preference 150 Router1(config-route-map)#exit Router1(config)#router bgp 64512 Router1(config-router)#neighbor...Giáo trình thựchành BSCI Chương 6 -BGP Hình 6.2. 3-4 : Show ip bgp regexp ^100$ 207 Giáo trình thựchành BSCI Chương 6 -BGP Bài 6.3 eBGP multihop 6.3.1 Sơ đồ luận lý Fa0/0 10.0.0.0/30 Fa0/0 BGP AS 1 R1 BGP AS 2 Fa0/1 10.0.0.4/30 1.1.1.1/32 Fa0/1 R2 Lo0 : 2.2.2.2/32 Lo1 : 192.168.1.1/24 Hình 6.3. 1-1 : Sơ đồ luận lý 6.3.2 Mục tiêu của bài thựchành eBGP multihop có thể dùng peers... R4(config-router)#network 10.4.4.4 0.0.0.0 228 Giáo trình thựchành BSCI Chương 6 -BGP R4(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... Router2(config-router)#end Router2#clear ip bgp * soft Kiểm tra kết quả sau khi set BGP Local Preference Chương 6 -BGP SECONDARY_ Hình 6.4. 3-1 7: Show ip bgp sau khi set BGP Local Preference trên Router1 Hình 6.4. 3-1 8: 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 Router1(config-route-map)#set metric... Router1(config-route-map)#exit Router1(config)#router bgp 64512 Router1(config-router)#neighbor 192.168.1.5 PRIMARY_MED_OUT out Router1(config-router)#end Router1#clear ip bgp * soft 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 route-map 219 Giáo trình thựchành BSCI Router2(config)#router bgp 64512... 2.2.2.2 ebgp-multihop 2 R1(config-router)# neighbor 2.2.2.2 update-source Loopback0 R1(config-router)#exit R1(config)#ip route 2.2.2.2 255.255.255.255 10.0.0.2 R1(config)#ip route 2.2.2.2 255.255.255.255 10.0.0.6 Cấu hình eBGP multihop trên Router2 R2(config)#router bgp 2 209 Giáo trình thựchành BSCI Chương 6 -BGP R2(config-router)#network 192.168.1.0 R2(config-router)# neighbor 1.1.1.1 remote-as 1... 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 213 Giáo trình thựchành BSCI Chương 6 -BGP Hì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