Lab GNS3 Redistribute OSPF và EIGRP

bởi | CCNP, GNS3

Home » CCNP » Lab GNS3 Redistribute OSPF và EIGRP

Sơ đồ bài lab

Lab GNS3 Redistribute OSPF và EIGRP

Cấu hình gán IP theo sơ đồ

– Cấu hình gán địa chỉ IP theo sơ đồ mạng tại Router 1
//R1
conf t
int s 2/0
ip add 192.1.12.1 255.255.255.252
no sh
int lo 0
ip add 1.1.1.1 255.255.255.0
ip ospf network point-to-point
int lo 1
ip add 10.0.0.1 255.255.255.0
ip ospf network point-to-point
int lo 2
ip add 10.0.1.1 255.255.255.0
ip ospf network point-to-point
int lo 3
ip add 10.0.2.1 255.255.255.0
ip ospf network point-to-point
int lo 4
ip add 10.0.3.1 255.255.255.0
ip ospf network point-to-point
end

– Cấu hình gán địa chỉ IP theo sơ đồ mạng tại Router 2
//R2
conf t
int s 2/0
ip add 192.1.12.2 255.255.255.252
no sh
int fa 0/0
ip add 192.1.23.2 255.255.255.252
no sh
int lo 0
ip add 2.2.2.2 255.255.255.0
ip ospf network point-to-point
end

– Cấu hình gán địa chỉ IP theo sơ đồ mạng tại Router 3
//R3
conf t
int fa 0/0
ip add 192.1.23.1 255.255.255.252
no sh
int s 2/0
ip add 192.1.34.1 255.255.255.252
no sh
int lo 0
ip add 3.3.3.3 255.255.255.0
ip ospf network point-to-point
interface fa 0/1
ip add 100.0.0.1 255.255.255.0
no sh
end

– Cấu hình gán địa chỉ IP theo sơ đồ mạng bên trên tại Router 4
//R4
conf t
int s2/0
ip add 192.1.34.2 255.255.255.252
no sh
int fa 0/0
ip add 100.0.0.2 255.255.255.0
no sh
int lo 0
ip add 4.4.4.4 255.255.255.0
ip ospf network point-to-point
int lo 1
ip add 40.0.0.1 255.255.255.0
ip ospf network point-to-point
int lo 2
ip add 40.0.1.1 255.255.255.0
ip ospf network point-to-point
int lo 3
ip add 40.0.2.1 255.255.255.0
ip ospf network point-to-point
int lo 4
ip add 40.0.3.1 255.255.255.0
ip ospf network point-to-point
end

Cấu hình định tuyến EIGRP tại router 3 và router 4

– Định tuyến EIGRP tại router 3
R3(config)#router eigrp 10
=> Kích hoạt định tuyến EIGRP cho R3 tưng ứng với Autonomous System = 10
R3(config-router)# no auto-summary
=> Router gửi thông tin chi tiết đường mạng theo sơ đồ
R3(config-router)# network 192.1.34.0
R3(config-router)# network 100.0.0.0
R3(config-router)# end

– Định tuyến EIGRP tại router 4

R4(config)#router eigrp 10
R4(config-router)#no auto-summary
R4(config-router)#network 192.1.34.0
R4(config-router)#network 100.0.0.0
R4(config-router)#network 40.0.0.0
R4(config-router)#network 4.0.0.0
R4(config-router)#end

– Kiểm tra bảng định tuyến EIGRP tại Router 3

R3#show ip route eigrp
4.0.0.0/24 is subnetted, 1 subnets
D 4.4.4.0 [90/156160] via 100.0.0.2, 00:00:33, FastEthernet0/1
40.0.0.0/24 is subnetted, 4 subnets
D 40.0.0.0 [90/156160] via 100.0.0.2, 00:00:39, FastEthernet0/1
D 40.0.1.0 [90/156160] via 100.0.0.2, 00:00:39, FastEthernet0/1
D 40.0.2.0 [90/156160] via 100.0.0.2, 00:00:39, FastEthernet0/1
D 40.0.3.0 [90/156160] via 100.0.0.2, 00:00:39, FastEthernet0/1

=>D: Route EIGRP đang Internal, Administrative Distance = 90

