怎么在路由器上作动态路由OSPF,实现三个网段间的主机互相ping通!!!主要说一下配置命令和网络如何搭建

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了怎么在路由器上作动态路由OSPF,实现三个网段间的主机互相ping通!!!主要说一下配置命令和网络如何搭建相关的知识,希望对你有一定的参考价值。

补充一下 需要哪些设备及接口如何连接 呵呵最好说的详细一点!!谢啦!!

cisco 路由器或三层交换机上均可配置 

下面是思科三层交换机(35系列)的详细配置

SW1 配置

sW1(config)#do sh run

Building configuration...

Current configuration : 1429 bytes

!

version 12.4

service timestamps debug datetime msec

service timestamps log datetime msec

no service password-encryption

!

hostname sW1

!

boot-start-marker

boot-end-marker

!

!

no aaa new-model

memory-size iomem 5

!

!

ip cef

no ip domain lookup

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

interface Loopback0

ip address 172.18.254.20 255.255.255.0

!

interface FastEthernet0/0

no switchport

ip address 192.168.1.2 255.255.255.0

!

interface FastEthernet0/1

no switchport

ip address 172.18.252.1 255.255.255.252

!

interface FastEthernet0/2

no switchport

no ip address

shutdown

!

interface FastEthernet0/3

no switchport

ip address 172.18.252.5 255.255.255.252

!

interface FastEthernet0/4

!

interface FastEthernet0/5

!

interface FastEthernet0/6

!

interface FastEthernet0/7

!

interface FastEthernet0/8

!

interface FastEthernet0/9

!

interface FastEthernet0/10

!

interface FastEthernet0/11

!

interface FastEthernet0/12

!

interface FastEthernet0/13

!

interface FastEthernet0/14

!

interface FastEthernet0/15

!

interface Vlan1

no ip address

!

router ospf 7

router-id 172.18.254.20

log-adjacency-changes

network 172.18.252.0 0.0.0.3 area 0

network 172.18.252.4 0.0.0.3 area 0

network 172.18.254.0 0.0.0.255 area 0

default-information originate

!

ip http server

ip route 0.0.0.0 0.0.0.0 192.168.1.1

!

!

!

!

!

!

control-plane

!

!

!

!

!

!

!

!

!

line con 0

exec-timeout 0 0

logging synchronous

line aux 0

line vty 0 4

login

!

!

end

SW2 配置

SW2#sh run

Building configuration...

Current configuration : 1739 bytes

!

version 12.4

service timestamps debug datetime msec

service timestamps log datetime msec

no service password-encryption

!

hostname SW2

!

boot-start-marker

boot-end-marker

!

!

no aaa new-model

memory-size iomem 5

!

!

ip cef

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

interface Loopback0

ip address 172.18.254.30 255.255.255.0

!

interface FastEthernet0/0

!

interface FastEthernet0/1

no switchport

ip address 172.18.252.2 255.255.255.252

!

interface FastEthernet0/2

!

interface FastEthernet0/3

!

interface FastEthernet0/4

switchport mode trunk

!

interface FastEthernet0/5

!

interface FastEthernet0/6

!

interface FastEthernet0/7

!

interface FastEthernet0/8

!

interface FastEthernet0/9

!

interface FastEthernet0/10

!

interface FastEthernet0/11

!

interface FastEthernet0/12

!

interface FastEthernet0/13

!

interface FastEthernet0/14

!

interface FastEthernet0/15

!

interface Vlan1

no ip address

!

interface Vlan110

ip address 172.18.110.254 255.255.255.0

!

interface Vlan111

ip address 172.18.111.254 255.255.255.0

!

interface Vlan112

ip address 172.18.112.254 255.255.255.0

!

interface Vlan113

ip address 172.18.113.254 255.255.255.0

!

interface Vlan114

ip address 172.18.114.254 255.255.255.0

!

interface Vlan115

ip address 172.18.115.254 255.255.255.0

!

router ospf 7

router-id 172.18.254.30

log-adjacency-changes

network 172.18.110.0 0.0.0.255 area 1

network 172.18.111.0 0.0.0.255 area 1

