- 论坛徽章:
- 0
|
Configure Basic Multi Area OSPF And Area Summary
实验目的:
掌握OSPF接口认证及区域认证的配置方法
实验TOP:
![]()
实验步骤:
1、配置各台路由器的IP地址,并且使用ping命令确认各路由器的直连的互通性
R1#sh run
Building configuration...
Current configuration : 1191 bytes
!
version 12.2
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname R1
!
!
ip subnet-zero
ip cef
!
!
no ip domain-lookup
!
call rsvp-sync
!
!
!
!
!
!
!
!
interface Loopback0
ip address 10.1.1.1 255.255.255.0
!
interface Loopback1
ip address 10.1.2.1 255.255.255.0
!
interface FastEthernet0/0
no ip address
shutdown
duplex half
!
interface Serial1/0
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/1
ip address 192.168.1.1 255.255.255.252
serial restart-delay 0
!
interface Serial1/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/3
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/0
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/3
no ip address
shutdown
serial restart-delay 0
!
interface ATM3/0
no ip address
shutdown
no atm ilmi-keepalive
!
ip classless
no ip http server
!
!
dial-peer cor custom
!
!
!
!
gatekeeper
shutdown
!
!
line con 0
line aux 0
line vty 0 4
exec-timeout 0 0
login
!
end
...................................................................................
...................................................................................
R2#sh run
Building configuration...
Current configuration : 1025 bytes
!
version 12.2
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname R2
!
!
ip subnet-zero
ip cef
!
!
no ip domain-lookup
!
call rsvp-sync
!
!
!
!
!
!
!
!
interface FastEthernet0/0
no ip address
shutdown
duplex half
!
interface Serial1/0
ip address 192.168.1.2 255.255.255.252
interface Serial1/1
ip address 192.168.1.5 255.255.255.252
serial restart-delay 0
!
interface Serial1/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/3
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/0
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/3
no ip address
shutdown
serial restart-delay 0
!
ip classless
no ip http server
!
!
dial-peer cor custom
!
!
!
!
gatekeeper
shutdown
!
!
line con 0
line aux 0
line vty 0 4
exec-timeout 0 0
login
!
end
...................................................................................
...................................................................................
R3#sh run
Building configuration...
Current configuration : 1025 bytes
!
version 12.2
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname R3
!
!
ip subnet-zero
ip cef
!
!
no ip domain-lookup
!
call rsvp-sync
!
!
!
!
!
!
!
!
interface FastEthernet0/0
no ip address
shutdown
duplex half
!
interface Serial1/0
ip address 192.168.1.6 255.255.255.252
serial restart-delay 0
!
interface Serial1/1
ip address 192.168.1.9 255.255.255.252
serial restart-delay 0
!
interface Serial1/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/3
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/0
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/3
no ip address
shutdown
serial restart-delay 0
!
ip classless
no ip http server
!
!
dial-peer cor custom
!
!
!
!
gatekeeper
shutdown
!
!
line con 0
line aux 0
line vty 0 4
exec-timeout 0 0
login
!
end
...................................................................................
...................................................................................
R4#
00:07:34: %SYS-5-CONFIG_I: Configured from console by console
R4#sh run
Building configuration...
Current configuration : 1119 bytes
!
version 12.2
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname R4
!
!
ip subnet-zero
ip cef
!
!
no ip domain-lookup
!
call rsvp-sync
!
!
!
!
!
!
!
!
interface Loopback0
ip address 172.16.1.1 255.255.255.0
!
interface Loopback1
ip address 172.16.2.1 255.255.255.0
!
interface FastEthernet0/0
no ip address
shutdown
duplex half
!
interface Serial1/0
ip address 192.168.1.10 255.255.255.252
serial restart-delay 0
!
interface Serial1/1
no ip address
serial restart-delay 0
!
interface Serial1/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/3
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/0
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/3
no ip address
shutdown
serial restart-delay 0
!
ip classless
no ip http server
!
!
dial-peer cor custom
!
!
!
!
gatekeeper
shutdown
!
!
line con 0
line aux 0
line vty 0 4
exec-timeout 0 0
login
!
end
2、配置OSPF及区域设置
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#
R1(config)#router ospf 1
R1(config-router)#
R1(config-router)#network 10.1.1.0 0.0.0.255 area 1
R1(config-router)#net 10.1.2.0 0.0.0.255 area 1
R1(config-router)#network 192.168.1.0 0.0.0.3 area 1
R1(config-router)#ex
R1(config)#
R1(config)#^Z
R1#
.............................................................................................
R2#conf t
R2(config)#
R2(config)#router ospf 1
R2(config-router)#net 192.168.1.0 0.0.0.3 area 1
R2(config-router)#network 192.168.1.4 0.0.0.3 area 0
R2(config-router)#ex
R2(config)#
R2(config)#^Z
R2#
.............................................................................................
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#
R3(config)#router ospf 1
R3(config-router)#net 192.168.1.4 0.0.0.3 area 0
R3(config-router)#network 192.168.1.8 0.0.0.3 area 2
R3(config-router)#^Z
R3#
........................................................................................
R4#conf t
R4(config)#
R4(config)#router ospf 1
R4(config-router)#net 172.16.1.0 0.0.0.255 area 2
R4(config-router)#net 172.16.2.0 0.0.0.255 area 2
R4(config-router)#net 192.168.1.8 0.0.0.3 area 2
R4(config-router)#
R4(config-router)#^Z
R4#
...................................................................................
...................................................................................
4、在各路由器上查看OSPF的邻居表
R1#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.1.5 1 FULL/ - 00:00:30 192.168.1.2 Serial1/1
............................................................................................
R2#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
10.1.2.1 1 FULL/ - 00:00:31 192.168.1.1 Serial1/0
192.168.1.9 1 FULL/ - 00:00:38 192.168.1.6 Serial1/1
............................................................................................
R3#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.1.5 1 FULL/ - 00:00:36 192.168.1.5 Serial1/0
172.16.2.1 1 FULL/ - 00:00:31 192.168.1.10 Serial1/1
..........................................................................................
R4#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.1.9 1 FULL/ - 00:00:34 192.168.1.9 Serial1/0
...................................................................................
...................................................................................
5、查看R1、R4路由表,观察其他区域的路由
R1#sh 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
10.0.0.0/24 is subnetted, 2 subnets
C 10.1.2.0 is directly connected, Loopback1
C 10.1.1.0 is directly connected, Loopback0
192.168.1.0/30 is subnetted, 3 subnets
O IA 192.168.1.8 [110/192] via 192.168.1.2, 00:06:03, Serial1/1
C 192.168.1.0 is directly connected, Serial1/1
O IA 192.168.1.4 [110/128] via 192.168.1.2, 00:12:14, Serial1/1
172.16.0.0/32 is subnetted, 2 subnets
O IA 172.16.1.1 [110/193] via 192.168.1.2, 00:05:53, Serial1/1
O IA 172.16.2.1 [110/193] via 192.168.1.2, 00:05:53, Serial1/1
...................................................................................
R4#sh 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
10.0.0.0/32 is subnetted, 2 subnets
O IA 10.1.2.1 [110/193] via 192.168.1.9, 00:07:44, Serial1/0
O IA 10.1.1.1 [110/193] via 192.168.1.9, 00:07:44, Serial1/0
192.168.1.0/30 is subnetted, 3 subnets
C 192.168.1.8 is directly connected, Serial1/0
O IA 192.168.1.0 [110/192] via 192.168.1.9, 00:07:44, Serial1/0
O IA 192.168.1.4 [110/128] via 192.168.1.9, 00:07:44, Serial1/0
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.1.0 is directly connected, Loopback0
C 172.16.2.0 is directly connected, Loopback1
注:可以发现R1和R4可以互相学习到各自区域的具体路由,其实,可以通过在R2(ABR)、R3(ABR)上可以对area1 和 area2分别进行汇总,通过汇总可以有效的减少路由表的大小,现在LSA的扩散。
...................................................................................
...................................................................................
6、使用ping命令检验路由的有效性
R1#ping 172.16.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 216/250/292 ms
R1#
...................................................................................
R4#ping 10.1.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 216/263/312 ms
7、查看R1、R2的OSPF链路状态数据库
R1#sh ip ospf datav
R1#sh ip ospf datab
R1#sh ip ospf database
OSPF Router with ID (10.1.2.1) (Process ID 1)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
10.1.2.1 10.1.2.1 961 0x80000004 0xDF8 4
192.168.1.5 192.168.1.5 949 0x80000003 0x2BB5 2
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
172.16.1.1 192.168.1.5 566 0x80000001 0xCCC0
172.16.2.1 192.168.1.5 566 0x80000001 0xC1CA
192.168.1.4 192.168.1.5 949 0x80000001 0xE33E
192.168.1.8 192.168.1.5 576 0x80000001 0x3E9F
...................................................................................
R4#sh ip ospf datab
R4#sh ip ospf database
OSPF Router with ID (172.16.2.1) (Process ID 1)
Router Link States (Area 2)
Link ID ADV Router Age Seq# Checksum Link count
172.16.2.1 172.16.2.1 669 0x80000004 0xB871 4
192.168.1.9 192.168.1.9 668 0x80000004 0xE630 2
Summary Net Link States (Area 2)
Link ID ADV Router Age Seq# Checksum
10.1.1.1 192.168.1.9 854 0x80000001 0xAB8F
10.1.2.1 192.168.1.9 854 0x80000001 0xA099
192.168.1.0 192.168.1.9 854 0x80000001 0x766B
192.168.1.4 192.168.1.9 854 0x80000001 0xCB52
...................................................................................
...................................................................................
8、R2(ABR)、R3(ABR)上对area1 和 area2分别进行汇总
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#
R2(config)#router ospf 1
R2(config-router)#area 1 range 10.1.0.0 255.255.0.0
R2(config-router)#ex
R2(config)#
...................................................................................
R3(config)#
R3(config)#router ospf 1
R3(config-router)#area 2 range 172.16.0.0 255.255.0.0
R3(config-router)#ex
R3(config)#
...................................................................................
9、再次查看R1、R4路由表,可以发现路由表减少了
R1#sh 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
10.0.0.0/24 is subnetted, 2 subnets
C 10.1.2.0 is directly connected, Loopback1
C 10.1.1.0 is directly connected, Loopback0
192.168.1.0/30 is subnetted, 3 subnets
O IA 192.168.1.8 [110/192] via 192.168.1.2, 00:22:06, Serial1/1
C 192.168.1.0 is directly connected, Serial1/1
O IA 192.168.1.4 [110/128] via 192.168.1.2, 00:28:17, Serial1/1
O IA 172.16.0.0/16 [110/193] via 192.168.1.2, 00:00:07, Serial1/1
...................................................................................
R4#sh 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
10.0.0.0/16 is subnetted, 1 subnets
O IA 10.1.0.0 [110/193] via 192.168.1.9, 00:00:09, Serial1/0
192.168.1.0/30 is subnetted, 3 subnets
C 192.168.1.8 is directly connected, Serial1/0
O IA 192.168.1.0 [110/192] via 192.168.1.9, 00:21:13, Serial1/0
O IA 192.168.1.4 [110/128] via 192.168.1.9, 00:21:13, Serial1/0
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.1.0 is directly connected, Loopback0
C 172.16.2.0 is directly connected, Loopback1
10、 实验完成
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/68333/showart_726431.html |
|