IP实验3:静态路由和动态路由配置

IP实验3:静态路由和动态路由配置

文章目录

  • IP实验3:静态路由和动态路由配置
    • 静态路由
      • 实验环境
        • 1.按照实验原理图配置好网络拓扑结构。
        • 2.设置PC和路由的IP和接口并设置环回口用于测试。
          • 路由接口及环回口设置:
          • 静态路由配置:
        • 3.测试连通性并分析
    • 动态路由
      • 实验环境:
      • 实验步骤
        • 配置动态路由
      • 结果测试分析
    • 实验总结

静态路由

实验环境

IP实验3:静态路由和动态路由配置_第1张图片

1.按照实验原理图配置好网络拓扑结构。
2.设置PC和路由的IP和接口并设置环回口用于测试。

IP实验3:静态路由和动态路由配置_第2张图片
IP实验3:静态路由和动态路由配置_第3张图片
IP实验3:静态路由和动态路由配置_第4张图片

路由接口及环回口设置:

R1:

sy 
[Huawei]sy R1
[R1]interface g0/0/0 
[R1-GigabitEthernet0/0/0]ip add 10.1.12.1 24 
[R1-GigabitEthernet0/0/0]interface g0/0/1 
[R1-GigabitEthernet0/0/1]ip add 192.168.1.254 24
[R1]int lo 0
[R1-LoopBack0]ip add 1.1.1.1 32

R2:

sy 
[Huawei]sy R2
[R2]interface g0/0/0
[R2-GigabitEthernet0/0/0]ip add 10.1.12.2 24
[R2]interface g0/0/1
[R2-GigabitEthernet0/0/1]ip add 10.1.23.2 24
[R2]interface g0/0/2
[R2-GigabitEthernet0/0/0]ip add 10.1.32.2 24
[R2]interface g4/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.2.254 24
[R2]int lo 1
[R2-LoopBack1]ip add 2.2.2.2 32

R3:

sy 
[Huawei]sy R3
[R3]interface g0/0/0
[R3-GigabitEthernet0/0/0]ip add 10.1.23.3 24
[R3]interface g0/0/1
[R3-GigabitEthernet0/0/0]ip add 10.1.32.3 24
[R3]interface g0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.3.254 24
[R3]int lo 1
[R3-LoopBack3]ip add 3.3.3.3 32
静态路由配置:

PC1:

[R1]ip route-static 2.2.2.2 32 g0/0/0 10.1.12.2
[R1]ip route-static 3.3.3.3 32 g0/0/0 10.1.12.2
[R1]ip route-static 192.168.2.0 24 10.1.12.2
[R1]ip route-static 192.168.3.0 24 10.1.23.3
[R1]ip route-static 192.168.3.0 24 10.1.32.3

PC2:

[R2]ip route-static 1.1.1.1 32 g0/0/0 10.1.12.1
[R2]ip route-static 3.3.3.3 32 g0/0/0 10.1.23.3
[R2]ip route-static 3.3.3.3 32 g0/0/0 10.1.32.3
[R2]ip route-static 192.168.1.0 24 10.1.12.1
[R2]ip route-static 192.168.3.0 24 10.1.23.3
[R2]ip route-static 192.168.3.0 24 10.1.32.3

PC3:

[R3]ip route-static 1.1.1.1 32 g0/0/0 10.1.23.2
[R3]ip route-static 1.1.1.1 32 g0/0/1 10.1.32.2
[R3]ip route-static 2.2.2.2 32 g0/0/0 10.1.23.2
[R3]ip route-static 2.2.2.2 32 g0/0/1 10.1.32.2
[R3]ip route-static 192.168.2.0 24 10.1.23.2
[R3]ip route-static 192.168.2.0 24 10.1.32.2
[R3]ip route-static 192.168.1.0 24 10.1.23.2
[R3]ip route-static 192.168.1.0 24 10.1.32.2
3.测试连通性并分析

R1、R2、R3之间:

ping 2.2.2.2
  PING 2.2.2.2: 56  data bytes, press CTRL_C to break
    Reply from 2.2.2.2: bytes=56 Sequence=1 ttl=255 time=60 ms
    Reply from 2.2.2.2: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 2.2.2.2: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 2.2.2.2: bytes=56 Sequence=4 ttl=255 time=40 ms
    Reply from 2.2.2.2: bytes=56 Sequence=5 ttl=255 time=20 ms

  --- 2.2.2.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/32/60 ms
