单区域OSPF路由协议的配置

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
!
!

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.

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

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命令重启路由器。




     本文转自kindIT 51CTO博客,原文链接:http://blog.51cto.com/kindit/1019844 ,如需转载请自行联系原作者




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值