标签:sum ref nss res imp log pat nal spfa
https://blog.51cto.com/sweetpotato/1410762
1、配置步骤
1、配置loopback接口地址: //用于产生路由器的Router ID Router(config)#interface loopback 0 Router(config-if)#ip address IP地址 掩码 2、启动OSPF路由进程: //本路由器的进程号,用于标识同一路由器上的多个OSPF进程 Router(config)#router ospf 进程号 3、指定OSPF协议运行的接口和所在区域: Router(config-router)#network 网络号 反向掩码 area 区域号 /*说明: **网络号:可以是网络地址、子网地址、接口地址 **反向掩码:即子网掩码的反码(例如:192.168.2.0/28的反向掩码为:0.0.0.15<-->因为子网掩码为255.255.255.240,所以反向掩码为:0.0.0.<255-240=15>) **区域号:指明网络所属区域,此处是0-->骨干区域(非0则为常规区域;单区域必须为骨干区域哈) */
2、修改接口的cost值:
//修改接口的cost值(OSPF路由器在接口上使用cost值来决定最佳路径,cost=10^8/BW) Router(config-if)#ip ospf cost number //举例: Router(config)#inteface s0 Router(config-if)#ip ospf cost 1000 //取值范围1~65535
3、配置OSPF计时器:
//配置OSPF计时器(为了交换信息,相邻路由器必须有相同的hello和dead间隔,通常dead时间是hello时间的4倍) Router(config-if)#ip ospf hello-interval 时间(s) Router(config-if)#ip ospf dead-interval 时间(s)
4、Router ID的配置命令:
Router(config)#router ospf 进程号 //启用OSPF Router(config-router)#router-id IP_Address //指定Router-ID
5、OSPF汇总命令:
Router(config-router)#area 区域号 range 要汇总的IP 掩码
6、验证OSPF配置:
//验证OSPF配置: //查看邻居表 Router#show ip ospf neighbor //查看链路状态数据库 Router#show ip ospf database //查看路由表 Router#show ip route //查看OSPF的配置 Router#show ip ospf //查看OSPF接口数据结构 Router#show ip ospf interface 接口
Router#show ip ospf interface brief
//查看配置文件中有关OSPF的配置信息
Router#show running-config | s r o
mpls2# show ip ospf OSPF Routing Process, Router ID: 192.168.122.164 Supports only single TOS (TOS0) routes This implementation conforms to RFC2328 RFC1583Compatibility flag is disabled OpaqueCapability flag is disabled Initial SPF scheduling delay 0 millisec(s) Minimum hold time between consecutive SPFs 50 millisec(s) Maximum hold time between consecutive SPFs 5000 millisec(s) Hold time multiplier is currently 1 SPF algorithm last executed 4.165s ago Last SPF duration 129 usecs SPF timer is inactive LSA minimum interval 5000 msecs LSA minimum arrival 1000 msecs Write Multiplier set to 20 Refresh timer 10 secs This router is an ASBR (injecting external routing information) Number of external LSA 8. Checksum Sum 0x000230b6 Number of opaque AS LSA 0. Checksum Sum 0x00000000 Number of areas attached to this router: 1 Area ID: 0.0.0.0 (Backbone) Number of interfaces in this area: Total: 4, Active: 4 Number of fully adjacent neighbors in this area: 1 Area has no authentication SPF algorithm executed 16654 times Number of LSA 3 Number of router LSA 3. Checksum Sum 0x000101db Number of network LSA 0. Checksum Sum 0x00000000 Number of summary LSA 0. Checksum Sum 0x00000000 Number of ASBR summary LSA 0. Checksum Sum 0x00000000 Number of NSSA LSA 0. Checksum Sum 0x00000000 Number of opaque link LSA 0. Checksum Sum 0x00000000 Number of opaque area LSA 0. Checksum Sum 0x00000000 mpls2# show ip ospf interface brief No such interface name mpls2# show ip ospf interface enp1s0 brief % Unknown command: show ip ospf interface enp1s0 brief mpls2# show ip ospf interface enp1s0 json { "interfaces":{ "enp1s0":{ "ifUp":true, "ifIndex":2, "mtuBytes":1500, "bandwidthMbit":4294967295, "ifFlags":"<UP,BROADCAST,RUNNING,MULTICAST>", "ospfEnabled":true, "ipAddress":"192.168.123.164", "ipAddressPrefixlen":24, "ospfIfType":"Broadcast", "localIfUsed":"192.168.123.255", "area":"0.0.0.0", "routerId":"192.168.122.164", "networkType":"BROADCAST", "cost":1, "transmitDelaySecs":1, "state":"DR", "priority":1, "mcastMemberOspfAllRouters":true, "mcastMemberOspfDesignatedRouters":true, "timerMsecs":10000, "timerDeadSecs":40, "timerWaitSecs":40, "timerRetransmitSecs":5, "timerHelloInMsecs":7648, "nbrCount":0, "nbrAdjacentCount":0 } } } mpls2# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface RXmtL RqstL DBsmL 192.168.122.198 1 Full/DROther 36.806s 192.168.1.3 enp6s0:192.168.1.4 3 0 0 192.168.122.35 1 ExStart/DROther 36.238s 192.168.2.5 enp5s0:192.168.2.4 0 0 0 mpls2# show ip ospf database OSPF Router with ID (192.168.122.164) Router Link States (Area 0.0.0.0) Link ID ADV Router Age Seq# CkSum Link count 192.168.122.35 192.168.122.35 12 0x800038bf 0x7ac1 2 192.168.122.164 192.168.122.164 6 0x80006449 0xcae1 4 192.168.122.198 192.168.122.198 11 0x80002079 0x7543 3 AS External Link States Link ID ADV Router Age Seq# CkSum Route 172.19.2.0 192.168.122.35 1532 0x8000002b 0x5f6c E2 172.19.2.0/24 [0x0] 172.19.2.0 192.168.122.198 1057 0x8000002c 0x879f E2 172.19.2.0/24 [0x0] 192.168.1.3 192.168.122.164 1396 0x80000034 0x296c E2 192.168.1.3/32 [0x0] 192.168.1.4 192.168.122.198 1017 0x8000002d 0x6019 E2 192.168.1.4/32 [0x0] 192.168.2.4 192.168.122.35 872 0x8000002d 0x2bf0 E2 192.168.2.4/32 [0x0] 192.168.2.5 192.168.122.164 1516 0x80000034 0x0a88 E2 192.168.2.5/32 [0x0] 192.168.122.0 192.168.122.164 3600 0x80000026 0x2b02 E2 192.168.122.0/24 [0x0] 192.168.122.0 192.168.122.198 3600 0x80000026 0x5eac E2 192.168.122.0/24 [0x0] mpls2# show ip ospf route ============ OSPF network routing table ============ N 4.4.4.4/32 [10] area: 0.0.0.0 directly attached to lo1 N 192.168.123.0/24 [1] area: 0.0.0.0 directly attached to enp1s0 ============ OSPF router routing table ============= ============ OSPF external routing table =========== mpls2# show ip ospf route
标签:sum ref nss res imp log pat nal spfa
原文地址:https://www.cnblogs.com/dream397/p/13409862.html