1、IP配置
      pc1:10.149.39.200/26      gateway-10.149.39.250
      pc2:10.149.40.60/26        gateway-10.149.40.62
      pc3:10.149.0.9/24            gateway-10.149.0.1
     Cisco2821:
     FastEthernet0/0: 10.149.100.14 255.255.255.0
     FastEthernet0/1: 10.149.40.196 255.255.255.192
     Core:
      FastEthernet0/0:10.149.100.15 255.255.255.0
      FastEthernet0/1:10.149.0.1 255.255.255.0
2、拓扑图
静态路由与OSPF的从分配,OSPF协议密文认证_静态路由 OSPF 在发布 OSPF密文
3、配置详单
3.1  6509
6509#show run
Building configuration...
Current configuration : 2085 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname 6509
!

!
no ip domain-lookup
ip name-server 0.0.0.0
!

!
interface FastEthernet0/1
 switchport access vlan 99
!
interface FastEthernet0/2
 switchport access vlan 140
!
interface FastEthernet0/3
 switchport access vlan 168
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
interface Vlan1
 description "Switch Default GateWay"
 shutdown
!
interface Vlan99
 description up to Cisco ASA5510
 ip address 10.149.40.195 255.255.255.192
!

interface Vlan140
 description zonghebu zhenggongbu qihuabu
 ip address 10.149.39.250 255.255.255.192
!

interface Vlan168
 description shengchanlou
 ip address 10.149.40.62 255.255.255.192
!

ip classless
ip route 0.0.0.0 0.0.0.0 10.149.40.196
!
!
line con 0
line vty 0 4
 login
!
!
!
end

6509#
 
3.2 2821
2821#show run
Building configuration...
Current configuration : 796 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname 2821
!
!
!
!
!
!
!
!
!
!
no ip domain-lookup
!
!
!
!
!
!
interface FastEthernet0/0
 ip address 10.149.100.14 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 10.149.40.196 255.255.255.192
 duplex auto
 speed auto
!
interface Vlan1
 no ip address
 shutdown
!
router ospf 100
 log-adjacency-changes
 area 0 authentication message-digest   采用密文认证不在接口上配置密码,认证也可以成功,这时密文认证采用ID=0的空密码。
 redistribute static metric 1 subnets        静态路由与OSPF协议重分配
 network 10.149.100.0 0.0.0.255 area 0
 network 10.149.40.192 0.0.0.63 area 0
!
ip classless
ip route 10.149.39.0 255.255.255.0 10.149.40.195
ip route 10.149.40.0 255.255.255.0 10.149.40.195
!
!
!
!
!
!
!
!
!
line con 0
line vty 0 4
 login
!
!
!
end

2821#
 
3.3 core
core#show run
Building configuration...
Current configuration : 630 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname core
!
!
!
interface FastEthernet0/0
 ip address 10.149.100.15 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 10.149.0.1 255.255.255.0
 duplex auto
 speed auto
!
interface Vlan1
 no ip address
 shutdown
!
router ospf 100
 log-adjacency-changes
 area 0 authentication message-digest采用密文认证不在接口上配置密码,认证也可以成功,这时密文认证采用ID=0的空密码。
 network 10.149.100.0 0.0.0.255 area 0
 network 10.149.0.0 0.0.0.255 area 0
!
ip classless
!

!
!
line con 0
line vty 0 4
 login
!
!
!
end

core#
 
4、结论
4.1、core路由器可以通过ospf学习到2821上的静态路由
4.2、两台路由器都是用相同的密文空密码认证可以学习到对方路由
core#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, 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
     10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
C       10.149.0.0/24 is directly connected, FastEthernet0/1
O E2    10.149.39.0/24 [110/1] via 10.149.100.14, 00:37:52, FastEthernet0/0
O E2    10.149.40.0/24 [110/1] via 10.149.100.14, 00:37:52, FastEthernet0/0
O       10.149.40.192/26 [110/2] via 10.149.100.14, 00:37:52, FastEthernet0/0
C       10.149.100.0/24 is directly connected, FastEthernet0/0
core#