network 172.18.112.0 0.0.0.255 area 1

network 172.18.113.0 0.0.0.255 area 1

network 172.18.114.0 0.0.0.255 area 1

network 172.18.115.0 0.0.0.255 area 1

network 172.18.252.0 0.0.0.3 area 0

network 172.18.254.0 0.0.0.255 area 0

!

ip http server

!

!

!

!

!

!

control-plane

!

!

!

!

!

!

!

!

!

line con 0

line aux 0

line vty 0 4

login

!

!

end

SW3 配置

sw3#sh run

Building configuration...

Current configuration : 1385 bytes

!

version 12.4

service timestamps debug datetime msec

service timestamps log datetime msec

no service password-encryption

!

hostname sw3

!

boot-start-marker

boot-end-marker

!

!

no aaa new-model

memory-size iomem 5

!

!

ip cef

no ip domain lookup

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

interface Loopback0

ip address 172.18.254.40 255.255.255.0

!

interface FastEthernet0/0

!

interface FastEthernet0/1

no switchport

ip address 172.18.252.6 255.255.255.252

!

interface FastEthernet0/2

!

interface FastEthernet0/3

switchport access vlan 120

!

interface FastEthernet0/4

switchport access vlan 121

!

interface FastEthernet0/5

!

interface FastEthernet0/6

!

interface FastEthernet0/7

!

interface FastEthernet0/8

!

interface FastEthernet0/9

!

interface FastEthernet0/10

!

interface FastEthernet0/11

!

interface FastEthernet0/12

!

interface FastEthernet0/13

!

interface FastEthernet0/14

!

interface FastEthernet0/15

!

interface Vlan1

no ip address

!

interface Vlan120

ip address 172.18.120.254 255.255.255.0

!

interface Vlan121

ip address 172.18.121.254 255.255.255.0

!

router ospf 7

router-id 172.18.254.40

log-adjacency-changes

network 172.18.120.0 0.0.0.255 area 2

network 172.18.121.0 0.0.0.255 area 2

network 172.18.252.4 0.0.0.3 area 0

network 172.18.254.0 0.0.0.255 area 0

!

ip http server

!

!

!

!

!

!

control-plane

!

!

!

!

!

!

!

!

!

line con 0

line aux 0

line vty 0 4

!

!

end

参考资料:http://hi.baidu.com/zhentao_cn/blog/item/b96ca40a3d2aad1195ca6baf.html

参考技术A 需要高端路由器3个

动态路由——OSPF高级配置 实验篇

搭建OSPF高级配置实验

搭建拓扑图

GNS 3中拓扑区域添加6台路由设别,其中一台R6路由设备作为网络运营商提供的网络设备路由,在R3路由设备中添加两块单口业务单板,分别用于连接外部网络路由与PC机;添加四台PC机与路由设备连接,其中PC3作为网络运营商的服务器设备,与R3路由设备相连。其中划分三个区域area 0area 2RIP;分别路由设备与PC接口处标注网段信息,如图所示:

技术图片技术图片

网段划分:

  • 192.168.10.0/24
  • 192.168.20.0/24
  • 192.168.30.0/24
  • 192.168.40.0/24
  • 192.168.50.0/24
  • 192.168.60.0/24
  • 192.168.70.0/24
  • 12.0.0.0/24
  • 13.0.0.0/24

Router ID 划分:

  • R22.2.2.2
  • R33.3.3.3
  • R44.4.4.4

搭建实验

1、首先在R1路由设备中添加网段地址,并设置将R1路由设备配置为默认路由。

R1#conf t                           //进入全局配置模式
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int f0/0                 //进入f0/0接口
R1(config-if)#ip add 192.168.10.1 255.255.255.0   //添加IP地址
R1(config-if)#no shut               //开启接口
R1(config-if)#
*Mar  1 00:01:10.451: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:01:11.451: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config-if)#int f0/1              //进入f0/1接口
R1(config-if)#ip add 192.168.20.1 255.255.255.0      //添加IP地址
R1(config-if)#no shut               //开启接口
R1(config-if)#
*Mar  1 00:01:44.735: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:01:45.735: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R1(config-if)#exit                    //退出接口模式
R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.20.2   //配置默认路由
R1(config)#do show ip route           //查看路由表    
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is 192.168.20.2 to network 0.0.0.0

