nếu một trong các kết nối WAN của EIGRP xảy ra sự cố.Do BGP chỉ quảng bá các network bên ngoài các thành phần không phải của EIGRP, ta cấu hình lệnh sau trên router SaiGon1 và SaiGon2: S
Trang 1Cấu hình IBGP và EBGP Session, Local Preference và MED
1 Mục tiêu
Trong bài lab này, chúng ta sẽ cấu hình IBGP và EBGP Để cho các IBGP peers trao đổi thông tin định tuyến chính xác, ta sẽ dùng lệnh next-hop-self Các thuộc tính Local Preference và MED cũng sẽ được sử dụng
3 Thực hiện
a Bước 1
Kết nối mạng theo sơ đồ như trên Cấu hình hostname, địa chỉ IP các interface serial, interface loopback theo đúng sơ đồ Chưa cấu hình routing protocol Kiểm tra các kết nối trực tiếp bằng lệnh ping và show cdp neighbor
SaiGon1(config-router)#neighbor 172.16.32.1 update-source loopback 0
Topology này, ta dùng VLSM Do đó, ta phải bỏ auto summary theo classful bằng lệnh
Trang 2nếu một trong các kết nối WAN của EIGRP xảy ra sự cố.
Do BGP chỉ quảng bá các network bên ngoài các thành phần không phải của EIGRP, ta cấu hình lệnh sau trên router SaiGon1 và SaiGon2:
SaiGon1(config-router)#router bgp 64512
SaiGon1(config-router)#no synchronization
SaiGon2(config-router)#router bgp 64512
SaiGon2(config-router)#no synchronization
Lệnh no synchronization sẽ cho phép BGP quảng bá các mạng mà không cần quan tâm
đến EIGRP có biết đến các mạng đó hay không Thông thường, BGP sẽ không quảng bá network cho một external neighbor trừ khi route đó là local hay tồn tại trong IGP
SaiGon2(config-router)#neighbor 172.16.64.1 update-source lo0
Kiểm tra router SaiGon1 và SaiGon2 đã là neighbor hay chưa bằng lệnh show ip bgp neighbor trên router SaiGon2 Xem đoạn output sau, nếu trạng thái BGP không là
Established, kiểm tra lại cấu hình
SaiGon2#show ip bgp neighbors
BGP neighbor is 172.16.64.1, remote AS 64512, internal link
Index 1, Offset 0, Mask 0x2
BGP version 4, remote router ID 172.16.64.1
BGP state = Established, table version = 1, up for 00:04:27
Trang 3f Bước 6:
Cấu hình router SaiGon1 là một EBGP peer đến ISP như sau:
SaiGon1(config)#ip route 172.16.0.0 255.255.0.0 null0
SaiGon1(config)#router bgp 64512
SaiGon1(config-router)#neighbor 192.168.1.5 remote-as 200
SaiGon1(config-router)#network 172.16.0.0
Dùng lệnh show ip bgp neighbors kiểm tra xem router SaiGon1 và router ISP đã tới
trạng thái Establish hay chưa, chẩn đoán lỗi nếu cần thiết.
g Bước 7
Cấu hình router SaiGon2 là một EBGP peer đến ISP:
SaiGon2(config)#ip route 172.16.0.0 255.255.0.0 null0
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 172.16.64.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/28/29 ms
ISP#ping 172.16.32.1
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 172.16.32.1, timeout is 2 seconds:
Trang 4
Success rate is 0 percent (0/5)
Dùng lệnh show ip bgp trên router ISP để kiểm tra các BGP route và metric:
ISP#show ip bgp
BGP table version is 3, local router ID is 192.168.100.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
… để tính toán metric, còn BGP là một dạng policy-based BGP sẽ xác định đường đi tốt
nhất dựa vào một số tham số như AS-Path Weight, Local Preference, MED, …
Lúc này, router ISP có thể ping được các địa chỉ của các router SaiGon1 và SaiGon2 bằng địa chỉ Ethernet 192.168.100.1
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 172.16.32.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 41/43/44 ms
Ta thực hiện lại lệnh ping đến 172.16.32.1 từ ISP:
Trang 5ISP#ping 172.16.32.1
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 172.16.32.1, timeout is 2 seconds:
Success rate is 0 percent (0/5)
Tại sao không ping tới 172.16.32.1 được? Ta dùng lệnh debug ip packet trên router
SaiGon2 và ping lại lần nữa để xem kết quả:
SaiGon2#debug ip packet
IP packet debugging is on
ISP#ping 172.16.32.1
SaiGon2#
00 06: IP: s=192.168.1.5 (Serial0/0), d=172.16.32.1, len 100, rcvd 4
00 06: IP: s=172.16.32.1 (local), d=192.168.1.5, len 100, unroutable
00 06: IP: s=192.168.1.1 (Serial0/1), d=192.168.1.2, len 59, rcvd 0
SaiGon2#
00 08: IP: s=192.168.1.5 (Serial0/0), d=172.16.32.1, len 100, rcvd 4
00 08: IP: s=172.16.32.1 (local), d=192.168.1.5, len 100, unroutable
00 08: IP: s=172.16.32.1 (local), d=224.0.0.10 (Loopback0), len 60, sending
00 09: IP: s=172.16.1.1 (Serial0/0), d=224.0.0.10, len 60, rcvd 2
00 10: IP: s=192.168.1.5 (Serial0/0), d=172.16.32.1, len 100, rcvd 4
00 10: IP: s=172.16.32.1 (local), d=192.168.1.5, len 100, unroutable
Kết quả từ debug cho ta thấy packet đến 192.168.1.5 không route được, ta kiểm tra bảng định tuyến của router SaiGon2:
SaiGon2#show ip route
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 4 subnets, 3 masks
C 172.16.32.0/24 is directly connected, Loopback0
S 172.16.0.0/16 is directly connected, Null0
C 172.16.1.0/30 is directly connected, Serial0/0
D 172.16.64.0/24 [90/2297856] via 172.16.1.1, 00:31:46, Serial0/0
Trang 6vì, nếu dùng cách còn lại sẽ có nguy cơ làm mạng của chúng ta là transit AS.
Trên router ISP, ta cấu hình:
ISP(config)#router bgp 200
ISP(config-router)#network 192.168.1.0 mask 255.255.255.252
ISP(config-router)#network 192.168.1.4 mask 255.255.255.252
Xóa các liên kết BGP trên router ISP bằng lệnh clear ip bgp *, chờ một thời gian, sau đó
dùng lệnh show ip bgp trên router ISP để xem các liên kết BGP hiện hữu trên router này
ISP#show ip bgp
BGP table version is 5, local router ID is 192.168.100.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
SaiGon2#show ip route
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 4 subnets, 3 masks
C 172.16.32.0/24 is directly connected, Loopback0
S 172.16.0.0/16 is directly connected, Null0
C 172.16.1.0/30 is directly connected, Serial0/0
D 172.16.64.0/24 [90/2297856] via 172.16.1.1, 00 27, Serial0/0
Trang 7là cách đưa các packet đến mạng 192.168.1.0/30 và 192.168.1.4/30 Trong trường hợp một liên kết WAN gặp sự cố, liên kết còn lại phải đóng vai trò chủ đạo làm gateway
Điểu này chỉ có thể đạt được bằng cách cấu hình lệnh next-hop-self trên router SaiGon1
và SaiGon2
Trước khi cấu hình lệnh next-hop-self:
SaiGon2#show ip bgp
BGP table version is 11, local router ID is 172.16.32.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
Xóa các liên kết BGP bằng lệnh clear ip bgp *, chờ một thời gian, sau đó dùng lệnh
show ip bgp để xem các liên kết BGP hiện hữu trên router SaiGon2
SaiGon2#show ip bgp
BGP table version is 9, local router ID is 172.16.32.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Trang 8Network Next Hop Metric LocPrf Weight Path
SaiGon1(config)#route-map PRIMARY_IN permit 10
SaiGon1(config-route-map)#set local-preference 150
SaiGon1(config-route-map)#exit
SaiGon1(config)#router bgp 64512
SaiGon1(config-router)#neighbor 192.168.1.5 route-map PRIMARY_IN in
SaiGon2(config)#route-map SECONDARY_IN permit 10
BGP table version is 8, local router ID is 172.16.32.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
Trang 9Output trên cho ta thấy packet đến network 192.168.100.0/24 sẽ đi theo đường qua router SaiGon1 để đến router ISP.
Ta kiểm tra packet từ router SaiGon2 khi đến router ISP có thực sự đi qua router SaiGon1 hay không bằng extend ping:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]: record
Number of hops [ 9 ]:
Loose, Strict, Record, Timestamp, Verbose[RV]:
Sweep range of sizes [n]:
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 192.168.100.1, timeout is 2 seconds:
Packet has IP options: Total option bytes= 39, padded length=40
Record route: <*> 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0
0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0
Reply to request 0 (44 ms) Received packet has options
Total option bytes= 40, padded length=40
Record route: 172.16.1.2 192.168.1.6 192.168.100.1 192.168.1.1
172.16.32.1 <*> 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0
End of list
Reply to request 1 (45 ms) Received packet has options
Total option bytes= 40, padded length=40
Record route: 172.16.1.2 192.168.1.6 192.168.100.1 192.168.1.1
172.16.32.1 <*> 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0
End of list
Reply to request 2 (44 ms) Received packet has options
Total option bytes= 40, padded length=40
Record route: 172.16.1.2 192.168.1.6 192.168.100.1 192.168.1.1
172.16.32.1 <*> 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0
End of list
Trang 10Reply to request 3 (44 ms) Received packet has options
Total option bytes= 40, padded length=40
Record route: 172.16.1.2 192.168.1.6 192.168.100.1 192.168.1.1
172.16.32.1 <*> 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0
End of list
Reply to request 4 (44 ms) Received packet has options
Total option bytes= 40, padded length=40
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]: record
Number of hops [ 9 ]:
Loose, Strict, Record, Timestamp, Verbose[RV]:
Sweep range of sizes [n]:
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 192.168.100.1, timeout is 2 seconds:Packet has IP options: Total option bytes= 39, padded length=40
Record route: <*>
Reply to request 0 (44 ms) Received packet has options
Total option bytes= 40, padded length=40
Trang 12Reply to request 4 (44 ms) Received packet has options
Total option bytes= 40, padded length=40
SaiGon1(config-router)#neighbor 192.168.1.5 route-map PRIMARY_MED_OUT out
SaiGon2(config)#route-map SECONDARY_MED_OUT permit 10
BGP table version is 9, local router ID is 172.16.64.1
Trang 13Status codes: s suppressed, d damped, h history, * valid, > best, i - internalOrigin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]: record
Number of hops [ 9 ]:
Loose, Strict, Record, Timestamp, Verbose[RV]:
Sweep range of sizes [n]:
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 192.168.100.1, timeout is 2 seconds:Packet has IP options: Total option bytes= 39, padded length=40
Record route: <*> 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0
0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0
Reply to request 0 (60 ms) Received packet has options
Total option bytes= 40, padded length=40
Record route: 172.16.1.2 192.168.1.6 192.168.100.1 192.168.1.5
172.16.1.1 172.16.32.1 <*> 0.0.0.0 0.0.0.0 0.0.0.0
End of list
Reply to request 1 (60 ms) Received packet has options
Total option bytes= 40, padded length=40
Record route: 172.16.1.2 192.168.1.6 192.168.100.1 192.168.1.5
172.16.1.1 172.16.32.1 <*> 0.0.0.0 0.0.0.0 0.0.0.0
End of list
Trang 14Reply to request 2 (96 ms) Received packet has options
Total option bytes= 40, padded length=40
Record route: 172.16.1.2 192.168.1.6 192.168.100.1 192.168.1.5
172.16.1.1 172.16.32.1 <*> 0.0.0.0 0.0.0.0 0.0.0.0
End of list
Reply to request 3 (56 ms) Received packet has options
Total option bytes= 40, padded length=40
Record route: 172.16.1.2 192.168.1.6 192.168.100.1 192.168.1.5
172.16.1.1 172.16.32.1 <*> 0.0.0.0 0.0.0.0 0.0.0.0
End of list
Reply to request 4 (60 ms) Received packet has options
Total option bytes= 40, padded length=40
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]: record
Number of hops [ 9 ]:
Loose, Strict, Record, Timestamp, Verbose[RV]:
Sweep range of sizes [n]:
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 192.168.100.1, timeout is 2 seconds:Packet has IP options: Total option bytes= 39, padded length=40
Record route: <*>
Trang 16Reply to request 3 (32 ms) Received packet has options
Total option bytes= 40, padded length=40
Reply to request 4 (32 ms) Received packet has options
Total option bytes= 40, padded length=40
SaiGon1#show ip route
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 4 subnets, 3 masks
D 172.16.32.0/24 [90/2297856] via 172.16.1.2, 02 40, Serial0/1
S 172.16.0.0/16 is directly connected, Null0
C 172.16.1.0/30 is directly connected, Serial0/1
C 172.16.64.0/24 is directly connected, Loopback0
192.168.1.0/30 is subnetted, 2 subnets
Trang 17S 172.16.0.0/16 is directly connected, Null0
C 172.16.1.0/30 is directly connected, Serial0/1
C 172.16.64.0/24 is directly connected, Loopback0
Trang 18neighbor 192.168.1.5 route-map PRIMARY_IN in
neighbor 192.168.1.5 route-map PRIMARY_MED_OUT out
Trang 19neighbor 192.168.1.1 route-map SECONDARY_IN in
neighbor 192.168.1.1 route-map SECONDARY_MED_OUT out
Trang 21transport input noneline aux 0