OSPF单区域配置

 

OSPF单区域配

拓扑图如下

 

实验步骤:

在R1上的配置;

Router>
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface f0/0
Router(config-if)#ip add 12.0.0.1 255.255.255.0
Router(config-if)#no shu

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#router ospf 64
Router(config-router)#network 12.0.0.0 0.0.0.255 area 0
Router(config-router)#exit
Router(config)

在R2上的配置

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int f 0/1
Router(config-if)#ip add 12.0.0.2 255.255.255.0
Router(config-if)#no shu

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
Router(config-if)#exit
Router(config)#int f0/0
Router(config-if)#no shu

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
Router(config-if)#ip add 23.0.0.2 255.255.255.0
Router(config-if)#no shu
Router(config-if)#exit
Router(config)#router ospf 64
Router(config-router)#network 12.0.0.0 0.0.0.255 a 0
Router(config-router)#network 23.0.0.0 0.0.0.255 a 0
Router(config-router)#exit
Router(config)#

在R3上面的配置

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int f 0/1
Router(config-if)#no shu

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#ip add 23.0.0.3 255.255.255.0
Router(config-if)#exit
Router(config)#int f0/0
Router(config-if)#no sh

Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
Router(config-if)#ip add 34.0.0.3 255.255.255.0
Router(config-if)#no shu
Router(config-if)#exit
Router(config)#router ospf 64
Router(config-router)#net 23.0.0.0 0.0.0.255 area 0
Router(config-router)#net 34.0.0.0 0.0.0.255 area 0
Router(config-router)#exit
Router(config)#

在R4上的配置

 Router>
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int f 0/0
Router(config-if)#ip add 45.0.0.4 255.255.255.0
Router(config-if)#no sh
Router(config-if)#exit
Router(config)#int f 0/1
Router(config-if)#ip add 34.0.0.4 255.255.255.0
Router(config-if)#no sh
Router(config-if)#exit
Router(config)#router ospf 64
Router(config-router)#net 34.0.0.0 0.0.0.255 a 0
Router(config-router)#net 45.0.0.0 0.0.0.255 a 0
Router(config-router)#exit
Router(config)#

在R5上的配置

Router>
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface f 0/1
Router(config-if)#ip add 45.0.0.5 255.255.255.0
Router(config-if)#no shu
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#exit
Router(config)#router ospf 64
Router(config-router)#net 45.0.0.0 0.0.0.255 a 0
Router(config-router)#exit
Router(config)#

R1上查看OSPF运行状态
1:查看OSPF的接口
Router#sho ip ospf int
FastEthernet0/0 is up, line protocol is up
  Internet address is 12.0.0.1/24, Area 0
  Process ID 64, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1
  Transmit Delay is 1 sec, State BDR, Priority 1
  Designated Router (ID) 23.0.0.2, Interface address 12.0.0.2
  Backup Designated Router (ID) 1.1.1.1, Interface address 12.0.0.1
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:03
  Index 1/1, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 1, maximum is 1
  Last flood scan time is 0 msec, maximum is 0 msec
  Neighbor Count is 1, Adjacent neighbor count is 1
    Adjacent with neighbor 23.0.0.2  (Designated Router)
  Suppress hello for 0 neighbor(s)
2:查看OSPF的邻居
Router#sho ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
23.0.0.2          1   FULL/DR         00:00:33    12.0.0.2        FastEthernet0/0


3:查看OSPF的邻居详细信息
Router#sho ip ospf neighbor detail
 Neighbor 23.0.0.2, interface address 12.0.0.2
    In the area 0 via interface FastEthernet0/0
    Neighbor priority is 1, State is FULL, 6 state changes
    DR is 12.0.0.2 BDR is 12.0.0.1
    Options is 0x00
    Dead timer due in 00:00:37
    Neighbor is up for 00:42:45
    Index 1/1, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec

4:查看OSPF的数据库
Router#sho ip ospf database
            OSPF Router with ID (1.1.1.1) (Process ID 64)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         1003        0x80000003 0x00feff 1
23.0.0.2        23.0.0.2        852         0x80000006 0x00feff 3
3.3.3.3         3.3.3.3         678         0x80000006 0x00feff 3
4.4.4.4         4.4.4.4         620         0x80000006 0x00feff 3
5.5.5.5         5.5.5.5         620         0x80000004 0x00feff 2

                Net Link States (Area 0)
