知识屋:更实用的电脑技术知识网站
所在位置:首页 > 电脑知识 > 路由器

单区域OSPF路由协议的配置

发布时间:2015-06-17 12:08:55作者:知识屋


1.拓扑图


2.各路由器上配置完成后的 show run
  a.
r1#show run 
Building configuration...

Current configuration : 645 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname r1
!
!
  www.zhishiwu.com  
interface Loopback0
 ip address 11.11.1.1 255.255.255.0
!
interface FastEthernet0/0
 ip address 172.16.123.1 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 10.10.1.254 255.255.255.0
 duplex auto
 speed auto
!
interface Vlan1
 no ip address
 shutdown
!
router ospf 100
 log-adjacency-changes
 network 172.16.123.1 0.0.0.0 area 0
 network 10.10.1.254 0.0.0.0 area 0
!
ip classless
!
!
line con 0
line vty 0 4
 login
!
!
end入内容
  b.
r2#
r2#show run
Building configuration...

Current configuration : 666 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname r2
!
!
interface Loopback0
 ip address 22.22.2.2 255.255.255.0
!
interface FastEthernet0/0
 ip address 172.16.123.2 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 10.10.2.254 255.255.255.0
 duplex auto
 speed auto
!
interface Vlan1
 no ip address
 shutdown
!
router ospf 100
 router-id 22.22.2.2
 log-adjacency-changes
 network 172.16.123.2 0.0.0.0 area 0
 network 10.10.2.254 0.0.0.0 area 0
!
ip classless
!
!
line con 0
line vty 0 4
 login
!
!
end
  c.
  www.zhishiwu.com  
r3#
r3#show run
Building configuration...

Current configuration : 645 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname r3
!
!
interface Loopback0
 ip address 33.33.3.3 255.255.255.0
!
interface FastEthernet0/0
 ip address 172.16.123.3 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 10.10.3.254 255.255.255.0
 duplex auto
 speed auto
!
interface Vlan1
 no ip address
 shutdown
!
router ospf 100
 log-adjacency-changes
 network 172.16.123.3 0.0.0.0 area 0
 network 10.10.3.254 0.0.0.0 area 0
!
ip classless
!
!
line con 0
line vty 0 4
 login
!
!
end

3.查看邻居表、拓扑表、路由表
  a.
r1#show ip ospf nei

Neighbor ID Pri   State   Dead Time   Address Interface
22.22.2.2 1   FULL/BDR 00:00:35 172.16.123.2 FastEthernet0/0
33.33.3.3 1   FULL/DROTHER 00:00:31 172.16.123.3 FastEthernet0/0
r1#show ip ospf nei

Neighbor ID Pri   State   Dead Time   Address Interface
22.22.2.2 1   FULL/BDR 00:00:30 172.16.123.2 FastEthernet0/0
33.33.3.3 1   FULL/DROTHER 00:00:36 172.16.123.3 FastEthernet0/0
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, 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/24 is subnetted, 3 subnets
C   10.10.1.0 is directly connected, FastEthernet0/1
O   10.10.2.0 [110/2] via 172.16.123.2, 00:06:07, FastEthernet0/0
O   10.10.3.0 [110/2] via 172.16.123.3, 00:05:57, FastEthernet0/0
 11.0.0.0/24 is subnetted, 1 subnets
C   11.11.1.0 is directly connected, Loopback0
 172.16.0.0/24 is subnetted, 1 subnets
C   172.16.123.0 is directly connected, FastEthernet0/0
r1#
b.
r2#show ip ospf nei

Neighbor ID Pri   State   Dead Time   Address Interface
11.11.1.1 1   FULL/DR 00:00:38 172.16.123.1 FastEthernet0/0
33.33.3.3 1   FULL/DROTHER 00:00:31 172.16.123.3 FastEthernet0/0
r2#show ip ospf data
OSPF Router with ID (22.22.2.2) (Process ID 100)

Router Link States (Area 0)

Link ID ADV Router  Age Seq#   Checksum Link count
172.16.123.1 172.16.123.1 2475 0x80000003 0x0055f2 2
172.16.123.2 172.16.123.2 1926 0x80000005 0x006ed2 2
172.16.123.3 172.16.123.3 1651 0x80000007 0x0087b2 2
22.22.2.2   22.22.2.2   489 0x80000007 0x0063f0 2
11.11.1.1   11.11.1.1   489 0x80000007 0x003254 2
33.33.3.3   33.33.3.3   469 0x80000003 0x009c89 2

Net Link States (Area 0)
Link ID ADV Router  Age Seq#   Checksum
172.16.123.1 11.11.1.1   469 0x80000004 0x00fd41
r2#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/24 is subnetted, 3 subnets
O   10.10.1.0 [110/2] via 172.16.123.1, 00:07:57, FastEthernet0/0
C   10.10.2.0 is directly connected, FastEthernet0/1
O   10.10.3.0 [110/2] via 172.16.123.3, 00:07:47, FastEthernet0/0
 22.0.0.0/24 is subnetted, 1 subnets
C   22.22.2.0 is directly connected, Loopback0
 172.16.0.0/24 is subnetted, 1 subnets
C   172.16.123.0 is directly connected, FastEthernet0/0
r2#
c.
r3#show ip ospf nei

Neighbor ID Pri   State   Dead Time   Address Interface
22.22.2.2 1   FULL/BDR 00:00:33 172.16.123.2 FastEthernet0/0
11.11.1.1 1   FULL/DR 00:00:37 172.16.123.1 FastEthernet0/0
r3#show ip ospf data
OSPF Router with ID (33.33.3.3) (Process ID 100)

Router Link States (Area 0)

Link ID ADV Router  Age Seq#   Checksum Link count
172.16.123.1 172.16.123.1 2546 0x80000003 0x0055f2 2
172.16.123.2 172.16.123.2 1997 0x80000005 0x006ed2 2
172.16.123.3 172.16.123.3 1722 0x80000007 0x0087b2 2
22.22.2.2   22.22.2.2   560 0x80000007 0x0063f0 2
11.11.1.1   11.11.1.1   560 0x80000007 0x003254 2
33.33.3.3   33.33.3.3   540 0x80000003 0x009c89 2

Net Link States (Area 0)
Link ID ADV Router  Age Seq#   Checksum
172.16.123.1 11.11.1.1   540 0x80000004 0x00fd41
r3#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
  www.zhishiwu.com  
Gateway of last resort is not set

 10.0.0.0/24 is subnetted, 3 subnets
O   10.10.1.0 [110/2] via 172.16.123.1, 00:08:59, FastEthernet0/0
O   10.10.2.0 [110/2] via 172.16.123.2, 00:08:59, FastEthernet0/0
C   10.10.3.0 is directly connected, FastEthernet0/1
 33.0.0.0/24 is subnetted, 1 subnets
C   33.33.3.0 is directly connected, Loopback0
 172.16.0.0/24 is subnetted, 1 subnets
C   172.16.123.0 is directly connected, FastEthernet0/0
r3#

备注:在Packet Tracer环境中,如开始没有配置router-id,之后才配置loopback 0 IP地址,loopback地址不会自动成为router-id,而需要保存配置后,用reload命令重启路由器。

(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)
收藏
  • 人气文章
  • 最新文章
  • 下载排行榜
  • 热门排行榜