Cisco(config)#router ospf 110  

Cisco(config-router)#router-id 1.1.1.1  

Cisco(config-router)#network 20.1.1.0 0.0.0.255 area 0

Cisco#show ip ospf neighbor

Cisco(config)#int f0/0

Cisco(config-if)#ip ospf priority 1

Cisco(config-if)#ip ospf network broadcast  //修改接口的网络类型

Cisco(config-if)#ip ospf network non-broadcast  

Cisco(config-if)#ip ospf network point-to-multipoint

Cisco#show ip ospf interface

Cisco(config)#int f0/0

Cisco(config-if)#ip ospf cost 100  //修改接口cost值

Cisco(config-if)#bandwidth 1000000  //修改参考带宽

Cisco(config-if)#ip ospf hello-interval 10  //修改hello间隔时间,死亡时间随之改变(4倍)

Cisco(config)#router ospf 110

Cisco(config-router)#network 0.0.0.0 255.255.255.255 area 0  //宣告所有接口

Cisco#clear ip ospf process  //清理OSPF进程

Cisco#show ip ospf  //可查看到路由器ID,OSPF定时器以及LSA信息

Cisco#show ip route ospf  //查看学习到的OSPF路由

Cisco#show ip protocols  //显示路由协议参数

Cisco#debug ip ospf events  //显示OSPF相关事件

Cisco#debug ip ospf adj  //跟踪邻接关系的建立和终止

Cisco#debug ip ospf packet  //查看正在传输的OSPF分组

Cisco#undebug all  //关闭所有debug

Cisco(config)#router ospf 110

Cisco(config-router)#passive-interface f0/1 //把接口变为被动接口

Cisco(config-router)#passive-interface default  //把所有接口变为被动接口

Cisco(config)#int f0/0

Cisco(config-if)#ip ospf 110 area 0  //将接口宣告进OSPF

Cisco#show ip ospf database  //查看LSDB摘要信息

Cisco#show ip ospf database router  //查看1类LSA的详细信息

Cisco#show ip ospf database router self-originate  //查看自己生成的1类LSA的信息

Cisco#show ip ospf database network  //查看2类LSA的详细信息

Cisco#show ip ospf database summary  //查看3类LSA的详细信息

Cisco#show ip ospf database external  //查看5类LSA的详细信息

Cisco#show ip ospf border-routers  //查看5类LSA的详细信息

Cisco(config)#router ospf 1

Cisco(config-router)#network 10.1.1.0 0.0.0.255 area 1

Cisco(config-router)#area 1 stub  //配置stub区域

Cisco(config-router)#area 1 default-cost 2  //修改下发的默认三类LSA的cost为2,默认为1

Cisco(config-router)#area 1 stub no-summary  //配置完全stub区域

Cisco(config-router)#area 1 nssa  //配置nssa区域

Cisco(config-router)#area 1 nssa default-information-originate  //在NSSA区域的ABR上手工下发默认路由

Cisco(config-router)#area 1 nssa no-summary  //配置完全nssa区域

Cisco(config-router)#area 1 nssa no-redistribution no-summary  //配置完全nssa区域过滤7类LSA

Cisco(config-router)#default-information originate  //在OSPF中默认路由

Cisco(config-router)#default-information originate always  //不论有没有静态默认路由,都向OSPF中注入默认路由

Cisco(config-router)#area 1 range 172.16.0.0 255.255.0.0  

Cisco(config-router)#area 1 range 172.16.0.0 255.255.0.0 cost 1  //在ABR上对区域1中的1、2类明细路由进行汇总

Cisco(config-router)#summary-address 10.1.0.0 255.255.0.0  //在ASBR上对外部路由进行汇总

Cisco(config-router)#area 2 virtual-link 3.3.3.3  //配置虚链路

Cisco#show ip ospf virtual-links  //查看虚链路

Cisco (config)#int f0/0

Cisco(config-if)#ip ospf authentication-key abc123  //配置OSPF认证密码

Cisco(config-if)#ip ospf authentication  //启用OSPF接口认证

Cisco(config)#router ospf 110

Cisco(config-router)#area 0 authentication  //启用OSPF区域认证

Cisco(config-if)#ip ospf message-digest-key 1 md5 abc123  //配置OSPF密文认证密码

Cisco(config-if)#ip ospf authentication message-digest  //启用OSPF接口密文认证

Cisco(config)#router ospf 110

Cisco(config-router)#area 0 authentication message-digest  //启用OSPF区域的密文认证

Cisco(config-router)#area 1 virtual-link 3.3.3.3 authentication-key abc123  

Cisco(config-router)#area 1 virtual-link 3.3.3.3 authentication  //配置OSPF虚链路的明文认证

Cisco(config-router)# area 1 virtual-link 3.3.3.3 authentication message-digest-key 1 md5 abc123

Cisco(config-router)#area 1 virtual-link 3.3.3.3 authentication message-digest  //配置OSPF虚链路的密文认证