Link ID         ADV Router      Age         Seq#       Checksum
12.0.0.2        23.0.0.2        1003        0x80000003 0x003436
23.0.0.2        23.0.0.2        852         0x80000004 0x00f5a8
34.0.0.4        4.4.4.4         678         0x80000003 0x0019b3
45.0.0.4        4.4.4.4         620         0x80000004 0x00c6c4


5:查看目前路由器上的协议
Router#show ip protocols

Routing Protocol is "ospf 64"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Router ID 1.1.1.1
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    12.0.0.0 0.0.0.255 area 0
  Routing Information Sources: 
    Gateway         Distance      Last Update
    12.0.0.2             110      00:07:18
  Distance: (default is 110)
6:查看路由表
Router#sho ip route ospf
     23.0.0.0/24 is subnetted, 1 subnets
O       23.0.0.0 [110/2] via 12.0.0.2, 00:43:54, FastEthernet0/0
     34.0.0.0/24 is subnetted, 1 subnets
O       34.0.0.0 [110/3] via 12.0.0.2, 00:40:08, FastEthernet0/0
     45.0.0.0/24 is subnetted, 1 subnets
O       45.0.0.0 [110/4] via 12.0.0.2, 00:39:18, FastEthernet0/0

分别查看R2、R3 、R4、 R5的路由表

Router#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

     12.0.0.0/24 is subnetted, 1 subnets
C       12.0.0.0 is directly connected, FastEthernet0/1
     23.0.0.0/24 is subnetted, 1 subnets
C       23.0.0.0 is directly connected, FastEthernet0/0
     34.0.0.0/24 is subnetted, 1 subnets
O       34.0.0.0 [110/2] via 23.0.0.3, 01:05:54, FastEthernet0/0
     45.0.0.0/24 is subnetted, 1 subnets
O       45.0.0.0 [110/3] via 23.0.0.3, 01:04:59, FastEthernet0/0

Router#sho 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

     12.0.0.0/24 is subnetted, 1 subnets
O       12.0.0.0 [110/2] via 23.0.0.2, 01:08:47, FastEthernet0/1
     23.0.0.0/24 is subnetted, 1 subnets
C       23.0.0.0 is directly connected, FastEthernet0/1
     34.0.0.0/24 is subnetted, 1 subnets
C       34.0.0.0 is directly connected, FastEthernet0/0
     45.0.0.0/24 is subnetted, 1 subnets
O       45.0.0.0 [110/2] via 34.0.0.4, 01:05:51, FastEthernet0/0

Router#sho 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

     12.0.0.0/24 is subnetted, 1 subnets
O       12.0.0.0 [110/3] via 34.0.0.3, 01:06:21, FastEthernet0/1
     23.0.0.0/24 is subnetted, 1 subnets
O       23.0.0.0 [110/2] via 34.0.0.3, 01:06:21, FastEthernet0/1
     34.0.0.0/24 is subnetted, 1 subnets
C       34.0.0.0 is directly connected, FastEthernet0/1
     45.0.0.0/24 is subnetted, 1 subnets
C       45.0.0.0 is directly connected, FastEthernet0/0

Router#sho 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

     12.0.0.0/24 is subnetted, 1 subnets
O       12.0.0.0 [110/4] via 45.0.0.4, 01:05:57, FastEthernet0/1
     23.0.0.0/24 is subnetted, 1 subnets
O       23.0.0.0 [110/3] via 45.0.0.4, 01:05:57, FastEthernet0/1
     34.0.0.0/24 is subnetted, 1 subnets
O       34.0.0.0 [110/2] via 45.0.0.4, 01:05:57, FastEthernet0/1
     45.0.0.0/24 is subnetted, 1 subnets
C       45.0.0.0 is directly connected, FastEthernet0/1
 

 实验总结:本实验简单的配置了单区域的OSPF,查看上面还存在缺陷,模拟器毕竟是模拟器,我查找到的几条命令还是没能敲上去。。有时间上真机试试

1:show ip ospf stat (查看ospf的算法过程)

2:sho ip ospf database database-summary(查看ospf数据库的统计信息)

3:sho ip ospf database router 12.0.0.1 (查看ospf数据库中关于12.0.0.1的详细信息) 

基本就这几条了。。 还有哪里有问题欢迎高手指点。

你可能感兴趣的:(职场,休闲,拓扑图)