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]
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章