R3#show ip eigrp neighbors
EIGRP-IPv4 Neighbors for AS(10)
H Address Interface Hold Uptime SRTT RTO Q Seq
(sec) (ms) Cnt Num
1 192.1.34.2 Se2/0 10 00:02:55 31 186 0 9
0 100.0.0.2 Fa0/1 10 00:03:26 26 156 0 8
R3#show ip eigrp topology all-links
EIGRP-IPv4 Topology Table for AS(10)/ID(3.3.3.3)
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
r - reply Status, s - sia Status

P 40.0.2.0/24, 1 successors, FD is 156160, serno 7
via 100.0.0.2 (156160/128256), FastEthernet0/1
via 192.1.34.2 (2297856/128256), Serial2/0
P 100.0.0.0/24, 1 successors, FD is 28160, serno 4
via Connected, FastEthernet0/1
via 192.1.34.2 (2172416/28160), Serial2/0
P 40.0.1.0/24, 1 successors, FD is 156160, serno 6
via 100.0.0.2 (156160/128256), FastEthernet0/1
via 192.1.34.2 (2297856/128256), Serial2/0
P 40.0.0.0/24, 1 successors, FD is 156160, serno 5
via 100.0.0.2 (156160/128256), FastEthernet0/1
via 192.1.34.2 (2297856/128256), Serial2/0
P 192.1.34.0/30, 1 successors, FD is 2169856, serno 3
via Connected, Serial2/0
via 100.0.0.2 (2172416/2169856), FastEthernet0/1
P 40.0.3.0/24, 1 successors, FD is 156160, serno 8
via 100.0.0.2 (156160/128256), FastEthernet0/1
via 192.1.34.2 (2297856/128256), Serial2/0
P 4.4.4.0/24, 1 successors, FD is 156160, serno 9
via 100.0.0.2 (156160/128256), FastEthernet0/1
via 192.1.34.2 (2297856/128256), Serial2/0

=> các số Feasible Distance và Advertised Distance. Lấy Số FD cao nhất chia cho FD best 2297856 / 156160 = 14.7
=> 2297856 < 15 x 409600
=> ta cấu hình với hệ số variance 15

R3(config)#router eigrp 10
R3(config-router)#variance 6
R3(config-router)#exit
R3#show ip route eigrp
4.0.0.0/24 is subnetted, 1 subnets
D 4.4.4.0 [90/2297856] via 192.1.34.2, 00:00:40, Serial2/0
[90/156160] via 100.0.0.2, 00:00:40, FastEthernet0/1
40.0.0.0/24 is subnetted, 4 subnets
D 40.0.0.0 [90/2297856] via 192.1.34.2, 00:00:40, Serial2/0
[90/156160] via 100.0.0.2, 00:00:40, FastEthernet0/1
D 40.0.1.0 [90/2297856] via 192.1.34.2, 00:00:40, Serial2/0
[90/156160] via 100.0.0.2, 00:00:40, FastEthernet0/1
D 40.0.2.0 [90/2297856] via 192.1.34.2, 00:00:40, Serial2/0
[90/156160] via 100.0.0.2, 00:00:40, FastEthernet0/1
D 40.0.3.0 [90/2297856] via 192.1.34.2, 00:00:40, Serial2/0
[90/156160] via 100.0.0.2, 00:00:40, FastEthernet0/1

Cấu hình Summary-Route cho giao thức EIGRP

R3#show ip route eigrp
4.0.0.0/24 is subnetted, 1 subnets
D 4.4.4.0 [90/2297856] via 192.1.34.2, 00:00:40, Serial2/0
[90/156160] via 100.0.0.2, 00:00:40, FastEthernet0/1
40.0.0.0/24 is subnetted, 4 subnets
D 40.0.0.0 [90/2297856] via 192.1.34.2, 00:00:40, Serial2/0
[90/156160] via 100.0.0.2, 00:00:40, FastEthernet0/1
D 40.0.1.0 [90/2297856] via 192.1.34.2, 00:00:40, Serial2/0
[90/156160] via 100.0.0.2, 00:00:40, FastEthernet0/1
D 40.0.2.0 [90/2297856] via 192.1.34.2, 00:00:40, Serial2/0
[90/156160] via 100.0.0.2, 00:00:40, FastEthernet0/1
D 40.0.3.0 [90/2297856] via 192.1.34.2, 00:00:40, Serial2/0
[90/156160] via 100.0.0.2, 00:00:40, FastEthernet0/1