C    192.168.10.0/24 is directly connected, FastEthernet0/0
C    192.168.20.0/24 is directly connected, FastEthernet0/1
S*   0.0.0.0/0 [1/0] via 192.168.20.2                    //配置成功

2、进入R2路由设备,配置接口地址,启动OSPF协议,设置宣告Router ID、网段信息;设置静态路由用于连接默认路由网段,最后在OSPF协议中注入直连网段信息与静态相连的默认路由网段信息。

R2#conf t                       //进入全局配置模式
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#int f0/0              //进入f0/0接口
R2(config-if)#ip add 192.168.30.1 255.255.255.0    //添加IP地址
R2(config-if)#no shut            //开启接口
R2(config-if)#
*Mar  1 00:11:10.515: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:11:11.515: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R2(config-if)#int f0/1             //进入f0/1接口
R2(config-if)#ip add 192.168.20.2 255.255.255.0   //添加IP地址
R2(config-if)#no shut            //开启接口
R2(config-if)#
*Mar  1 00:11:49.983: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:11:50.983: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R2(config-if)#exit
R2(config)#router ospf 1         //开启ospf协议,进程号为1
R2(config-router)#router-id 2.2.2.2     //设置并宣告Router ID
R2(config-router)#network 192.168.30.0 0.0.0.255 area 1    //在area 1区域中宣告网段信息
R2(config-router)#exit                //退出ospf协议
R2(config)#ip route 192.168.10.0 255.255.255.0 192.168.20.1   //配置静态路由信息
R2(config)#router ospf 1          //进入ospf协议
R2(config-router)#redistribute connected subnets     //注入直连网段信息
R2(config-router)#redistribute static subnets         //注入默认路由网段信息
R2(config-router)#ex                                   //退出协议
R2(config)#do show ip route           //查看路由表信息
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.30.0/24 is directly connected, FastEthernet0/0
S    192.168.10.0/24 [1/0] via 192.168.20.1                     //成功添加网段信息
C    192.168.20.0/24 is directly connected, FastEthernet0/1

3、在R3路由设备中配置接口IP地址;配置默认路由连接外部网段;开启OSPF协议,设置Router ID,并在区域中宣告网段,注入设置的外部默认路由网段信息。

R3#conf t                        //进入全局配置模式
Enter configuration commands, one per line.  End with CNTL/Z.
R3(config)#int f0/0               //进入f0/0接口
R3(config-if)#ip add 192.168.30.2 255.255.255.0      //添加IP地址
R3(config-if)#no shut              //开启接口
R3(config-if)#
*Mar  1 00:42:41.963: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:42:42.963: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R3(config-if)#int f0/1            //进入f0/1接口
R3(config-if)#ip add 192.168.40.1 255.255.255.0        //添加IP地址
R3(config-if)#no shut            //开启接口
R3(config-if)#
*Mar  1 00:43:23.963: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:43:24.963: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R3(config-if)#int f1/0             //进入f1/0接口
R3(config-if)#ip add 12.0.0.1 255.255.255.0            //添加IP地址
R3(config-if)#no shut               //开启接口
R3(config-if)#
*Mar  1 00:44:01.631: %LINK-3-UPDOWN: Interface FastEthernet1/0, changed state to up
*Mar  1 00:44:02.631: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up
R3(config-if)#int f2/0               //进入f2/0接口
R3(config-if)#ip add 192.168.70.1 255.255.255.0             //添加IP地址
R3(config-if)#no shut               //开启接口
R3(config-if)#
*Mar  1 00:44:41.015: %LINK-3-UPDOWN: Interface FastEthernet2/0, changed state to up
*Mar  1 00:44:42.015: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet2/0, changed state to up
R3(config-if)#do show ip int b       //查看接口信息
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.30.2    YES manual up                    up      
FastEthernet0/1            192.168.40.1    YES manual up                    up      
FastEthernet1/0            12.0.0.1        YES manual up                    up      
FastEthernet2/0            192.168.70.1    YES manual up                    up        //成功添加网段 
R3(config)#ip route 0.0.0.0 0.0.0.0 12.0.0.2          //配置默认路由,连接外部网段
R3(config)#router ospf 1                               //开启ospf协议,进程号为1
R3(config-router)#router-id 3.3.3.3                   //设置宣告Router ID
R3(config-router)#network 192.168.30.0 0.0.0.255 area 1   //在area 1区域中宣告网段信息,注意子网掩码写反码
R3(config-router)#
*Mar  1 00:47:50.531: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0 from LOADING to FULL, Loading Done
R3(config-router)#network 192.168.40.0 0.0.0.255 area 0    //在area 0区域中宣告网段信息,注意子网掩码写反码
R3(config-router)#network 192.168.70.0 0.0.0.255 area 0
R3(config-router)#default-information originate          //将外部路由网段注入ospf协议中
R3(config-router)#ex                                     //退出
R3(config)#do show ip route                              //查看路由表
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is 12.0.0.2 to network 0.0.0.0

