hiệu chỉnh route trong bgp dựa trên as-path

9 487 0
hiệu chỉnh route trong bgp dựa trên as-path

Đang tải... (xem toàn văn)

Thông tin tài liệu

Hiệu chỉnh Route trong BGP dựa trên AS-Path Mô tả: Trong bài Lab này , chúng ta sử dụng các thuộc tính BGP để hiệu chỉnh đường đi của Router Yêu cầu: - Traffic giữa AS2 & AS3 truyền qua link FAST ETHERNET - Traffic còn lại truyền trên đường SERIAL Thực hiện: 1. Kết nối mạng theo sơ đồ trên. Cấu hình hostname, địa chỉ IP cho các cổng theo đúng sơ đồ. Chưa cấu hình giao thức định tuyến. Kiểm tra kết nối bằng lệnh Ping và show cdp neighbor. 2. Cấu hình định tuyến eBGP cho các Router: R1(config)#router bgp 1 R1(config-router)# neighbor 192.168.12.2 remote-as 2 R1(config-router)# neighbor 192.168.21.2 remote-as 2 R1(config-router)# neighbor 192.168.31.3 remote-as 3 R1(config-router)# neighbor 192.168.13.3 remote-as 3 R1(config-router)# neighbor 192.168.14.4 remote-as 4 R2(config)#router bgp 2 R2(config-router)# neighbor 192.168.12.1 remote-as 1 R2(config-router)# neighbor 192.168.21.1 remote-as 1 R2(config-router)# network 2.2.2.0 mask 255.255.255.0 R3(config)#router bgp 3 R3(config-router)# neighbor 192.168.13.1 remote-as 1 R3(config-router)# neighbor 192.168.31.1 remote-as 1 R3(config-router)# network 3.3.3.0 mask 255.255.255.0 R4(config)#router bgp 4 R4(config-router)# neighbor 192.168.14.1 remote-as 1 R4(config-router)# network 4.4.4.0 mask 255.255.255.0 Dùng lệnh show ip route và show ip bgp để kiểm tra R1#sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS- IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set C 192.168.12.0/24 is directly connected, Serial2/2 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback0 C 192.168.13.0/24 is directly connected, Serial2/3 2.0.0.0/24 is subnetted, 1 subnets B 2.2.2.0 [20/0] via 192.168.12.2, 00:32 :40 C 192.168.14.0/24 is directly connected, Serial2/4 C 192.168.31.0/24 is directly connected, FastEthernet1/1 3.0.0.0/24 is subnetted, 1 subnets B 3.3.3.0 [20/0] via 192.168.13.3, 00:32 :40 4.0.0.0/24 is subnetted, 1 subnets B 4.4.4.0 [20/0] via 192.168.14.4, 00:32 :40 C 192.168.21.0/24 is directly connected, FastEthernet1/0 3. Tạo AS-Path Access-List . R1(config)#ip as-path access-list 2 permit _2$ R1(config)#ip as-path access-list 3 permit _3$ R1(config)#ip as-path access-list 4 permit _4$ 4. Trên R1 tạo route-map, ta gán giá trị MED tương ứng cho từng net. Giá trị MED càng nhỏ sẽ càng được ưu tiên. route-map S_R2 permit 10 match as-path 3 set metric 300 ! route-map S_R2 permit 20 set metric 150 ! route-map S_R3 permit 10 match as-path 2 set metric 300 ! route-map S_R3 permit 20 set metric 150 ! route-map F_R3 permit 10 match as-path 4 set metric 300 ! route-map F_R3 permit 20 set metric 150 ! route-map F_R2 permit 10 match as-path 4 set metric 300 ! route-map F_R2 permit 20 set metric 150 5. Apply trên BGP cho từng neighbor tương ứng theo chiều out R1(config)#router bgp 1 R1(config-router)#neighbor 192.168.12.2 route-map S_R2 out R1(config-router)#neighbor 192.168.13.3 route-map S_R3 out R1(config-router)#neighbor 192.168.21.2 route-map F_R2 out R1(config-router)#neighbor 192.168.31.3 route-map F_R3 out 6. Sau đó dùng lệnh clear ip bgp * trên các router để khởi động lại các kết nối BGP. Dùng lệnh show ip bgp trên R2 và R3 để kiểm tra R2#sh ip bgp BGP table version is 24, 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 *> 2.2.2.0/24 0.0.0.0 0 32768 i *> 3.3.3.0/24 192.168.21.1 150 0 1 3 i * 192.168.12.1 300 0 1 3 i * 4.4.4.0/24 192.168.21.1 300 0 1 4 i *> 192.168.12.1 150 0 1 4 i Ta thấy rằng lúc này trên R2 có 2 đường đi tới mạng 3.3.3.0/24 nhưng sẽ ưu tiên đi qua đường 192.168.21.1 – FAST ETHERNET ( có kí hiệu > tức best route) Tương tự trên R2 cũng có 2 đường đi tới mạng 4.4.4.0/24 nhưng sẽ ưu tiên đi qua đường 192.168.12.1 – SERIAL ( có kí hiệu > tức best route) Kiểm tra tương tự trên R3 R3#sh ip bgp BGP table version is 16, 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 *> 2.2.2.0/24 192.168.31.1 150 0 1 2 i * 192.168.13.1 300 0 1 2 i *> 3.3.3.0/24 0.0.0.0 0 32768 i * 4.4.4.0/24 192.168.31.1 300 0 1 4 i *> 192.168.13.1 150 0 1 4 i Traceroute từ R4 tới R2 thấy nó dùng đường serial để đi. R4#traceroute Protocol [ip]: Target IP address: 2.2.2.2 Source address: 4.4.4.4 Numeric display [n]: Timeout in seconds [3]: Probe count [3]: Minimum Time to Live [1]: Maximum Time to Live [30]: Port Number [33434]: Loose, Strict, Record, Timestamp, Verbose[none]: Type escape sequence to abort. Tracing the route to 2.2.2.2 1 192.168.14.1 84 msec 64 msec 64 msec 2 192.168.12.2 124 msec 148 msec * Tương tự từ R4 tới R3 R4#traceroute Protocol [ip]: Target IP address: 3.3.3.3 Source address: 4.4.4.4 Numeric display [n]: Timeout in seconds [3]: Probe count [3]: Minimum Time to Live [1]: Maximum Time to Live [30]: Port Number [33434]: Loose, Strict, Record, Timestamp, Verbose[none]: Type escape sequence to abort. Tracing the route to 3.3.3.3 1 192.168.14.1 84 msec 104 msec 104 msec 2 192.168.13.3 64 msec 140 msec * Full cấu hình trên R1 sh run Building configuration Current configuration : 2467 bytes ! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R1 ! boot-start-marker boot-end-marker ! ! no aaa new-model ip subnet-zero ! ! ! ip cef ip audit po max-events 100 ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface Loopback0 no ip address ! interface FastEthernet0/0 no ip address shutdown duplex half ! interface FastEthernet1/0 ip address 192.168.21.1 255.255.255.0 duplex auto speed auto ! interface FastEthernet1/1 ip address 192.168.31.1 255.255.255.0 duplex auto speed auto ! ! interface Serial2/2 ip address 192.168.12.1 255.255.255.0 serial restart-delay 0 ! interface Serial2/3 ip address 192.168.13.1 255.255.255.0 serial restart-delay 0 ! interface Serial2/4 ip address 192.168.14.1 255.255.255.0 serial restart-delay 0 ! router bgp 1 no synchronization bgp log-neighbor-changes neighbor 192.168.12.2 remote-as 2 neighbor 192.168.12.2 route-map S_R2 out neighbor 192.168.13.3 remote-as 3 neighbor 192.168.13.3 route-map S_R3 out neighbor 192.168.14.4 remote-as 4 neighbor 192.168.21.2 remote-as 2 neighbor 192.168.21.2 route-map F_R2 out neighbor 192.168.31.3 remote-as 3 neighbor 192.168.31.3 route-map F_R3 out no auto-summary ! ip classless no ip http server no ip http secure-server ! ip as-path access-list 2 permit _2$ ip as-path access-list 3 permit _3$ ip as-path access-list 4 permit _4$ ! ! route-map S_R2 permit 10 match as-path 3 set metric 300 ! route-map S_R2 permit 20 set metric 150 ! route-map S_R3 permit 10 match as-path 2 set metric 300 ! route-map S_R3 permit 20 set metric 150 ! route-map F_R3 permit 10 match as-path 4 set metric 300 ! route-map F_R3 permit 20 set metric 150 ! route-map F_R2 permit 10 match as-path 4 set metric 300 ! route-map F_R2 permit 20 set metric 150 ! ! ! ! ! ! ! gatekeeper shutdown ! ! line con 0 logging synchronous stopbits 1 line aux 0 stopbits 1 line vty 0 4 ! ! end . Hiệu chỉnh Route trong BGP dựa trên AS-Path Mô tả: Trong bài Lab này , chúng ta sử dụng các thuộc tính BGP để hiệu chỉnh đường đi của Router Yêu cầu: - Traffic giữa. 150 5. Apply trên BGP cho từng neighbor tương ứng theo chiều out R1(config)#router bgp 1 R1(config-router)#neighbor 192.168.12.2 route- map S_R2 out R1(config-router)#neighbor 192.168.13.3 route- map. out R1(config-router)#neighbor 192.168.21.2 route- map F_R2 out R1(config-router)#neighbor 192.168.31.3 route- map F_R3 out 6. Sau đó dùng lệnh clear ip bgp * trên các router để khởi động lại các kết nối BGP. Dùng

Ngày đăng: 16/11/2014, 19:46

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan