静态路由的配置

eNSP拓扑图

任务如下

任务一:让R1能Ping通R4的192.168.34.4
任务二:让R2能Ping通R4的4.4.4.4

配置路由器

R1

[Huawei]sys R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.12.1 24
[R1-GigabitEthernet0/0/0]q
[R1]ip route-static 192.168.34.0 24 192.168.12.2
[R1]ip route-static 4.4.4.4 32 192.168.12.2

R2

[Huawei]sys R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.12.2 24
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 192.168.23.2 24
[R2-GigabitEthernet0/0/1]q
[R2]ip route-static 192.168.34.4 24 192.168.23.3
[R2]ip route-static 4.4.4.4 32 192.168.23.3

R3

[Huawei]sys R3
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.23.3 24
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 192.168.34.3 24
[R3-GigabitEthernet0/0/1]q
[R3]ip route-static 192.168.12.0 24 192.168.23.2
[R3]ip route-static 4.4.4.4 32 192.168.34.4

R4

[Huawei]sys R4
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 192.168.34.4 24
[R4-GigabitEthernet0/0/0]q
[R4]ip route-static 192.168.12.0 24 192.168.34.3
[R4]int loop 0
[R4-LoopBack0]ip add 4.4.4.4 32
[R4-LoopBack0]q

R1(验证配置)

[R1]ping 192.168.34.4
  PING 192.168.34.4: 56  data bytes, press CTRL_C to break
    Reply from 192.168.34.4: bytes=56 Sequence=1 ttl=253 time=100 ms
    Reply from 192.168.34.4: bytes=56 Sequence=2 ttl=253 time=20 ms
    Reply from 192.168.34.4: bytes=56 Sequence=3 ttl=253 time=50 ms
    Reply from 192.168.34.4: bytes=56 Sequence=4 ttl=253 time=40 ms
    Reply from 192.168.34.4: bytes=56 Sequence=5 ttl=253 time=20 ms

  --- 192.168.34.4 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/46/100 ms

[R1]ip route-static 4.4.4.4 32 192.168.12.2
[R1]ping 4.4.4.4
  PING 4.4.4.4: 56  data bytes, press CTRL_C to break
    Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=253 time=60 ms
    Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=253 time=40 ms
    Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=253 time=40 ms
    Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=253 time=30 ms
    Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=253 time=40 ms

  --- 4.4.4.4 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 30/42/60 ms

R1查看路由表

[R1]dis ip rout
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 9        Routes : 9        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        4.4.4.4/32  Static  60   0          RD   192.168.12.2    GigabitEthernet
0/0/0
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.12.0/24  Direct  0    0           D   192.168.12.1    GigabitEthernet
0/0/0
   192.168.12.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
 192.168.12.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
   192.168.34.0/24  Static  60   0          RD   192.168.12.2    GigabitEthernet
0/0/0

路由表分析:

Destination:目的网段

mask:子网掩码

proto:协议(Direct直连、Static静态、BGP、OSPF、RIP、ISIS动态)

pro:优先级(Direct直连:0、Static静态:60、BGP、OSPF:10/150、RIP、ISIS动态)

cost:开销

NextHop:下一跳

任务如下

任务三:全网通,一共18条静态路由

重启路由器,eNSP拓扑图

配置路由器

R1

[Huawei]sys R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.12.1 24
[R1-GigabitEthernet0/0/0]int loop 0
[R1-LoopBack0]ip add 1.1.1.1 32
[R1-LoopBack0]q
[R1]ip route-static 192.168.34.0 24 192.168.12.2
[R1]ip route-static 192.168.23.0 24 192.168.12.2
[R1]ip route-static 2.2.2.2 32 192.168.12.2
[R1]ip route-static 3.3.3.3 32 192.168.12.2
[R1]ip route-static 4.4.4.4 32 192.168.12.2 

R2

