CCNA培训课总结笔记--配置OSPF实验(十一)

实验目的:
理解OSPF协议,掌握配置OSPF协议的配置及验证命令.
实验拓扑图:
实验内容:
路由器的配置
R1上的配置
进入全局配置模式,同样地粘贴上基本路由命令
Router(config)#enable password cisco
Router(config)#no ip domain-lookup
Router(config)#line con 0
Router(config-line)# exec-timeout 0 0
Router(config-line)# logging synchronous
Router(config-line)#
Router(config-line)#line aux 0
Router(config-line)# exec-timeout 0 0
Router(config-line)# logging synchronous
Router(config-line)#line vty 0 4
Router(config-line)#
Router(config-line)#
Router(config-line)# exec-timeout 0 0
Router(config-line)# password cisco
Router(config-line)#
Router(config-line)# login
Router(config-line)#
Router(config-line)#
Router(config-line)#alias exec a sh ip int bri
Router(config)#alias exec b sh ip route
Router(config)#alias exec c sh ip route rip
Router(config)#alias exec d sh run
设置好名称,接口地址
Router(config)#host R1
R1(config)#int e0/0
R1(config-if)#ip add 172.16.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int s1/0
R1(config-if)#ip add 10.1.1.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shut
查看下各接口配置好了没有
R1(config)#do show ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                172.16.1.1      YES manual up                    up     
Serial1/0                  10.1.1.1        YES manual up                    up     
Serial1/1                  unassigned      YES unset  administratively down down   
Serial1/2                  unassigned      YES unset  administratively down down   
Serial1/3                  unassigned      YES unset  administratively down down
OK,接下来配置R2
Router(config)#host R2
R2(config)#int s1/1
R2(config-if)#ip add 10.1.1.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int s1/0
R2(config-if)#ip add 10.2.2.2 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shut
还有R3的配置
Router(config)#host R3
R3(config)#int e0/0
R3(config-if)#ip add 192.168.1.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#int s1/1
R3(config-if)#ip add 10.2.2.3 255.255
% Incomplete command.

 

R3(config-if)#ip add 10.2.2.3 255.255.255.0
R3(config-if)#exit
R3(config)#int s1/1
R3(config-if)#no shut
好了,下面开始配置OSPF.
先从R1开始
R1(config)#router ospf 100  (这里的100可以任意取值,用于在本地区分开来就可以,范围是1~65535)
宣告网络
R1(config-router)#network 172.16.1.0 0.0.0.255 area 0
R1(config-router)#network 10.0.0.0 0.255.255.255 area 0
要注意一下这里的掩码用的是子网掩码的反码,0即要严格一致,255即表示任意.
接下是R2上的
R2(config)#router ospf 101
R2(config-router)#network 10.1.1.0 0.0.0.255 area 0
R2(config-router)#network 10.2.2.0 0.0.0.255 area 0
最后是R3上的了
R3(config)#router ospf 102
R3(config-router)#network 10.2.2.0 0.0.0.255 area 0
R3(config-router)#network 192.168.1.0 0.0.0.255 area 0
配置好了OSPF,相信大跟我一样都很想马上去验证一下.好的
R1上去验证先
R1#show ip protocols
Routing Protocol is "ospf 100"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Router ID 172.16.1.1
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    10.0.0.0 0.255.255.255 area 0
    172.16.1.0 0.0.0.255 area 0
  Routing Information Sources:
    Gateway         Distance      Last Update
    10.2.2.2             110      00:00:17
    192.168.1.1          110      00:00:17
  Distance: (default is 110)
这命令是查看启用的路由协议,这里可以看到已经启用了OSPF协议.
R1#show 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

 

     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, Ethernet0/0
     10.0.0.0/24 is subnetted, 2 subnets
O       10.2.2.0 [110/128] via 10.1.1.2, 00:00:23, Serial1/0
C       10.1.1.0 is directly connected, Serial1/0
O    192.168.1.0/24 [110/138] via 10.1.1.2, 00:00:23, Serial1/0
这个不用我介绍大家都知道查看路由表的,下面的O开头的就是OSPF路由了,它的管理距离是110,记住了!
R1#show ip ospf interface
Serial1/0 is up, line protocol is up
  Internet Address 10.1.1.1/24, Area 0
  Process ID 100, Router ID 172.16.1.1, Network Type POINT_TO_POINT, Cost: 64
  Transmit Delay is 1 sec, State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:03
  Index 2/2, 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 10.2.2.2
  Suppress hello for 0 neighbor(s)
