1。每台设备上配置接口以及环回口地址: R1: interfaceGigabitEthernet000 ipaddress10。0。12。1255。255。255。0 interfaceGigabitEthernet001 ipaddress10。0。13。1255。255。255。0 interfaceLoopBack0 ipaddress10。0。1。1255。255。255。255 R2: interfaceGigabitEthernet000 ipaddress10。0。12。2255。255。255。0 interfaceGigabitEthernet002 ipaddress10。0。23。2255。255。255。0 interfaceLoopBack0 ipaddress10。0。2。2255。255。255。255 R3: interfaceGigabitEthernet000 ipaddress10。0。34。3255。255。255。0 interfaceGigabitEthernet001 ipaddress10。0。13。3255。255。255。0 interfaceGigabitEthernet002 ipaddress10。0。23。3255。255。255。0 interfaceLoopBack0 ipaddress10。0。3。3255。255。255。255 R4: interfaceGigabitEthernet000 ipaddress10。0。34。4255。255。255。0 interfaceLoopBack0 ipaddress10。0。4。4255。255。255。255 2。每台设备上配置ospf协议,并划好区域: R1: ospf1routerid10。0。1。1 area0。0。0。0 network10。0。12。00。0。0。255 network10。0。1。10。0。0。0 area0。0。0。1 network10。0。13。00。0。0。255 R2: ospf1routerid10。0。2。2 area0。0。0。0 network10。0。2。20。0。0。0 network10。0。12。00。0。0。255 area0。0。0。1 network10。0。23。00。0。0。255 R3: ospf1routerid10。0。3。3 area0。0。0。1 network10。0。3。30。0。0。0 network10。0。23。00。0。0。255 network10。0。13。00。0。0。255 area0。0。0。2 network10。0。34。00。0。0。255 R4: ospf1routerid10。0。4。4 area0。0。0。2 network10。0。4。40。0。0。0 network10。0。34。00。0。0。255 3。使用虚链路使区域2与区域逻辑相连: R1: ospf1 area0。0。0。1 vlinkpeer10。0。3。3 R2: ospf1 area0。0。0。1 vlinkpeer10。0。3。3 R3: ospf1 area0。0。0。1 vlinkpeer10。0。2。2 vlinkpeer10。0。1。1 此时R1、R2能ping通R4 〔R1〕ping10。0。4。4 PING10。0。4。4:56databytes,pressCTRLCtobreak Replyfrom10。0。4。4:bytes56Sequence1ttl254time40ms Replyfrom10。0。4。4:bytes56Sequence2ttl254time40ms 4。优先使用路径R4R3R1,并以R4R3R2路径为备份路径: R3: interfaceGigabitEthernet002 ospfcost10 R2: interfaceGigabitEthernet002 ospfcost10 5。使用虚链路作为区域0链路的冗余备份 目前,R1与R2之间只有单条链路连接,如果出现链路故障,就会导致区域0被分割的问题。为了解决这一问题,增强网络的可靠性,可以以区域1为传输区域,在R1与R2之间建立条虚链路作为冗余备份。 R1: ospf1 area0。0。0。1 vlinkpeer10。0。1。1 R2: ospf1 area0。0。0。1 vlinkpeer10。0。2。2 6。配置虚链路的认证功能 R1: ospf1 area0。0。0。1 vlinkpeer10。0。3。3hmacmd51plainhuawei vlinkpeer10。0。2。2hmacmd51plainhuawei R2: ospf1 area0。0。0。1 vlinkpeer10。0。1。1hmacmd51plainhuawei vlinkpeer10。0。3。3hmacmd51plainhuawei R3: ospf1 area0。0。0。1 vlinkpeer10。0。1。1hmacmd51plainhuawei vlinkpeer10。0。2。2hmacmd51plainhuawei 最终配置: R1: sysnameR1 interfaceGigabitEthernet000 ipaddress10。0。12。1255。255。255。0 interfaceGigabitEthernet001 ipaddress10。0。13。1255。255。255。0 interfaceLoopBack0 ipaddress10。0。1。1255。255。255。255 ospf1routerid10。0。1。1 area0。0。0。0 network10。0。12。00。0。0。255 network10。0。1。10。0。0。0 area0。0。0。1 network10。0。13。00。0。0。255 vlinkpeer10。0。3。3hmacmd51plainhuawei vlinkpeer10。0。2。2hmacmd51plainhuawei R2: sysnameR2 interfaceGigabitEthernet000 ipaddress10。0。12。2255。255。255。0 interfaceGigabitEthernet002 ipaddress10。0。23。2255。255。255。0 ospfcost10 interfaceLoopBack0 ipaddress10。0。2。2255。255。255。255 ospf1routerid10。0。2。2 area0。0。0。0 network10。0。2。20。0。0。0 network10。0。12。00。0。0。255 area0。0。0。1 network10。0。23。00。0。0。255 vlinkpeer10。0。1。1hmacmd51plainhuawei vlinkpeer10。0。3。3hmacmd51plainhuawei R3: sysnameR3 interfaceGigabitEthernet000 ipaddress10。0。34。3255。255。255。0 interfaceGigabitEthernet001 ipaddress10。0。13。3255。255。255。0 interfaceGigabitEthernet002 ipaddress10。0。23。3255。255。255。0 ospfcost10 interfaceLoopBack0 ipaddress10。0。3。3255。255。255。255 ospf1routerid10。0。3。3 area0。0。0。1 network10。0。3。30。0。0。0 network10。0。23。00。0。0。255 network10。0。13。00。0。0。255 vlinkpeer10。0。1。1hmacmd51plainhuawei vlinkpeer10。0。2。2hmacmd51plainhuawei area0。0。0。2 network10。0。34。00。0。0。255 R4: sysnameR4 interfaceGigabitEthernet000 ipaddress10。0。34。4255。255。255。0 interfaceLoopBack0 ipaddress10。0。4。4255。255。255。255 ospf1routerid10。0。4。4 area0。0。0。2 network10。0。4。40。0。0。0 network10。0。34。00。0。0。255