– Nếu như Router có quá nhiều đường route
+ Tiêu hao nhiều Ram để lưu trữ dòng route
+ Quá trình tra cứu bảng định tuyến sẽ lâu hơn
– Ưu điểm của quá trình summary-route
+ Làm giảm kích thước của bảng định tuyến
+ Tăng tốc độ trong quá trình tra cứu bảng định tuyến
– Nhược điểm
+ Yêu cầu các đường mạng trong sơ đồ nó có tính chất Continuous (các đường mạng liên kề nhau )
+ Admin phải tính toán đường summary-route
– Ví dụ 1 : Tính toán đường summary-route cho 4 đường mạng
40.0.0.0/24
40.0.1.0/24
40.0.2.0/24
40.0.3.0/24
=> Giống nhau bao nhiêu bit ở cơ số nhị phân
=> Giống nhau 22 ở hệ cơ số nhị phân
00101000.00000000.000000 00.0000000 –> network 40.0.0.0/24
00101000.00000000.000000 01.0000000 –> network 40.0.1.0/24
00101000.00000000.000000 10.0000000 –> network 40.0.2.0/24
00101000.00000000.000000 11.0000000 –> network 40.0.3.0/24
giống nhau 22 bit khác nhau 2 bit ở các bit thuộc phần Network-ID
=> khác nhau 2 bit thì có 2^2 = 4 truờng hợp xảy ra
Sử dụng bit 1 của số subnetmask che lại các bit giống nhau
00101000.00000000.000000 00.0000000 –> network 40.0.0.0/24
00101000.00000000.000000 01.0000000 –> network 40.0.1.0/24
00101000.00000000.000000 10.0000000 –> network 40.0.2.0/24
00101000.00000000.000000 11.0000000 –> network 40.0.3.0/24
11111111.11111111.111111 00.0000000 –> subnet mask 255.255.252.0
=> Đường mạng nhỏ nhất + subnet mask = summary-route
=> 40.0.0.0 255.255.252.0 ( summary-route )

– Ví dụ 2: Tính toán đường summary-route cho dãy đường mạng
40.0.0.0/24
40.0.1.0/24
40.0.2.0/24
40.0.3.0/24
40.0.4.0/24
40.0.5.0/24
40.0.6.0/24
40.0.7.0/24
40.0.8.0/24
40.0.9.0/24
00000 000 = 0
00000 001 = 1
00000 010 = 2
00000 011 = 3
00000 100 = 4
00000 101 = 5
00000 110 = 6
00000 111 = 7
11111 000 = 248 ( subnet mask )
=> lấy đường mạng nhỏ nhất + subnet_mask
=> 40.0.0.0 255.255.248.0
0000100 0 = 8
0000100 1 = 9
1111111 0 = 254 ( subnet mask )
=> lấy đường mạng nhỏ nhất + subnet mask
=> 40.0.8.0 255.255.254.0

– Cấu hình summary-route tại R4 thì nó sẽ gửi 1 đường network 40.0.0.0/22 đại diện cho 4 đường. EIGRP thì cấu hình summary-route ở trên interface. Việc chọn interface để cấu hình thì sẽ quyết định hướng gửi của traffic

R4(config)#int serial 2/0
R4(config-if)#ip summary-address eigrp 10 40.0.0.0 255.255.252.0

=> R4 gửi đường summary route 40.0.0.0/22 ra ở interface serial 2/0 và gửi đến R3

R4(config)#int fa 0/0
R4(config-if)#ip summary-address eigrp 10 40.0.0.0 255.255.252.0
R3#show ip route eigrp
4.0.0.0/24 is subnetted, 1 subnets
D 4.4.4.0 [90/2297856] via 192.1.34.2, 00:24:07, Serial2/0
[90/156160] via 100.0.0.2, 00:24:07, FastEthernet0/1
40.0.0.0/22 is subnetted, 1 subnets
D 40.0.0.0 [90/2297856] via 192.1.34.2, 00:00:14, Serial2/0
[90/156160] via 100.0.0.2, 00:00:14, FastEthernet0/1

=> 40.0.0.0/22 là đườnng summary-route

R4#show ip route eigrp
40.0.0.0/8 is variably subnetted, 9 subnets, 3 masks
D 40.0.0.0/22 is a summary, 00:02:27, Null0

=> Router 4 gửi summary-route 40.0.0.0/22 –> R3
=> Router 4 thiết lập 40.0.0.0/22 –> đẩy vào interface Null0 ( hủy bỏ packet tránh loop khi nhận lại dải route này từ R3)

Cấu hình Routing OSPF theo các Area trong sơ đồ

– Router 1