[Huawei]sys R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.12.2 24
[R2-GigabitEthernet0/0/0]int loop 0
[R2-LoopBack0]ip add 2.2.2.2 32
[R2-LoopBack0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 192.168.23.2 24
[R2-GigabitEthernet0/0/1]q
[R2]ip route-static 192.168.34.0 24 192.168.23.3
[R2]ip route-static 3.3.3.3 32 192.168.23.3
[R2]ip route-static 4.4.4.4 32 192.168.23.3
[R2]ip route-static 1.1.1.1 32 192.168.23.1

R3

[Huawei]sys R3
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.23.3 24
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 192.168.34.3 24
[R3-GigabitEthernet0/0/1]int loop 0 
[R3-LoopBack0]ip add 3.3.3.3 32
[R3-LoopBack0]q
[R3]ip route-static 192.168.12.0 24 192.168.23.2
[R3]ip route-static 1.1.1.1 32 192.168.23.2
[R3]ip route-static 2.2.2.2 32 192.168.23.2
[R3]ip route-static 4.4.4.4 32 192.168.34.4 

R4

[Huawei]sys R4
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 192.168.34.4 24
[R4-GigabitEthernet0/0/0]int loop 0
[R4-LoopBack0]ip add 4.4.4.4 32
[R4-LoopBack0]q
[R4]ip route-static 192.168.12.0 24 192.168.34.3
[R4]ip route-static 192.168.23.0 24 192.168.34.3
[R4]ip route-static 1.1.1.1 32 192.168.34.3
[R4]ip route-static 2.2.2.2 32 192.168.34.3
[R4]ip route-static 3.3.3.3 32 192.168.34.3 

验证配置Ping

[R1]ping 192.168.34.3
  PING 192.168.34.3: 56  data bytes, press CTRL_C to break
    Request time out
    Reply from 192.168.34.3: bytes=56 Sequence=2 ttl=254 time=130 ms
    Reply from 192.168.34.3: bytes=56 Sequence=3 ttl=254 time=30 ms
    Reply from 192.168.34.3: bytes=56 Sequence=4 ttl=254 time=30 ms
    Reply from 192.168.34.3: bytes=56 Sequence=5 ttl=254 time=30 ms

[R1]ping 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=20 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

查看路由表

R1

[R1]dis ip rout
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 13       Routes : 13       
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
        1.1.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
        2.2.2.2/32  Static  60   0          RD   192.168.12.2    GigabitEthernet0/0/0
        3.3.3.3/32  Static  60   0          RD   192.168.12.2    GigabitEthernet0/0/0
        4.4.4.4/32  Static  60   0          RD   192.168.12.2    GigabitEthernet0/0/0
   192.168.23.0/24  Static  60   0          RD   192.168.12.2    GigabitEthernet0/0/0
   192.168.34.0/24  Static  60   0          RD   192.168.12.2    GigabitEthernet0/0/0

R2

[R2]dis ip rout
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 15       Routes : 15       
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
        1.1.1.1/32  Static  60   0          RD   192.168.23.1    GigabitEthernet0/0/1
        2.2.2.2/32  Direct  0    0           D   127.0.0.1       LoopBack0
        3.3.3.3/32  Static  60   0          RD   192.168.23.3    GigabitEthernet0/0/1
        4.4.4.4/32  Static  60   0          RD   192.168.23.3    GigabitEthernet0/0/1
   192.168.34.0/24  Static  60   0          RD   192.168.23.3    GigabitEthernet

R3

[R3]dis ip rout
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 15       Routes : 15       
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
        1.1.1.1/32  Static  60   0          RD   192.168.23.2    GigabitEthernet0/0/0
        2.2.2.2/32  Static  60   0          RD   192.168.23.2    GigabitEthernet0/0/0
        3.3.3.3/32  Direct  0    0           D   127.0.0.1       LoopBack0
        4.4.4.4/32  Static  60   0          RD   192.168.34.4    GigabitEthernet0/0/1
   192.168.12.0/24  Static  60   0          RD   192.168.23.2    GigabitEthernet0/0/0

R4

[R4]dis ip rout
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 13       Routes : 13       
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
        1.1.1.1/32  Static  60   0          RD   192.168.34.3    GigabitEthernet0/0/0
        2.2.2.2/32  Static  60   0          RD   192.168.34.3    GigabitEthernet0/0/0
        3.3.3.3/32  Static  60   0          RD   192.168.34.3    GigabitEthernet0/0/0
        4.4.4.4/32  Direct  0    0           D   127.0.0.1       LoopBack0
   192.168.12.0/24  Static  60   0          RD   192.168.34.3    GigabitEthernet0/0/0
   192.168.23.0/24  Static  60   0          RD   192.168.34.3    GigabitEthernet0/0/0
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

彪哥.TOP

稀罕作者

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值