实验拓扑图如下:
拓扑连接详情:
Router1 F0/0 <----> Router2 F0/0
Router2 F1/0 <----> Router3 F0/0
Router3 F1/0 <----> Router4 F0/0
Router1 F1/0 <----> Router5 F0/0
Router5 F1/0 <----> Router6 F0/0
Router6 F1/0 <----> Router7 F0/0
根据拓扑图,设置接口IP。
Router1 F0/0 <----> Router2 F0/0
Router2 F1/0 <----> Router3 F0/0
Router3 F1/0 <----> Router4 F0/0
Router1 F1/0 <----> Router5 F0/0
Router5 F1/0 <----> Router6 F0/0
Router6 F1/0 <----> Router7 F0/0
根据拓扑图,设置接口IP。
拓扑图中有两个变量——X Y
一、当X=0,Y=1时,Area X为中转区域,Area Y为常规区域。
1.路由器设置
R1:
!
interface FastEthernet0/0
ip address 192.168.10.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
network 192.168.1.0 0.0.0.255 area 0
network 192.168.10.0 0.0.0.255 area 0
!
一、当X=0,Y=1时,Area X为中转区域,Area Y为常规区域。
1.路由器设置
R1:
!
interface FastEthernet0/0
ip address 192.168.10.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
network 192.168.1.0 0.0.0.255 area 0
network 192.168.10.0 0.0.0.255 area 0
!
R2:
!
interface FastEthernet0/0
ip address 192.168.10.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 192.168.17.1 255.255.255.0
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
network 192.168.10.0 0.0.0.255 area 0
network 192.168.17.0 0.0.0.255 area 1
!
!
interface FastEthernet0/0
ip address 192.168.10.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 192.168.17.1 255.255.255.0
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
network 192.168.10.0 0.0.0.255 area 0
network 192.168.17.0 0.0.0.255 area 1
!
R3:
!
interface FastEthernet0/0
ip address 192.168.17.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 192.168.30.1 255.255.255.0
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
network 192.168.17.0 0.0.0.255 area 1
network 192.168.30.0 0.0.0.255 area 1
!
!
interface FastEthernet0/0
ip address 192.168.17.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 192.168.30.1 255.255.255.0
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
network 192.168.17.0 0.0.0.255 area 1
network 192.168.30.0 0.0.0.255 area 1
!
R4:
!
interface FastEthernet0/0
ip address 192.168.30.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
no ip address
shutdown
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
network 192.168.30.0 0.0.0.255 area 1
!
!
interface FastEthernet0/0
ip address 192.168.30.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
no ip address
shutdown
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
network 192.168.30.0 0.0.0.255 area 1
!
R5:
!
interface FastEthernet0/0
ip address 192.168.1.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 192.168.66.1 255.255.255.0
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
redistribute rip metric 20
network 192.168.1.0 0.0.0.255 area 0
!
router rip
version 2
redistribute ospf 1 metric 3
network 192.168.66.0
no auto-summary
!
!
interface FastEthernet0/0
ip address 192.168.1.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 192.168.66.1 255.255.255.0
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
redistribute rip metric 20
network 192.168.1.0 0.0.0.255 area 0
!
router rip
version 2
redistribute ospf 1 metric 3
network 192.168.66.0
no auto-summary
!
R6:
!
interface FastEthernet0/0
ip address 192.168.66.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 192.168.70.1 255.255.255.0
duplex auto
speed auto
!
router rip
version 2
network 192.168.66.0
network 192.168.70.0
no auto-summary
!
!
interface FastEthernet0/0
ip address 192.168.66.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 192.168.70.1 255.255.255.0
duplex auto
speed auto
!
router rip
version 2
network 192.168.66.0
network 192.168.70.0
no auto-summary
!
R7:
!
interface FastEthernet0/0
ip address 192.168.70.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
no ip address
shutdown
duplex auto
speed auto
!
router rip
version 2
network 192.168.70.0
no auto-summary
!
1.1查看路由表信息
R4#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
!
interface FastEthernet0/0
ip address 192.168.70.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
no ip address
shutdown
duplex auto
speed auto
!
router rip
version 2
network 192.168.70.0
no auto-summary
!
1.1查看路由表信息
R4#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.30.0/24 is directly connected, FastEthernet0/0
O IA 192.168.10.0/24 [110/3] via 192.168.30.1, 00:10:56, FastEthernet0/0
O E2 192.168.66.0/24 [110/20] via 192.168.30.1, 00:08:13, FastEthernet0/0
O 192.168.17.0/24 [110/2] via 192.168.30.1, 00:10:56, FastEthernet0/0
O IA 192.168.1.0/24 [110/4] via 192.168.30.1, 00:10:56, FastEthernet0/0
O E2 192.168.70.0/24 [110/20] via 192.168.30.1, 00:08:13, FastEthernet0/0
O IA 192.168.10.0/24 [110/3] via 192.168.30.1, 00:10:56, FastEthernet0/0
O E2 192.168.66.0/24 [110/20] via 192.168.30.1, 00:08:13, FastEthernet0/0
O 192.168.17.0/24 [110/2] via 192.168.30.1, 00:10:56, FastEthernet0/0
O IA 192.168.1.0/24 [110/4] via 192.168.30.1, 00:10:56, FastEthernet0/0
O E2 192.168.70.0/24 [110/20] via 192.168.30.1, 00:08:13, FastEthernet0/0
R7#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
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
R 192.168.30.0/24 [120/4] via 192.168.70.1, 00:00:07, FastEthernet0/0
R 192.168.10.0/24 [120/4] via 192.168.70.1, 00:00:07, FastEthernet0/0
R 192.168.66.0/24 [120/1] via 192.168.70.1, 00:00:07, FastEthernet0/0
R 192.168.17.0/24 [120/4] via 192.168.70.1, 00:00:07, FastEthernet0/0
R 192.168.1.0/24 [120/4] via 192.168.70.1, 00:00:07, FastEthernet0/0
C 192.168.70.0/24 is directly connected, FastEthernet0/0
1.2查看OSPF LSDB
R1# sh ip ospf database
R 192.168.10.0/24 [120/4] via 192.168.70.1, 00:00:07, FastEthernet0/0
R 192.168.66.0/24 [120/1] via 192.168.70.1, 00:00:07, FastEthernet0/0
R 192.168.17.0/24 [120/4] via 192.168.70.1, 00:00:07, FastEthernet0/0
R 192.168.1.0/24 [120/4] via 192.168.70.1, 00:00:07, FastEthernet0/0
C 192.168.70.0/24 is directly connected, FastEthernet0/0
1.2查看OSPF LSDB
R1# sh ip ospf database
OSPF Router with ID (192.168.10.1) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
192.168.10.1 192.168.10.1 736 0x80000004 0x008AEB 2
192.168.17.1 192.168.17.1 789 0x80000003 0x00B19C 1
192.168.66.1 192.168.66.1 573 0x80000003 0x006E8F 1
192.168.10.1 192.168.10.1 736 0x80000004 0x008AEB 2
192.168.17.1 192.168.17.1 789 0x80000003 0x00B19C 1
192.168.66.1 192.168.66.1 573 0x80000003 0x006E8F 1
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.168.1.1 192.168.10.1 735 0x80000001 0x000B2E
192.168.10.2 192.168.17.1 789 0x80000001 0x00D088
192.168.1.1 192.168.10.1 735 0x80000001 0x000B2E
192.168.10.2 192.168.17.1 789 0x80000001 0x00D088
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.168.17.0 192.168.17.1 816 0x80000001 0x009CA9
192.168.30.0 192.168.17.1 753 0x80000001 0x001721
192.168.17.0 192.168.17.1 816 0x80000001 0x009CA9
192.168.30.0 192.168.17.1 753 0x80000001 0x001721
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
192.168.66.0 192.168.66.1 573 0x80000001 0x007BCC 0
192.168.70.0 192.168.66.1 574 0x80000001 0x004FF4 0
Link ID ADV Router Age Seq# Checksum Tag
192.168.66.0 192.168.66.1 573 0x80000001 0x007BCC 0
192.168.70.0 192.168.66.1 574 0x80000001 0x004FF4 0
R2#sh ip ospf database
OSPF Router with ID (192.168.17.1) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
192.168.10.1 192.168.10.1 762 0x80000004 0x008AEB 2
192.168.17.1 192.168.17.1 813 0x80000003 0x00B19C 1
192.168.66.1 192.168.66.1 599 0x80000003 0x006E8F 1
192.168.10.1 192.168.10.1 762 0x80000004 0x008AEB 2
192.168.17.1 192.168.17.1 813 0x80000003 0x00B19C 1
192.168.66.1 192.168.66.1 599 0x80000003 0x006E8F 1
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.168.1.1 192.168.10.1 761 0x80000001 0x000B2E
192.168.10.2 192.168.17.1 813 0x80000001 0x00D088
192.168.1.1 192.168.10.1 761 0x80000001 0x000B2E
192.168.10.2 192.168.17.1 813 0x80000001 0x00D088
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.168.17.0 192.168.17.1 840 0x80000001 0x009CA9
192.168.30.0 192.168.17.1 778 0x80000001 0x001721
192.168.17.0 192.168.17.1 840 0x80000001 0x009CA9
192.168.30.0 192.168.17.1 778 0x80000001 0x001721
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
192.168.17.1 192.168.17.1 782 0x80000002 0x004002 1
192.168.30.1 192.168.30.1 757 0x80000004 0x00ED16 2
192.168.30.2 192.168.30.2 757 0x80000002 0x006F9C 1
Link ID ADV Router Age Seq# Checksum Link count
192.168.17.1 192.168.17.1 782 0x80000002 0x004002 1
192.168.30.1 192.168.30.1 757 0x80000004 0x00ED16 2
192.168.30.2 192.168.30.2 757 0x80000002 0x006F9C 1
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.17.2 192.168.30.1 784 0x80000001 0x00F838
192.168.30.2 192.168.30.2 758 0x80000001 0x0017FD
192.168.17.2 192.168.30.1 784 0x80000001 0x00F838
192.168.30.2 192.168.30.2 758 0x80000001 0x0017FD
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.1.0 192.168.17.1 809 0x80000001 0x0057FD
192.168.10.0 192.168.17.1 846 0x80000001 0x00E963
192.168.1.0 192.168.17.1 809 0x80000001 0x0057FD
192.168.10.0 192.168.17.1 846 0x80000001 0x00E963
Summary ASB Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.66.1 192.168.17.1 593 0x80000001 0x0071A0
192.168.66.1 192.168.17.1 593 0x80000001 0x0071A0
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
192.168.66.0 192.168.66.1 600 0x80000001 0x007BCC 0
192.168.70.0 192.168.66.1 601 0x80000001 0x004FF4 0
192.168.66.0 192.168.66.1 600 0x80000001 0x007BCC 0
192.168.70.0 192.168.66.1 601 0x80000001 0x004FF4 0
R5#sh ip ospf database
OSPF Router with ID (192.168.66.1) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
192.168.10.1 192.168.10.1 802 0x80000004 0x008AEB 2
192.168.17.1 192.168.17.1 855 0x80000003 0x00B19C 1
192.168.66.1 192.168.66.1 638 0x80000003 0x006E8F 1
192.168.10.1 192.168.10.1 802 0x80000004 0x008AEB 2
192.168.17.1 192.168.17.1 855 0x80000003 0x00B19C 1
192.168.66.1 192.168.66.1 638 0x80000003 0x006E8F 1
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.168.1.1 192.168.10.1 802 0x80000001 0x000B2E
192.168.10.2 192.168.17.1 855 0x80000001 0x00D088
192.168.1.1 192.168.10.1 802 0x80000001 0x000B2E
192.168.10.2 192.168.17.1 855 0x80000001 0x00D088
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.168.17.0 192.168.17.1 881 0x80000001 0x009CA9
192.168.30.0 192.168.17.1 819 0x80000001 0x001721
192.168.17.0 192.168.17.1 881 0x80000001 0x009CA9
192.168.30.0 192.168.17.1 819 0x80000001 0x001721
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
192.168.66.0 192.168.66.1 637 0x80000001 0x007BCC 0
192.168.70.0 192.168.66.1 638 0x80000001 0x004FF4 0
Link ID ADV Router Age Seq# Checksum Tag
192.168.66.0 192.168.66.1 637 0x80000001 0x007BCC 0
192.168.70.0 192.168.66.1 638 0x80000001 0x004FF4 0
R4# sh ip ospf database
OSPF Router with ID (192.168.30.2) (Process ID 1)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
192.168.17.1 192.168.17.1 854 0x80000002 0x004002 1
192.168.30.1 192.168.30.1 826 0x80000004 0x00ED16 2
192.168.30.2 192.168.30.2 825 0x80000002 0x006F9C 1
192.168.17.1 192.168.17.1 854 0x80000002 0x004002 1
192.168.30.1 192.168.30.1 826 0x80000004 0x00ED16 2
192.168.30.2 192.168.30.2 825 0x80000002 0x006F9C 1
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.17.2 192.168.30.1 853 0x80000001 0x00F838
192.168.30.2 192.168.30.2 825 0x80000001 0x0017FD
192.168.17.2 192.168.30.1 853 0x80000001 0x00F838
192.168.30.2 192.168.30.2 825 0x80000001 0x0017FD
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.1.0 192.168.17.1 880 0x80000001 0x0057FD
192.168.10.0 192.168.17.1 917 0x80000001 0x00E963
192.168.1.0 192.168.17.1 880 0x80000001 0x0057FD
192.168.10.0 192.168.17.1 917 0x80000001 0x00E963
Summary ASB Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.66.1 192.168.17.1 665 0x80000001 0x0071A0
Link ID ADV Router Age Seq# Checksum
192.168.66.1 192.168.17.1 665 0x80000001 0x0071A0
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
192.168.66.0 192.168.66.1 672 0x80000001 0x007BCC 0
192.168.70.0 192.168.66.1 672 0x80000001 0x004FF4 0
192.168.66.0 192.168.66.1 672 0x80000001 0x007BCC 0
192.168.70.0 192.168.66.1 672 0x80000001 0x004FF4 0
本文转自 tiger506 51CTO博客,原文链接:http://blog.51cto.com/tiger506/169918,如需转载请自行联系原作者