R1(config)#router ospf 1
R1(config-router)#network 192.1.12.0 0.0.0.3 area 1
R1(config-router)#network 1.1.1.0 0.0.0.255 area 1
R1(config-router)#network 10.0.0.0 0.0.3.255 area 1
R1(config-router)#end

– Router 2

R2(config)#router ospf 1
R2(config-router)#network 192.1.12.0 0.0.0.3 area 1
R2(config-router)#network 192.1.23.0 0.0.0.3 area 0
R2(config-router)#network 2.2.2.0 0.0.0.255 area 0

– Router 3

R3(config)#router ospf 1
R3(configrouter)#network 192.1.23.0 0.0.0.3 area 0
R3(config-router)#network 3.3.3.0 0.0.0.255 area 0
R3(config-router)#end

Cấu hình summary-route liên vùng của OSPF

Nhận xét: Router 2 là router đứng giữa vùng AREA = 1 va Area = 0 ( Backbone Area ). Router 2 là Area Border Router ( ABR ). Ta có thể cấu hình summary-route để thu gọn bảng định tuyến

R2(config)#router ospf 1
R2(config-router)#area 1 range 10.0.0.0 255.255.252.0

=> Router 2 sẽ gửi đường route 10.0.0.0/22 đại diện cho 4 đường mạng
10.0.X.0/24 vào vùng backbone area
R3#show ip route ospf
=> xuất hiện đường route 10.0.0.0/22

Cấu hình Redistribute giữa OSPF và EIGRP

– Router 3 là router biết ngôn ngữ định tuyến OSPF va EIGRP. Ta sẽ cấu hình redistribute tại Router 3

Thông dịch giao thức EIGRP vào trong OSPF

R3(config)#router ospf 1
R3(config-router)#redistribute eigrp 10 subnets

=> phân bố eigrp có số AS=10 vào trong OSPF
=> subnets: cho ta thấy được chi tiết số subnet mask theo sơ đồ

R3(config-router)#exit
R1#show ip route ospf
2.0.0.0/24 is subnetted, 1 subnets
O IA 2.2.2.0 [110/65] via 192.1.12.2, 00:10:21, Serial2/0
3.0.0.0/24 is subnetted, 1 subnets
O IA 3.3.3.0 [110/66] via 192.1.12.2, 00:09:12, Serial2/0
4.0.0.0/24 is subnetted, 1 subnets
O E2 4.4.4.0 [110/20] via 192.1.12.2, 00:00:02, Serial2/0
40.0.0.0/22 is subnetted, 1 subnets
O E2 40.0.0.0 [110/20] via 192.1.12.2, 00:00:02, Serial2/0
100.0.0.0/24 is subnetted, 1 subnets
O E2 100.0.0.0 [110/20] via 192.1.12.2, 00:00:02, Serial2/0
192.1.23.0/30 is subnetted, 1 subnets
O IA 192.1.23.0 [110/65] via 192.1.12.2, 00:10:21, Serial2/0
192.1.34.0/30 is subnetted, 1 subnets
O E2 192.1.34.0 [110/20] via 192.1.12.2, 00:00:02, Serial2/0

=> Code: O E2 ( OSPF external loại 2 ) là dòng route EIGRP được thông dịch vào
R1#ping 4.4.4.4
…..
=> Router 4 không có route trả về

Phân bố giao thức OSPF vào trong EIGRP

R3(config)#router eigrp 10
R3(config-router)#redistribute ospf 1 metric 10000 100 255 255 1500
R3(config-router)#end
R4#show ip route
1.0.0.0/24 is subnetted, 1 subnets
D EX 1.1.1.0 [170/284160] via 100.0.0.1, 00:00:59, FastEthernet0/0
2.0.0.0/24 is subnetted, 1 subnets
D EX 2.2.2.0 [170/284160] via 100.0.0.1, 00:00:59, FastEthernet0/0
3.0.0.0/24 is subnetted, 1 subnets
D EX 3.3.3.0 [170/284160] via 100.0.0.1, 00:00:59, FastEthernet0/0
10.0.0.0/22 is subnetted, 1 subnets
D EX 10.0.0.0 [170/284160] via 100.0.0.1, 00:00:59, FastEthernet0/0
40.0.0.0/8 is variably subnetted, 9 subnets, 3 masks
D 40.0.0.0/22 is a summary, 00:24:16, Null0
192.1.12.0/30 is subnetted, 1 subnets
D EX 192.1.12.0 [170/284160] via 100.0.0.1, 00:00:59, FastEthernet0/0
192.1.23.0/30 is subnetted, 1 subnets
D EX 192.1.23.0 [170/284160] via 100.0.0.1, 00:00:59, FastEthernet0/0