C    192.168.30.0/24 is directly connected, FastEthernet0/0
O E2 192.168.10.0/24 [110/20] via 192.168.30.1, 00:01:21, FastEthernet0/0
C    192.168.40.0/24 is directly connected, FastEthernet0/1
O E2 192.168.20.0/24 [110/20] via 192.168.30.1, 00:01:21, FastEthernet0/0
     12.0.0.0/24 is subnetted, 1 subnets
C       12.0.0.0 is directly connected, FastEthernet1/0
C    192.168.70.0/24 is directly connected, FastEthernet2/0
S*   0.0.0.0/0 [1/0] via 12.0.0.2                                  //成功添加网段

4、在R4路由设备添加接口IP地址,启用RIP协议,启用版本2,关闭路由自动汇总功能,宣告网段信息,最后注入OSPF协议,设置跳数为5;启用OSPF协议,设置Router ID,并在区域中宣告网段,注入RIP协议。

R4#conf t                       //进入全局配置模式
Enter configuration commands, one per line.  End with CNTL/Z.
R4(config)#int f0/0              //进入f0/0接口
R4(config-if)#ip add 192.168.40.2 255.255.255.0       //添加IP地址
R4(config-if)#no shut             //开启接口
R4(config-if)# 
*Mar  1 01:03:22.375: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 01:03:23.375: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R4(config-if)#int f0/1              //进入f0/1接口
R4(config-if)#ip add 192.168.50.1 255.255.255.0           //添加IP地址
R4(config-if)#no shut             //开启接口
R4(config-if)#
*Mar  1 01:03:57.519: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 01:03:58.519: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R4(config-if)#ex             //退出接口模式
R4(config)#router rip         //启用RIP协议
R4(config-router)#version 2    //启用版本2
R4(config-router)#no auto-summary      //关闭路由自动汇总功能
R4(config-router)#network 192.168.50.0        //宣告网段    
R4(config-router)#redistribute ospf 1 metric 5   //注入ospf协议,设置条数为5
R4(config-router)#ex                             //退出
R4(config)#router ospf 1             //开启ospf协议,进程号为1
R4(config-router)#router-id 4.4.4.4    //设置宣告Router ID
R4(config-router)#network 192.168.40.0 0.0.0.255 area 0  //在area 0区域中宣告网段信息,注意子网掩码写反码
R4(config-router)#
*Mar  1 01:10:09.027: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on FastEthernet0/0 from LOADING to FULL, Loading Done
R4(config-router)#redistribute rip subnets    //注入RIP协议
R4(config-router)#ex                          //退出
R4(config)#do show ip route                   //查看路由表
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is 192.168.40.1 to network 0.0.0.0