ping -a 1.1.1.1 3.3.3.3
  PING 3.3.3.3: 56  data bytes, press CTRL_C to break
    Reply from 3.3.3.3: bytes=56 Sequence=1 ttl=254 time=70 ms
    Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=254 time=30 ms
    Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=254 time=40 ms
    Reply from 3.3.3.3: bytes=56 Sequence=4 ttl=254 time=30 ms
    Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=254 time=30 ms

  --- 3.3.3.3 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 30/40/70 ms

表明三台路由器已连通。

PC1、PC2、PC3之间:

PC>ping 192.168.2.1

Ping 192.168.2.1: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.2.1: bytes=32 seq=2 ttl=126 time=31 ms
From 192.168.2.1: bytes=32 seq=3 ttl=126 time=16 ms
From 192.168.2.1: bytes=32 seq=4 ttl=126 time=16 ms
From 192.168.2.1: bytes=32 seq=5 ttl=126 time=31 ms

--- 192.168.2.1 ping statistics ---
  5 packet(s) transmitted
  4 packet(s) received
  20.00% packet loss
  round-trip min/avg/max = 0/23/31 ms
PC>ping 192.168.3.1

Ping 192.168.3.1: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.3.1: bytes=32 seq=2 ttl=125 time=16 ms
From 192.168.3.1: bytes=32 seq=3 ttl=125 time=31 ms
From 192.168.3.1: bytes=32 seq=4 ttl=125 time=31 ms
From 192.168.3.1: bytes=32 seq=5 ttl=125 time=32 ms

--- 192.168.3.1 ping statistics ---
  5 packet(s) transmitted
  4 packet(s) received
  20.00% packet loss
  round-trip min/avg/max = 0/27/32 ms

表明PC1、PC2、PC3之间也已经互通。

所以实现了全网互通。

动态路由

实验环境:

IP实验3:静态路由和动态路由配置_第5张图片

实验步骤

配置动态路由

R1:

[R1]ospf 1 
[R1-ospf-1]area 0 
[R1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255 
[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0 
[R1-ospf-1-area-0.0.0.0]network 10.1.12.0 0.0.0.255

R2:

[R2]ospf 1 
[R2-ospf-1]area 0 
[R2-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255 
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0 
[R2-ospf-1-area-0.0.0.0]network 10.1.12.0 0.0.0.255 
[R2]ospf 1 
[R2-ospf-1]area 1 
[R2-ospf-1-area-0.0.0.1]network 10.1.23.0 0.0.0.255 
[R2-ospf-1-area-0.0.0.1]network 10.1.33.0 0.0.0.255

R3:

[R3]ospf 1 
[R3-ospf-1]area 1 
[R3-ospf-1-area-0.0.0.1]network 10.1.23.0 0.0.0.255 
[R3-ospf-1-area-0.0.0.1]network 10.1.33.0 0.0.0.255 
[R3-ospf-1-area-0.0.0.1]network 192.168.3.0 0.0.0.255 
[R3-ospf-1-area-0.0.0.1]network 3.3.3.3 0.0.0.0

结果测试分析

PC1、PC2、PC3之间的连通性

PC>ping 192.168.2.1

Ping 192.168.2.1: 32 data bytes, Press Ctrl_C to break
From 192.168.2.1: bytes=32 seq=1 ttl=126 time=15 ms
From 192.168.2.1: bytes=32 seq=2 ttl=126 time=32 ms
From 192.168.2.1: bytes=32 seq=3 ttl=126 time=15 ms
From 192.168.2.1: bytes=32 seq=4 ttl=126 time=31 ms
From 192.168.2.1: bytes=32 seq=5 ttl=126 time=16 ms

--- 192.168.2.1 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 15/21/32 ms
PC>ping 192.168.3.1

Ping 192.168.3.1: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.3.1: bytes=32 seq=2 ttl=125 time=31 ms
From 192.168.3.1: bytes=32 seq=3 ttl=125 time=16 ms
From 192.168.3.1: bytes=32 seq=4 ttl=125 time=15 ms
From 192.168.3.1: bytes=32 seq=5 ttl=125 time=32 ms

--- 192.168.3.1 ping statistics ---
  5 packet(s) transmitted
  4 packet(s) received
  20.00% packet loss
  round-trip min/avg/max = 0/23/32 ms

表明已经实现全网互通。

实验总结

​ 本次实验让我通过自己的动手操作深刻的理解了静态路由和动态路由的设置方法,过程很艰难,但是获益匪浅。我懂得了如何去设置动态路由或者静态路由来实现全网互通,关键点就是一要数据有去有回,二要沿途经过的所有路由设备有去往源IP的路由条目。

你可能感兴趣的:(网络,路由器)