Ethernet0/0 is up, line protocol is up
  Internet Address 172.16.1.1/24, Area 0
  Process ID 100, Router ID 172.16.1.1, Network Type BROADCAST, Cost: 10
  Transmit Delay is 1 sec,
State DR
, Priority 1
  Designated Router (ID) 172.16.1.1, Interface address 172.16.1.1
  No backup designated router on this network
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:09
  Index 1/1, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 0, maximum is 0
  Last flood scan time is 0 msec, maximum is 0 msec
  Neighbor Count is 0, Adjacent neighbor count is 0
  Suppress hello for 0 neighbor(s)
这个用于查看区域号和与此相关的信息
R1#show ip ospf neighbor

 

Neighbor ID     Pri   State           Dead Time   Address         Interface
10.2.2.2          0   FULL/  -        00:00:36    10.1.1.2        Serial1/0
用于查看在每一个接口上的邻居信息.
还得看下R2相关结果
R2#show 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

 

     172.16.0.0/24 is subnetted, 1 subnets
O       172.16.1.0 [110/74] via 10.1.1.1, 00:03:09, Serial1/1
     10.0.0.0/24 is subnetted, 2 subnets
C       10.2.2.0 is directly connected, Serial1/0
C       10.1.1.0 is directly connected, Serial1/1
O    192.168.1.0/24 [110/74] via 10.2.2.3, 00:03:09, Serial1/0
R2#show ip ospf interface
Serial1/0 is up, line protocol is up
  Internet Address 10.2.2.2/24, Area 0
  Process ID 101, Router ID 10.2.2.2, Network Type POINT_TO_POINT, Cost: 64
  Transmit Delay is 1 sec, State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:09
  Index 2/2, 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 192.168.1.1
  Suppress hello for 0 neighbor(s)
Serial1/1 is up, line protocol is up
  Internet Address 10.1.1.2/24, Area 0
  Process ID 101, Router ID 10.2.2.2, Network Type POINT_TO_POINT, Cost: 64
  Transmit Delay is 1 sec, State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:00
  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 172.16.1.1
  Suppress hello for 0 neighbor(s)
R2#show ip ospf neighbor

 

Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.1.1       0   FULL/  -        00:00:35    10.2.2.3        Serial1/0
172.16.1.1        0   FULL/  -        00:00:30    10.1.1.1        Serial1/1
R2#
这里可以看到R2的两个相邻的OSPF邻居都显示出来了.
最后来看一下R3
R3#show 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

 

     172.16.0.0/24 is subnetted, 1 subnets
O       172.16.1.0 [110/138] via 10.2.2.2, 00:03:27, Serial1/1
     10.0.0.0/24 is subnetted, 2 subnets
C       10.2.2.0 is directly connected, Serial1/1
O       10.1.1.0 [110/128] via 10.2.2.2, 00:03:27, Serial1/1
C    192.168.1.0/24 is directly connected, Ethernet0/0
R3#show ip ospf interface
Ethernet0/0 is up, line protocol is up
  Internet Address 192.168.1.1/24, Area 0
  Process ID 102, Router ID 192.168.1.1, Network Type BROADCAST, Cost: 10
  Transmit Delay is 1 sec,
State DR
, Priority 1
  Designated Router (ID) 192.168.1.1, Interface address 192.168.1.1
  No backup designated router on this network
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:09
  Index 2/2, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 0, maximum is 0
  Last flood scan time is 0 msec, maximum is 0 msec
  Neighbor Count is 0, Adjacent neighbor count is 0
  Suppress hello for 0 neighbor(s)
Serial1/1 is up, line protocol is up
  Internet Address 10.2.2.3/24, Area 0
  Process ID 102, Router ID 192.168.1.1, Network Type POINT_TO_POINT, Cost: 64
  Transmit Delay is 1 sec, State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    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 10.2.2.2
  Suppress hello for 0 neighbor(s)
R3#show ip ospf neighbor

 

Neighbor ID     Pri   State           Dead Time   Address         Interface
10.2.2.2          0   FULL/  -        00:00:39    10.2.2.2        Serial1/1
好了,关于OSPF的实验就简单地做到这里.这里只有一个区域ospf 0,如果要有几个ospf区域的话,实验就不会这么简单的了.注意一下配置OSPF时的子网掩码,它用的是反码,就是用255.255.255.255减去子网掩码就可以得出.一定要记住0是表示跟前面的地址严格一致,255即表示任意.
 
本文出自 “孤帆远影碧空尽” 博客,请务必保留此出处[url]http://bennie.blog.51cto.com/192876/102434[/url]
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章