O IA 192.168.30.0/24 [110/20] via 192.168.40.1, 00:01:30, FastEthernet0/0
O E2 192.168.10.0/24 [110/20] via 192.168.40.1, 00:01:30, FastEthernet0/0
C    192.168.40.0/24 is directly connected, FastEthernet0/0
O E2 192.168.20.0/24 [110/20] via 192.168.40.1, 00:01:30, FastEthernet0/0
C    192.168.50.0/24 is directly connected, FastEthernet0/1
O    192.168.70.0/24 [110/11] via 192.168.40.1, 00:01:30, FastEthernet0/0
O*E2 0.0.0.0/0 [110/1] via 192.168.40.1, 00:01:30, FastEthernet0/0          //成功学习网段信息

5、在R5路由设备中添加接口IP地址,启用RIP协议,并关闭自动汇总功能,宣告两个网段。

R5#conf t                    //进入全局配置模式
Enter configuration commands, one per line.  End with CNTL/Z.
R5(config)#int f0/0            //进入f0/0接口
R5(config-if)#ip add 192.168.50.2 255.255.255.0    //添加IP地址
R5(config-if)#no shut          //开启接口
R5(config-if)#
*Mar  1 01:27:42.539: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 01:27:43.539: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R5(config-if)#int f0/1         //进入接口f0/1
R5(config-if)#ip add 192.168.60.1 255.255.255.0  //添加IP地址
R5(config-if)#no shut           //开启接口
R5(config-if)#
*Mar  1 01:28:17.635: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 01:28:18.635: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R5(config-if)#router rip         //启用RIP协议
R5(config-router)#version 2       //启用版本2
R5(config-router)#no auto-summary  //关闭自动汇总功能
R5(config-router)#network 192.168.50.0    //宣告网段信息
R5(config-router)#network 192.168.60.0
R5(config-router)#ex                  //退出
R5(config)#do show ip route             //查看路由表
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is 192.168.50.1 to network 0.0.0.0

R    192.168.30.0/24 [120/5] via 192.168.50.1, 00:00:25, FastEthernet0/0
C    192.168.60.0/24 is directly connected, FastEthernet0/1
R    192.168.10.0/24 [120/5] via 192.168.50.1, 00:00:25, FastEthernet0/0
R    192.168.40.0/24 [120/5] via 192.168.50.1, 00:00:25, FastEthernet0/0
R    192.168.20.0/24 [120/5] via 192.168.50.1, 00:00:25, FastEthernet0/0
C    192.168.50.0/24 is directly connected, FastEthernet0/0
R    192.168.70.0/24 [120/5] via 192.168.50.1, 00:00:25, FastEthernet0/0
R*   0.0.0.0/0 [120/1] via 192.168.50.1, 00:00:26, FastEthernet0/0       //成功学习网段信息

6、在R6路由设备中添加接口IP地址,然后配置静态路由。

R6#conf t                  //进入全局配置模式
Enter configuration commands, one per line.  End with CNTL/Z.
R6(config)#int f0/0        //进入f0/0接口
R6(config-if)#ip add 12.0.0.2 255.255.255.0      //添加IP地址
R6(config-if)#no shut      //开启接口
R6(config-if)#
*Mar  1 01:36:54.323: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 01:36:55.323: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R6(config-if)#int f0/1      //进入接口f0/1
R6(config-if)#ip add 13.0.0.1 255.255.255.0     //添加IP地址
R6(config-if)#no shut         //开启接口
R6(config-if)#
*Mar  1 01:37:26.223: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 01:37:27.223: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R6(config-if)#ex            //退出模式
R6(config)#ip route 192.168.0.0 255.255.0.0 12.0.0.1     //设置静态路由
R6(config)#do show ip route           //查看路由表
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     12.0.0.0/24 is subnetted, 1 subnets
C       12.0.0.0 is directly connected, FastEthernet0/0
     13.0.0.0/24 is subnetted, 1 subnets
C       13.0.0.0 is directly connected, FastEthernet0/1
S    192.168.0.0/16 [1/0] via 12.0.0.1                       //网段添加成功

7、分别在PC机中添加IP地址,并测试网络互通性。

