====================== Configuration of OSPF ===========================
Router(config)#router ospf process-id //識別碼(1-65535)
Router(config-router)#network ip-address mask area area-id
Router(config)#router ospf 100
Router(config-router)#network 10.1.1.2 0.0.0.0 area 0 //#10.1.1.2 Router上的SerialPort 01
Router(config-router)#network 10.2.2.2 0.0.0.0 area 0 //#10.2.2.2 Router上的SerialPort 02
Loopback Interface(回繞介面)
RID:RID(RouterID)的決定是以介面中最高的邏輯IP Adderess來做為 RouterID
介面interface:(1)實體介面 (2)回繞介面(虛擬介面)
Configuration of Loopback Interface
Router(config)#interface loopback 0 // 0相當於loopback的名字
Router(config-if)#ip address 200.200.200.200 255.255.255.0 //給loopback 0 IP和Mask
Router(config-if)#shutdown
Router(config-if)#no shutdown
=================== Verifying the OSPF Configuration =======================
Router#show ip protocols
Routing Protocol is "ospf 10"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 192.168.97.36
It is an autonomous system boundary router
Redistributing External Routes from,
connected, includes subnets in redistribution
static with metric mapped to 50, includes subnets in redistribution
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
192.168.98.50 0.0.0.0 area 100
Reference bandwidth unit is 100 mbps
Routing Information Sources:
Gateway Distance Last Update
Router#show ip route
O E1 204.132.66.80/30 [110/30] via 154.102.98.40, 04:42:38, FastEthernet0/0
O E1 204.132.66.101/32 [110/30] via 154.102.98.2, 04:42:38, FastEthernet0/0
Router#show ip ospf //路由器ID,區域資訊,SPF統計,及LSA逾時計時器的資訊
Routing Process "ospf 10" with ID 192.168.20.1 //RID是該路由器最高的IP
Start time: 00:00:33.416, Time elapsed: 7w4d
Supports only single TOS(TOS0) routes
Supports opaque LSA
Supports Link-local Signaling (LLS)
Supports area transit capability
It is an autonomous system boundary router
Redistributing External Routes from,
connected, includes subnets in redistribution
static with metric mapped to 50, includes subnets in redistribution
Router is not originating router-LSAs with maximum metric
Initial SPF schedule delay 5000 msecs
Minimum hold time between two consecutive SPFs 10000 msecs
Maximum wait time between two consecutive SPFs 10000 msecs
Incremental-SPF disabled
Minimum LSA interval 5 secs
Minimum LSA arrival 1000 msecs
LSA group pacing timer 240 secs
Interface flood pacing timer 33 msecs
Retransmission pacing timer 66 msecs
Number of external LSA 3337. Checksum Sum 0x6886109
Number of opaque AS LSA 0. Checksum Sum 0x000000
Number of DCbitless external and opaque AS LSA 0
Number of DoNotAge external and opaque AS LSA 0
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Number of areas transit capable is 1
External flood list length 0
IETF NSF helper support enabled
Cisco NSF helper support enabled
Area 100
Number of interfaces in this area is 1
This area has transit capability
Area has message digest authentication
SPF algorithm last executed 04:44:59.564 ago
SPF algorithm executed 93 times
Area ranges are
Number of LSA 124. Checksum Sum 0x3F5148
Number of opaque link LSA 0. Checksum Sum 0x000000
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
Router#show ip ospf neighbor //鄰居與緊鄰狀態的OSPF資訊,也會顯示DR或BDR
Neighbor ID Pri State Dead Time Address Interface
192.168.40.2 0 2WAY/DROTHER 00:00:39 192.168.20.5 FastEthernet0/0
192.168.40.5 1 FULL/BDR 00:00:37 192.168.20.2 FastEthernet0/0
Router#sh ip ospf interface
Serial0/0 is up, line protocol is up
Internet Address 192.168.20.1/24, Area 100 //介面IP位址,指定區域
Process ID 10,Router ID 192.168.20.1,Network Type BROADCAST,Cost: 10
//程序ID,路由器ID,網路類型,成本
Transmit Delay is 1 sec, State DROTHER, Priority 0 //優先權,DR/BDR,計時器的間隔
Designated Router (ID) 192.168.20.1, Interface address 192.168.10.1
Backup Designated router (ID) 192.168.20.5, Interface address 192.168.10.5 //緊鄰鄰居的資訊
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:08
Supports Link-local Signaling (LLS)
Cisco NSF helper support enabled
IETF NSF helper support enabled
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 0, maximum is 39
Last flood scan time is 0 msec, maximum is 160 msec
Neighbor Count is 37, Adjacent neighbor count is 2
Adjacent with neighbor 192.168.20.5 (Backup Designated Router)
Adjacent with neighbor 192.168.20.1 (Designated Router)
Suppress hello for 0 neighbor(s)
Message digest authentication enabled
Youngest key id is 10
Router#sh ip ospf database //顯示的資訊表示鏈路的數目,鄰居的路由器ID,與我們所提的拓墣資料庫
OSPF Router with ID (192.168.20.1) (Process ID 10)
Router Link States (Area 100)
Link ID ADV Router Age Seq# Checksum Link count
192.168.20.1 192.168.20.1 1359 0x8001A5F9 0x005399 1
192.168.40.1 192.168.40.1 1705 0x8001A5D2 0x009F71 1
192.168.40.2 192.168.40.2 723 0x80001C59 0x00E6BE 2
=========================== 手動修改AD值==============================
Router(config)#router ospf 1 //設定OSPF的AD值為1
Router(config-router)#distance 89 //把OSPF的AD值設為89
=====================移除RIP、IGRP、EIGRP、OSPF ====================
Router(config)#no router rip //移除RIP
Router(config)#no router igrp //移除IGRP
Router(config)#no router eigrp //移除EIGRP