A 步骤一(基本配置):

  R1上的命令:

  en

  config terminal

  hostname R1

  interface fastethernet0/0

  ip address 192.168.0.254 255.255.255.0

  no shutdown

  interface serial1/0

  ip address 10.0.0.1 255.0.0.0

  clock rate 72000

  no shutdown

  R2上的命令:

  en

  config terminal

  hostname R1

  interface fasterethernet0/0

  ip address 192.168.1.254 255.255.255.0

  no shutdown

  interface serial1/0

  ip address 10.0.0.2 255.0.0.0

  clock rate 72000

  no shutdown

  步骤二(动态路由OSPF配置):

  注意哦:R1和R2动态路由OSPF配置要在全局模式下(config)#

  R1上的命令:

  R1(config)#route ospf 10

  R1(config-router)#network 192.168.0.0 0.0.0.255 area 0

  R1(config-router)#network 10.0.0.0 0.255.255.255 area 0

  end

  write

  R2上的命令:

  Router(config)#route ospf 10

  Router(config-router)#network 192.168.1.0 0.0.0.255 area 0

  Router(config-router)#network 10.0.0.0 0.255.255.255 area 0

  end

  write

  步骤三(pc的配置):

  pc1的IP 设为192.168.0.1 255.255.255.0

  pc2的IP 设为192.168.1.1 255.255.255.0

  我想这个我不用说了吧!!!

  B 查看路由配置 用show ip route

  R1上显示:

  R1#show ip route

  Codes: C - connected, S - static, I - IGRP, 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, E - EGP

  i - IS-IS, 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    10.0.0.0/8 is directly connected, Serial1/0

  C    192.168.0.0/24 is directly connected, FastEthernet0/0

  O    192.168.1.0/24 [110/782] via 10.0.0.2, 00:00:29, Serial1/0

  R2上显示:

  R1#show ip route

  Codes: C - connected, S - static, I - IGRP, 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, E - EGP

  i - IS-IS, 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    10.0.0.0/8 is directly connected, Serial1/0

  C    192.168.0.0/24 is directly connected, FastEthernet0/0

  O    192.168.1.0/24 [110/782] via 10.0.0.2, 00:00:29, Serial1/0

  C 用PC1机器去PING pc2能通则静态路由配置成功.

 

-END-

 

PS:本文收集于百度空间