PC1> ip 192.168.10.2 192.168.10.1      //添加IP地址
Checking for duplicate address...
PC1 : 192.168.10.2 255.255.255.0 gateway 192.168.10.1
PC2> ip 192.168.70.2 192.168.70.1      //添加IP地址
Checking for duplicate address...
PC1 : 192.168.70.2 255.255.255.0 gateway 192.168.70.1
PC3> ip 13.0.0.2 13.0.0.1             //添加IP地址
Checking for duplicate address...
PC1 : 13.0.0.2 255.255.255.0 gateway 13.0.0.1
P4> ip 192.168.60.2 192.168.60.1      //添加IP地址
Checking for duplicate address...
PC1 : 192.168.60.2 255.255.255.0 gateway 192.168.60.1
PC1> ping 192.168.70.2                //测试PC1与PC2的互通性
192.168.70.2 icmp_seq=1 timeout
192.168.70.2 icmp_seq=2 timeout
84 bytes from 192.168.70.2 icmp_seq=3 ttl=61 time=53.853 ms
84 bytes from 192.168.70.2 icmp_seq=4 ttl=61 time=60.168 ms
84 bytes from 192.168.70.2 icmp_seq=5 ttl=61 time=57.781 ms    //成功通信

PC1> ping 13.0.0.2                   //测试PC1与PC3的互通性
13.0.0.2 icmp_seq=1 timeout
13.0.0.2 icmp_seq=2 timeout
84 bytes from 13.0.0.2 icmp_seq=3 ttl=60 time=76.872 ms
84 bytes from 13.0.0.2 icmp_seq=4 ttl=60 time=83.919 ms
84 bytes from 13.0.0.2 icmp_seq=5 ttl=60 time=77.712 ms    //成功通信

PC1> ping 192.168.60.2              //测试PC1与P4的互通性
192.168.60.2 icmp_seq=1 timeout
84 bytes from 192.168.60.2 icmp_seq=2 ttl=59 time=97.596 ms
84 bytes from 192.168.60.2 icmp_seq=3 ttl=59 time=97.688 ms
84 bytes from 192.168.60.2 icmp_seq=4 ttl=59 time=99.732 ms
84 bytes from 192.168.60.2 icmp_seq=5 ttl=59 time=103.440 ms    //成功通信
PC2> ping 13.0.0.2               //测试PC2与PC3的互通性    
13.0.0.2 icmp_seq=1 timeout
13.0.0.2 icmp_seq=2 timeout
84 bytes from 13.0.0.2 icmp_seq=3 ttl=62 time=38.042 ms
84 bytes from 13.0.0.2 icmp_seq=4 ttl=62 time=37.842 ms
84 bytes from 13.0.0.2 icmp_seq=5 ttl=62 time=40.034 ms    //成功通信

PC2> ping 192.168.60.2            //测试PC2与P4的互通性
192.168.60.2 icmp_seq=1 timeout
192.168.60.2 icmp_seq=2 timeout
84 bytes from 192.168.60.2 icmp_seq=3 ttl=61 time=56.783 ms
84 bytes from 192.168.60.2 icmp_seq=4 ttl=61 time=63.372 ms
84 bytes from 192.168.60.2 icmp_seq=5 ttl=61 time=53.795 ms    //成功通信
PC3> ping 192.168.60.2            //测试PC3与P4的互通性
84 bytes from 192.168.60.2 icmp_seq=1 ttl=60 time=78.788 ms
84 bytes from 192.168.60.2 icmp_seq=2 ttl=60 time=79.786 ms
84 bytes from 192.168.60.2 icmp_seq=3 ttl=60 time=87.773 ms
84 bytes from 192.168.60.2 icmp_seq=4 ttl=60 time=84.850 ms
84 bytes from 192.168.60.2 icmp_seq=5 ttl=60 time=84.778 ms    //成功通信

以上是关于怎么在路由器上作动态路由OSPF,实现三个网段间的主机互相ping通!!!主要说一下配置命令和网络如何搭建的主要内容,如果未能解决你的问题,请参考以下文章

动态路由——OSPF高级配置 实验篇

vue-router怎么动态配置,比如根据用户权限不同显示路由

两台三层交换机单区域OSPF动态路由实验

OSPF路由控制

动态路由之OSPF和RIP协议实现全网互连互通

使用OSPF与RIP动态路由协议实现全网互连互通