120 nên R1 sẻ chọn route của RIP để làm route tối ưu đến đích... Để giải quyết vấn đề này thì ta sử dụng từ khoá backdoor sau lệnh network thì lúc này network này chỉ có ý nghĩa nội bộ
Trang 1B 192.168.100.0/24 [20/0] via 10.10.10.3, 00:06:45 R2#show 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, L1 - IS level-1, L2 - 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.75.0/24 is directly connected, Loopback1
B 172.17.0.0/16 [20/0] via 10.10.10.1, 00:00:10
B 172.16.0.0/16 [20/0] via 10.10.10.4, 00:00:10
C 172.18.0.0/16 is directly connected, Loopback0
B 172.29.0.0/16 [20/0] via 10.10.10.4, 00:00:10
B 172.31.0.0/16 [20/0] via 10.10.10.3, 00:00:10
C 192.168.11.0/24 is directly connected, Serial0/0 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.10.10.0/29 is directly connected, Ethernet0/0
B 10.0.0.0/8 [20/0] via 10.10.10.1, 00:00:11
B 192.168.50.0/24 [20/0] via 10.10.10.1, 00:00:11
B 192.168.1.0/24 [20/0] via 10.10.10.4, 00:00:11
B 192.168.2.0/24 [20/0] via 10.10.10.4, 00:00:11
Ta thấy R1 học mạng 172.18.0.0/16 qua BGP theo đường NAP, chứ không đi theo đường backdoor,
nguyên nhân là vì prefix 172.18.0.0/16 được R2 quảng cáo qua R1 bằng EBGP có AD là 20 nhở hơn so với RIP là 120, do đó nó sẻ chọn route theo BGP với tag là
B Tương tự như R1 thì R2 cũng có route tới mạng
172.17.0.0/16 thông qua BGP qua NAP chứ không đi theo đường backdoor theo RIP
Để giải quyết vấn đề này ta có một cách sau
Đối với R1 ta sẻ sử dụng lệnh network trong BGP để quảng cáo mạng 172.18.0.0 thuộc AS75, do đó
172.18.0.0 trong BGP bây giờ là IBGP chứ không còn
là EBGP nữa nên có AD là 200 lớn hơn AD của RIP là
Trang 2120 nên R1 sẻ chọn route của RIP để làm route tối ưu đến đích
R2(config)#router bgp 75
R2(config-router)#network 172.17.0.0
R1(config)#router bgp 50
R1(config-router)#net 172.18.0.0
Ta có kết quả sau Trên R1 và R2
R1#show ip route
Codes: C - connected, S - static, I - IGRP, 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,
E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
U - per-user static route, o - ODR
Gateway of last resort is not set
R 192.168.75.0/24 [120/1] via 192.168.11.2,
00:00:20, Serial0/0
C 172.17.0.0/16 is directly connected, Loopback1
B 172.16.0.0/16 [20/0] via 10.10.10.3, 00:00:32
R 172.18.0.0/16 [120/1] via 192.168.11.2, 00:00:20, Serial0/0
B 172.29.0.0/16 [20/0] via 10.10.10.3, 00:00:32
B 172.31.0.0/16 [20/0] via 10.10.10.3, 00:00:32
C 192.168.11.0/24 is directly connected, Serial0/0 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.10.10.0/29 is directly connected, Ethernet0/0
C 10.20.0.0/16 is directly connected, Loopback0
C 192.168.50.0/24 is directly connected, Loopback3
B 192.168.1.0/24 [20/0] via 10.10.10.3, 00:00:32
B 192.168.2.0/24 [20/0] via 10.10.10.3, 00:00:32
B 192.168.100.0/24 [20/0] via 10.10.10.3, 00:00:32 R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B
- BGP
Trang 3D - 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, L1 - IS level-1, L2 - 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.75.0/24 is directly connected, Loopback1
R 172.17.0.0/16 [120/1] via 192.168.11.1, 00:00:24, Serial0/0
B 172.16.0.0/16 [20/0] via 10.10.10.3, 00:00:26
C 172.18.0.0/16 is directly connected, Loopback0
B 172.29.0.0/16 [20/0] via 10.10.10.3, 00:00:26
B 172.31.0.0/16 [20/0] via 10.10.10.3, 00:00:26
C 192.168.11.0/24 is directly connected, Serial0/0 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.10.10.0/29 is directly connected, Ethernet0/0
B 10.0.0.0/8 [20/0] via 10.10.10.1, 00:00:27
R 192.168.50.0/24 [120/1] via 192.168.11.1,
00:00:25, Serial0/0
B 192.168.1.0/24 [20/0] via 10.10.10.3, 00:00:27
B 192.168.2.0/24 [20/0] via 10.10.10.3, 00:00:27 Tuy nhiên khi ta sử dụng lệnh network trong BGP thì BGP sẻ xem nó như là nguồn khởi táo route, do đó nó
sẻ quảng cáo mạng cho các láng giềng khác với route
có origin là IGP, còn đối với route nhận được từ
redistribute từ AS khác có origin là incomplete, do đó route được quảng cáo bởi lệnh network sẻ tối ưư hơn so với route nguồn, Lúc này thì toàn bộ tải để đến mạng nói trên sẻ đi toàn bộ sang liên kết backdoor
Để giải quyết vấn đề này thì ta sử dụng từ khoá
backdoor sau lệnh network thì lúc này network này
chỉ có ý nghĩa nội bộ cho router mà nó sẻ không quảng cáo cho các láng giềng khác
R2(config)#router bgp 75
R2(config-router)#net 172.17.0.0 backdoor
R1(config)#router bgp 50
Trang 4R1(config-router)# net 172.18.0.0 backdoor
Tiếp theo thì ta sẻ cấu hình MED trên R5, R6 để cho phếp AS 100 chọn route vào trong AS 30
Ta sẻ cấu hình để các traffic từ AS 100 vào AS 30 , đến net 172.31.0.0 sẻ đi theo đường R5, và 172.16.0.0 sẻ đi theo đường R6
Ta cấu hình trên R5 và R6 như sau
R5#show runn
Building configuration
Current configuration:
version 12.1
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
hostname R5
ip subnet-zero
no ip domain-lookup
interface Loopback0
ip address 192.168.2.1 255.255.255.0
interface Loopback1
ip address 192.168.100.1 255.255.255.0
interface Loopback2
ip address 172.29.1.1 255.255.255.0
interface Ethernet0
ip address 192.168.1.17 255.255.255.252
interface Serial0
no ip address
no fair-queue
clockrate 64000
interface Serial1
ip address 192.168.1.14 255.255.255.252
clockrate 64000
router ospf 1
log-adjacency-changes
network 172.29.1.0 0.0.0.255 area 0
network 192.168.1.16 0.0.0.3 area 0
network 192.168.2.0 0.0.0.255 area 0
network 192.168.100.0 0.0.0.255 area 0
router bgp 30
no synchronization
Trang 5redistribute ospf 1
neighbor 192.168.1.13 remote-as 100
neighbor 192.168.1.13 route-map PREF in neighbor 192.168.1.13 route-map MED out neighbor 192.168.1.13 filter-list 1 out neighbor 192.168.1.18 remote-as 30
neighbor 192.168.1.18 next-hop-self
ip classless
no ip http server
ip as-path access-list 1 permit ^$
ip as-path access-list 2 permit _50$
access-list 1 permit 172.31.0.0
access-list 2 permit any
route-map PREF permit 10
match as-path 2
set local-preference 200
route-map PREF permit 20
route-map MED permit 10
match ip address 1
set metric 100
route-map MED permit 20
match ip address 2
set metric 200
line con 0
logging synchronous
transport input none