cisco router OSPF basic configuration commands

Insert picture description here
1.基本配置
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address 172.16.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config)#interface s2/0
R1(config-if)#ip add 192.168.1.5 255.255.255.252
R1(config-if)#clock rate 64000
R1(config-if)#no shutdown

R2(config)#interface s3/0
R2(config-if)#ip add 192.168.1.6 255.255.255.252
R2(config-if)#no shutdown
R2(config)#interface fa1/0
R2(config-if)#ip add 10.10.10.1 255.255.255.0
R2(config-if)#no shutdown

2. OSPF protocol configuration
R1 (config) #router ospf 1
starts the ospf process, the process ID is 1 (the process ID value range is an integer in 1-65535), this process number is only a local identification, has local meaning, It has nothing to do with the process number of the OSPF router in the same area. Different process numbers do not affect the establishment of the adjacency relationship.
R1 (config-router) #network 172.16.1.0 0.0.0.255 area 0
announces the network, that is, defines the interface or network that participates in the OSPF process, and specifies the area where it runs (area 0 is the backbone area). The wildcard mask is used to control the In the declared range, any interface within this address range runs the OSPF protocol. OSPF packets are sent and received. 0 means an exact match. The corresponding bit in the matching address will be checked. 1 means any match. The corresponding bit in the matching address will not be checked.
R1 (config-router) #network 192.168.1.4 0.0.0.3 area 0

R2(config)#router ospf 1
R2(config-router)#network 192.168.1.4 0.0.0.3 area 0
R2(config-router)#network 10.10.10.0 0.0.0.255 area 0

Note:
(1) Configure the clock rate on the DCE side of the WAN port;
(2) The ospf process recommends the same process number, which is conducive to network planning and management;
(3) After declaring the network segment, the mask is reversed.

3. View the routing information
R1 # show ip route View the routing table
R1 # show ip protocols View the configured and running routing protocol
R1 # show ip ospf neighbor View the neighbor table
R1 # show ip ospf neighbor detail Show the details of the neighbor router
R1 # show ip ospf database View the topology table, that is, the link state database
R1 # show ip ospf interface View all the interfaces running OSPF
R1 # show ip ospf interface s2 / 0 View the OSPF information of the s2 / 0 interface
R1 # show interfaces s2 / 0 View router interface information

查看Router ID号
R1# show ip protocols
R1#show ip ospf 1
R2#show ip ospf neighbor

4. Change the interface related information
(1) The following changes the interface bandwidth to affect the link Cost
R1 (config) #interface s2 / 0
R1 (config-if) #bandwidth 64
View the change result
R1 # show interfaces s2 / 0 View the bandwidth value
R1 #show ip ospf interface s2 / 0 View the cost value
R1 # show ip route ospf View the routing table to see the change of the metric value

(2) The following directly changes the interface related Cost
R1 (config) #interface s2 / 0
R1 (config-if) #ip ospf cost 200 to
view the change result
R1 # show ip ospf interface s2 / 0 view the cost value
R1 # show ip route ospf Check the routing table to see the change of the metric value
R1 # show interfaces s2 / 0 Check whether the bandwidth value has changed

5. Monitor and debug OSPF
R1 # debug ip ospf events Monitor OSPF events
R1 # undebug all Close
R1 # debug ip ospf packet Monitor OSPF packet transmission (PT simulator does not have this command)

Published 5 original articles · Likes0 · Visits 4

Guess you like

Origin blog.csdn.net/qq_45562742/article/details/105431258