=> Code D: là route EIGRP dang Internal co Administrative Distance bằng 90
=> Code D EX: là route EIGRP dang External Administrative Distance bằng 170
R4#ping 1.1.1.1 source 4.4.4.4
!!!!

Filtering Redistribute

– Cấu hình cho phép Router 3 redistribute các đường mạng 40.0.X.0/24 và không redistribute đường mạng 4.4.4.0/24

R1#show ip route ospf
2.0.0.0/24 is subnetted, 1 subnets
O IA 2.2.2.0 [110/65] via 192.1.12.2, 00:16:59, Serial2/0
3.0.0.0/24 is subnetted, 1 subnets
O IA 3.3.3.0 [110/66] via 192.1.12.2, 00:15:50, Serial2/0
4.0.0.0/24 is subnetted, 1 subnets
O E2 4.4.4.0 [110/20] via 192.1.12.2, 00:06:40, Serial2/0
40.0.0.0/22 is subnetted, 1 subnets
O E2 40.0.0.0 [110/20] via 192.1.12.2, 00:06:40, Serial2/0
100.0.0.0/24 is subnetted, 1 subnets
O E2 100.0.0.0 [110/20] via 192.1.12.2, 00:06:40, Serial2/0
192.1.23.0/30 is subnetted, 1 subnets
O IA 192.1.23.0 [110/65] via 192.1.12.2, 00:16:59, Serial2/0
192.1.34.0/30 is subnetted, 1 subnets
O E2 192.1.34.0 [110/20] via 192.1.12.2, 00:06:40, Serial2/0
R3(config)# ip prefix-list BLOCK4 seq 5 deny 4.4.4.0/24
R3(config)# ip prefix-list BLOCK4 seq 10 permit 40.0.0.0/22
R3(config)# router ospf 1
R3(config-router)# distribute-list prefix BLOCK4 out eigrp 10
R1#show ip route ospf
2.0.0.0/24 is subnetted, 1 subnets
O IA 2.2.2.0 [110/65] via 192.1.12.2, 00:18:58, Serial2/0
3.0.0.0/24 is subnetted, 1 subnets
O IA 3.3.3.0 [110/66] via 192.1.12.2, 00:17:49, Serial2/0
40.0.0.0/22 is subnetted, 1 subnets
O E2 40.0.0.0 [110/20] via 192.1.12.2, 00:08:39, Serial2/0
192.1.23.0/30 is subnetted, 1 subnets
O IA 192.1.23.0 [110/65] via 192.1.12.2, 00:18:58, Serial2/0

=> chỉ còn 1 route “O E2” la “O E2 40.0.0.0”
=> Đã mất 1 dòng route O E2 4.4.4.0 [110/20] ( ta có định nghĩa )
=> Đã mất 1 dong route O E2 192.1.34.0 [110/20] ( ta không có định nghĩa )

– Cấu hình Router 3 không cho phép đường mạng 1.1.1.0/24, 2.2.2.0/24,
3.3.3.0/24 các đường mạng khác thì được phép Redistribute vào trong EIGRP

R3(config)#ip prefix-list BLOCKOSPF deny 1.1.1.0/24
R3(config)#ip prefix-list BLOCKOSPF deny 2.2.2.0/24
R3(config)#ip prefix-list BLOCKOSPF deny 3.3.3.0/24
R3(config)#ip prefix-list BLOCKOSPF permit 0.0.0.0/0 le 32
R3(config-router)#router eigrp 10
R3(config-router)#distribute-list prefix BLOCKOSPF out ospf 1
R4#show ip route eigrp
10.0.0.0/22 is subnetted, 1 subnets
D EX 10.0.0.0 [170/284160] via 100.0.0.1, 00:08:18, FastEthernet0/0
40.0.0.0/8 is variably subnetted, 9 subnets, 3 masks
D 40.0.0.0/22 is a summary, 00:31:35, Null0
192.1.12.0/30 is subnetted, 1 subnets
D EX 192.1.12.0 [170/284160] via 100.0.0.1, 00:08:18, FastEthernet0/0
192.1.23.0/30 is subnetted, 1 subnets
D EX 192.1.23.0 [170/284160] via 100.0.0.1, 00:08:18, FastEthernet0/0