理论+实验:eNSP中配置静态路由

@[toc]

简单介绍命令

以太网工作在数据链路层

数据的三要素:1.语法2.语义3.同步(接口速率)

http://7n4.cn/或https://mac.51240.xom可以查询MAC地址厂商

display mac-address 查看mac地址表

sysname R1 改名为R1

dis version 查看系统版本

interface gigabitethernet0/0/1 进入g0/0/1接口

ip- subnet-vlan 查看接口vlan网段信息

speed 10 接口速率配置为10M

undo negotiation auto 关闭自动协商

dis vlan 查看vlan接口分布表

int g0/0/0 进入g0/0/0 接口

ip add 192.168.1.1. 24 配置接口ip地址为192.168.1.1 子网掩码24位

undo shutdown 启用

pre 优先级

cost 花销值

浮动路由

即备份一条优先级比当前路由低的路由

实验名称:

实现三台路由器的loop 接口互联互通

1.配置参数已设置,接下来就开始配置

2.思路:loop接口的ip地址相当于路由器自身的一个直连网段

配置各个路由器的接口ip就开始配置相应的路由条目

1.1.1.1 去ping 2.2.2.2,有两条路可走,分别是R1》》R2,和R1》》R3》》R2,可以分别配置,先配置的优先级最高,后配置的最备用,等待优先级高的路由失效后就会触发优先级低的路由,以免因为链路损坏而影响数据及时传输

同理,1.1.1.1ping3.3.3.3 也是同样的道理

2.2.2.2ping3.3.3.3也是

在这里详细解释1.1.1.1去ping2.2.2.2的过程,剩下的举一反三即可

R1》》R2

对于1.1.1.1而言,2.2.2.2是R1的非直连网段,所以数据过去的话需要去给R1配置一条2.2.2.0的静态路由,下一跳为12.0.0.2;数据回来就是从R2返回到R1,需要给R2配置一条1.1.1.0的静态路由,下一跳为12.0.0.1

R1》》R3》》R2

首先,值得注意的是,数据一来一回的优先级必须在同一链路上,不可以分开

R1的数据传到R2,经过R3,需要给R1配置一条2.2.2.0的条目,下一跳为13.0.0.3,因为这个条目是第二个配置,所以在12.0.0.0正常作用的情况下,第二个条目不会被触发,这里配置这一条目,仅作备用;2.2.2.0也并不是R3的直连网段,所以需要给R3配置一条2.2.2.0的静态路由,下一跳为23.0.0.2。数据过去了,也要回来,配置路由的思路跟过去的一致,这里就不赘述了,开始配置

3.开启设备,先配置ip

R1

The device is running!  ‘显示设备已运行‘

<Huawei>sys ‘systtem-view,进入系统视图‘
Enter system view, return user view with Ctrl+Z.    ‘反馈已进入‘
[Huawei]undo info-center enable ‘关掉信息中心‘
Info: Information center is disabled.   ‘反馈已关掉‘
[Huawei]int g0/0/0  ‘进入g0/0/0接口‘
[Huawei-GigabitEthernet0/0/0]ip add 12.0.0.1 24 ‘配置ip地址‘
[Huawei-GigabitEthernet0/0/0]undo shutdown  ‘启用‘
Info: Interface GigabitEthernet0/0/0 is not shutdown.   ‘反馈已启用‘
[Huawei-GigabitEthernet0/0/0]int g0/0/1     ‘进入g0/0/1接口‘
[Huawei-GigabitEthernet0/0/1]ip add 13.0.0.1 24 ‘配置IP地址‘
[Huawei-GigabitEthernet0/0/1]undo shutdown  ‘启用‘
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[Huawei-GigabitEthernet0/0/1]q  ‘返回到系统视图‘
[Huawei]int LoopBack 0  ‘进入Loopback 0 接口‘
[Huawei-LoopBack0]ip address 1.1.1.1 24 ‘配置IP 地址‘
[Huawei-LoopBack0]q ‘返回,不需要手动启用‘
[Huawei]dis ip int brief    ‘查看接口ip信息‘
*down: administratively down
!down: FIB overload down
^down: standby
(l): loopback
(s): spoofing
(d): Dampening Suppressed
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 8
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 8

Interface                         IP Address/Mask      Physical   Protocol
Ethernet0/0/0                     unassigned           down       down
Ethernet0/0/1                     unassigned           down       down
GigabitEthernet0/0/0              12.0.0.1/24          up         up     ‘已配置,up已启用‘
GigabitEthernet0/0/1              13.0.0.1/24          up         up      ‘已配置,up已启用‘
GigabitEthernet0/0/2              unassigned           down       down
GigabitEthernet0/0/3              unassigned           down       down
LoopBack0                         1.1.1.1/24           up         up(s)    ‘已配置,up已启用‘
NULL0                             unassigned           up         up(s)
Serial0/0/0                       unassigned           down       down
Serial0/0/1                       unassigned           down       down
Serial0/0/2                       unassigned           down       down
Serial0/0/3                       unassigned           down       down      

R2的ip配置

[Huawei]sysname R2      ‘更名为R2‘
[R2]
Nov  7 2019 19:37:53-08:00 R2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 1, the ch
ange loop count is 0, and the maximum number of records is 4095.u       ‘没有及时关掉信息中心,就会出现这个信息‘
[R2]undo info-center enable     ‘关掉信息中心‘
Info: Information center is disabled. ‘反馈关掉‘
[R2]int g0/0/0  ‘进入g0/0/0接口‘
[R2-GigabitEthernet0/0/0]ip add 12.0.0.2 24 ‘配IP地址‘
[R2-GigabitEthernet0/0/0]undo shutdown  ‘启用‘
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R2-GigabitEthernet0/0/0]int g0/0/2 ‘进入g0/0/2接口‘
[R2-GigabitEthernet0/0/2]ip add 23.0.0.2 24 ‘陪ip地址‘
[R2-GigabitEthernet0/0/2]undo shutdown  ‘启用‘
Info: Interface GigabitEthernet0/0/2 is not shutdown.
[R2-GigabitEthernet0/0/2]q  ‘返回上一层‘
[R2]int LoopBack 0  ‘进入loopback接口‘
[R2-LoopBack0]ip add 2.2.2.2 24 ‘配置ip地址‘
[R2-LoopBack0]q ‘返回上一层‘
[R2]dis ip int b    ‘查看接口ip信息表‘
*down: administratively down
!down: FIB overload down
^down: standby
(l): loopback
(s): spoofing
(d): Dampening Suppressed
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 8
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 8

Interface                         IP Address/Mask      Physical   Protocol
Ethernet0/0/0                     unassigned           down       down
Ethernet0/0/1                     unassigned           down       down
GigabitEthernet0/0/0              12.0.0.2/24          up         up   ‘已配置,Up已启用‘
GigabitEthernet0/0/1              unassigned           down       down
GigabitEthernet0/0/2              23.0.0.2/24          up         up     ‘已配置,up已启用‘
GigabitEthernet0/0/3              unassigned           down       down
LoopBack0                         2.2.2.2/24           up         up(s)  ‘已配置,up已启用‘
NULL0                             unassigned           up         up(s)
Serial0/0/0                       unassigned           down       down
Serial0/0/1                       unassigned           down       down
Serial0/0/2                       unassigned           down       down
Serial0/0/3                       unassigned           down       down
[R2]

R3的ip 配置

<Huawei>
<Huawei>system-view     ‘进入系统视图‘
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable     ‘关掉信息中心‘
Info: Information center is disabled.
[Huawei]sysname R3  ‘更名为R3‘
[R3]int g0/0/1  ‘进入g0/0/1接口‘
[R3-GigabitEthernet0/0/1]ip add 13.0.0.3 24 ‘配置ip信息‘
[R3-GigabitEthernet0/0/1]undo shutdown  ‘启用‘
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R3-GigabitEthernet0/0/1]int g0/0/2 ‘进入g0/0/2接口‘
[R3-GigabitEthernet0/0/2]ip add 23.0.0.3 24 ‘配置ip地址‘
[R3-GigabitEthernet0/0/2]undo shutdown  ‘启用‘
Info: Interface GigabitEthernet0/0/2 is not shutdown.
[R3-GigabitEthernet0/0/2]q      ‘返回上一层‘
[R3]int LoopBack 0      ‘进入loopback 0 接口‘
[R3-LoopBack0]ip add 3.3.3.3 24     ‘配置ip地址‘
[R3-LoopBack0]q     ‘返回上一层‘
[R3]int LoopBack 1
[R3-LoopBack1]ip add 4.4.4.4 24
[R3-LoopBack1]q
[R3]dis ip interface brief  ‘查看接口ip信息表‘
*down: administratively down
!down: FIB overload down
^down: standby
(l): loopback
(s): spoofing
(d): Dampening Suppressed
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 8
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 8

Interface                         IP Address/Mask      Physical   Protocol
Ethernet0/0/0                     unassigned           down       down
Ethernet0/0/1                     unassigned           down       down
GigabitEthernet0/0/0              unassigned           down       down
GigabitEthernet0/0/1              13.0.0.3/24          up         up    ‘已配置,up已开启‘
GigabitEthernet0/0/2              23.0.0.3/24          up         up  ‘已配置,up已开启‘
GigabitEthernet0/0/3              unassigned           down       down
LoopBack0                         3.3.3.3/24           up         up(s)     ‘已配置,uo已开启‘
LoopBack1                         4.4.4.4/24           up         up(s)   ‘已配置,up已开启‘
NULL0                             unassigned           up         up(s)
Serial0/0/0                       unassigned           down       down
Serial0/0/1                       unassigned           down       down
Serial0/0/2                       unassigned           down       down
Serial0/0/3                       unassigned           down       down

ip配置完毕,接下来就开始配置路由,先从1.1.1.1去ping 2.2.2.2的思路去配置

R1

<Huawei>system-view     ‘进入系统视图‘
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1  ‘改名为R1‘
[R1]
Nov  7 2019 19:45:23-08:00 R1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 5, the ch
ange loop count is 0, and the maximum number of records is 4095.    ‘出现信息中心的信息‘
Info: Information center is disabled.       ‘关掉信息中心‘
[R1]ip route-static 2.2.2.0 24 12.0.0.2 ‘配置静态路由,目标网段2.2.2.0,下一跳12.0.0.2‘

R2

[R2]ip route-static 1.1.1.0 24 12.0.0.1     ‘配置静态路由,目标网段1.1.1.0 下一跳为12.0.0.1‘

R1的1.1.1.1 去ping 2.2.2.2

[R1]ping -a 1.1.1.1 2.2.2.2   ‘-a指定源ip地址‘
  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=50 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=50 ms
    Reply from 2.2.2.2: bytes=56 Sequence=4 ttl=255 time=30 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/34/50 ms

接下来配置备用路由,即R1》》R3》》R2

R1

[R1]ip route-static 2.2.2.0 24 13.0.0.3 ‘配置静态路由‘

R3

[R3]ip route-static 2.2.2.0 24 23.0.0.2 ‘配置静态路由‘

再往回配

R2

[R2]ip route-static 1.1.1.0 24 23.0.0.3

R3

[R3]ip route-static 1.1.1.0 24 13.0.0.1

接下来可以把12.0.0.0/24的链路中断


R1操作方法

[R1]int g0/0/0  ‘进入对应网段接口‘
[R1-GigabitEthernet0/0/0]shutdown   ‘关闭‘
[R1-GigabitEthernet0/0/0]q

这个时候再ping一波

[R1]ping -a 1.1.1.1 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=254 time=80 ms
    Reply from 2.2.2.2: bytes=56 Sequence=2 ttl=254 time=60 ms
    Reply from 2.2.2.2: bytes=56 Sequence=3 ttl=254 time=60 ms
    Reply from 2.2.2.2: bytes=56 Sequence=4 ttl=254 time=60 ms
    Reply from 2.2.2.2: bytes=56 Sequence=5 ttl=254 time=50 ms

  --- 2.2.2.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 50/62/80 ms

查看一下此时R1的路由表

[R1]dis ip routing-table    ‘查看路由表‘
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 7        Routes : 7        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.0/24  Direct  0    0           D   1.1.1.1         LoopBack0
        1.1.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
        2.2.2.0/24  Static  60   0          RD   13.0.0.3        GigabitEthernet    ‘注意这一条‘
0/0/1
       13.0.0.0/24  Direct  0    0           D   13.0.0.1        GigabitEthernet
0/0/1
       13.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
      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

恢复12.0.0.1链路,再次查看路由表

[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]undo shutdown
[R1-GigabitEthernet0/0/0]q
[R1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 9        Routes : 10       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.0/24  Direct  0    0           D   1.1.1.1         LoopBack0
        1.1.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
        2.2.2.0/24  Static  60   0          RD   12.0.0.2        GigabitEthernet    ‘注意这一条‘
0/0/0
                    Static  60   0          RD   13.0.0.3        GigabitEthernet
0/0/1
       12.0.0.0/24  Direct  0    0           D   12.0.0.1        GigabitEthernet
0/0/0
       12.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       13.0.0.0/24  Direct  0    0           D   13.0.0.1        GigabitEthernet
0/0/1
       13.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
      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

接下来就主要按部就班把其余的以同样的形式配置好即可

1.1.1.1 ping 3.3.3.3

R1

[R1]ip route-static 3.3.3.0 24 13.0.0.3

R3

[R3]ip route-static 1.1.1.0 24 13.0.0.1
Error: The route already exists.    ‘显示之前已被配置过‘

备用路由

R1

[R1]ip route-static 3.3.3.0 24 12.0.0.2

R2

[R2]ip route-static 3.3.3.0 24 23.0.0.3

R3

[R3]ip route-static 1.1.1.0 24 23.0.0.2

R2

[R2]ip route-static 1.1.1.0 24 12.0.0.1
Error: The route already exists.

2.2.2.2 ping 3.3.3.3

R2

[R2]ip route-static 3.3.3.0 24 23.0.0.3
Error: The route already exists.

R3

[R3]ip route-static 2.2.2.0 24 23.0.0.2
Error: The route already exists.

再去配置另一条备用路由

R2》》R1》》R3

R2

[R2]ip route-static 3.3.3.0 24 12.0.0.1

R1

[R1]ip route-static 3.3.3.0 24 13.0.0.3
Error: The route already exists.

R3

[R3]ip route-static 2.2.2.0 24 13.0.0.1

R1

[R1]ip route-static 2.2.2.0 24 12.0.0.2
Error: The route already exists.

完毕

接下来1.1.1.1 ping 3.3.3.3

[R1]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=255 time=40 ms
    Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=255 time=40 ms
    Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=255 time=50 ms
    Reply from 3.3.3.3: bytes=56 Sequence=4 ttl=255 time=30 ms
    Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=255 time=50 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/42/50 ms

2.2.2.2去ping 3.3.3.3

[R2]ping -a 2.2.2.2 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=255 time=40 ms
    Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=255 time=50 ms
    Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 3.3.3.3: bytes=56 Sequence=4 ttl=255 time=50 ms
    Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=255 time=50 ms

  --- 3.3.3.3 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/42/50 ms

查看各个路由器的路由表

R1

[R1]dis ip routing-table    ‘查看路由表‘
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 10       Routes : 12       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.0/24  Direct  0    0           D   1.1.1.1         LoopBack0
        1.1.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
        2.2.2.0/24  Static  60   0          RD   12.0.0.2        GigabitEthernet
0/0/0
                    Static  60   0          RD   13.0.0.3        GigabitEthernet    ‘备用路由‘
0/0/1
        3.3.3.0/24  Static  60   0          RD   13.0.0.3        GigabitEthernet
0/0/1
                    Static  60   0          RD   12.0.0.2        GigabitEthernet    ‘备用路由‘
0/0/0
       12.0.0.0/24  Direct  0    0           D   12.0.0.1        GigabitEthernet
0/0/0
       12.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       13.0.0.0/24  Direct  0    0           D   13.0.0.1        GigabitEthernet
0/0/1
       13.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
      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

R2

[R2]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 10       Routes : 12       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.0/24  Static  60   0          RD   12.0.0.1        GigabitEthernet
0/0/0
                    Static  60   0          RD   23.0.0.3        GigabitEthernet    ‘备用路由‘
0/0/2
        2.2.2.0/24  Direct  0    0           D   2.2.2.2         LoopBack0
        2.2.2.2/32  Direct  0    0           D   127.0.0.1       LoopBack0
        3.3.3.0/24  Static  60   0          RD   23.0.0.3        GigabitEthernet
0/0/2
                    Static  60   0          RD   12.0.0.1        GigabitEthernet    ‘备用路由‘
0/0/0
       12.0.0.0/24  Direct  0    0           D   12.0.0.2        GigabitEthernet
0/0/0
       12.0.0.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       23.0.0.0/24  Direct  0    0           D   23.0.0.2        GigabitEthernet
0/0/2
       23.0.0.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
      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

R3

[R3]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 12       Routes : 14       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.0/24  Static  60   0          RD   13.0.0.1        GigabitEthernet
0/0/1
                    Static  60   0          RD   23.0.0.2        GigabitEthernet    ‘备用路由‘
0/0/2
        2.2.2.0/24  Static  60   0          RD   23.0.0.2        GigabitEthernet
0/0/2
                    Static  60   0          RD   13.0.0.1        GigabitEthernet    ‘备用路由‘
0/0/1
        3.3.3.0/24  Direct  0    0           D   3.3.3.3         LoopBack0
        3.3.3.3/32  Direct  0    0           D   127.0.0.1       LoopBack0
        4.4.4.0/24  Direct  0    0           D   4.4.4.4         LoopBack1
        4.4.4.4/32  Direct  0    0           D   127.0.0.1       LoopBack1
       13.0.0.0/24  Direct  0    0           D   13.0.0.3        GigabitEthernet
0/0/1
       13.0.0.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
       23.0.0.0/24  Direct  0    0           D   23.0.0.3        GigabitEthernet
0/0/2
       23.0.0.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
      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

```shell

可以发现各少了一个网段,但是并不影响loop间的互联互通

可以断掉一条链路,去测试备用链路

断掉R1的g0/0/1

```shell
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]shutdown 

再次ping一波

[R1]ping -a 1.1.1.1 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=254 time=80 ms
    Reply from 2.2.2.2: bytes=56 Sequence=2 ttl=254 time=60 ms
    Reply from 2.2.2.2: bytes=56 Sequence=3 ttl=254 time=80 ms
    Reply from 2.2.2.2: bytes=56 Sequence=4 ttl=254 time=60 ms
    Reply from 2.2.2.2: bytes=56 Sequence=5 ttl=254 time=60 ms

  --- 2.2.2.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 60/68/80 ms

[R1]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=255 time=10 ms
    Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=255 time=50 ms
    Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=255 time=50 ms
    Reply from 3.3.3.3: bytes=56 Sequence=4 ttl=255 time=40 ms
    Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=255 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 = 10/36/50 ms
[R2]ping -a 2.2.2.2 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=255 time=20 ms
    Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=255 time=10 ms
    Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=255 time=50 ms
    Reply from 3.3.3.3: bytes=56 Sequence=4 ttl=255 time=40 ms
    Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=255 time=50 ms

  --- 3.3.3.3 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 10/34/50 ms

并不影响

再次查看路由表

R1

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

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.0/24  Direct  0    0           D   1.1.1.1         LoopBack0
        1.1.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
        2.2.2.0/24  Static  60   0          RD   13.0.0.3        GigabitEthernet    ‘备用路由‘
0/0/1
        3.3.3.0/24  Static  60   0          RD   13.0.0.3        GigabitEthernet
0/0/1
       13.0.0.0/24  Direct  0    0           D   13.0.0.1        GigabitEthernet
0/0/1
       13.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
      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

R2

[R2]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 8        Routes : 8        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.0/24  Static  60   0          RD   23.0.0.3        GigabitEthernet    ‘备用路由‘
0/0/2
        2.2.2.0/24  Direct  0    0           D   2.2.2.2         LoopBack0
        2.2.2.2/32  Direct  0    0           D   127.0.0.1       LoopBack0
        3.3.3.0/24  Static  60   0          RD   23.0.0.3        GigabitEthernet
0/0/2
       23.0.0.0/24  Direct  0    0           D   23.0.0.2        GigabitEthernet
0/0/2
       23.0.0.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
      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

R3

[R3]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 12       Routes : 14       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.0/24  Static  60   0          RD   13.0.0.1        GigabitEthernet
0/0/1
                    Static  60   0          RD   23.0.0.2        GigabitEthernet
0/0/2
        2.2.2.0/24  Static  60   0          RD   23.0.0.2        GigabitEthernet
0/0/2
                    Static  60   0          RD   13.0.0.1        GigabitEthernet
0/0/1
        3.3.3.0/24  Direct  0    0           D   3.3.3.3         LoopBack0
        3.3.3.3/32  Direct  0    0           D   127.0.0.1       LoopBack0
        4.4.4.0/24  Direct  0    0           D   4.4.4.4         LoopBack1
        4.4.4.4/32  Direct  0    0           D   127.0.0.1       LoopBack1
       13.0.0.0/24  Direct  0    0           D   13.0.0.3        GigabitEthernet
0/0/1
       13.0.0.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
       23.0.0.0/24  Direct  0    0           D   23.0.0.3        GigabitEthernet
0/0/2
       23.0.0.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
      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

跟12.0.0.0相关的都改用了备用链路,再次印证了之前说的一个原理

原文地址:https://blog.51cto.com/14558445/2448638

时间: 2024-08-28 21:08:31

理论+实验:eNSP中配置静态路由的相关文章

eNSP中配置默认路由

配置接口IP地址并通过静态路由.默认路由配置实现全网互通. 搭建环境 代码 [R1]ip route-static 0.0.0.0 0.0.0.0 192.168.2.2 [R3]ip route-static 0.0.0.0 0.0.0.0 192.168.3.1 [R2]ip route-static 192.168.1.0 255.255.255.0 192.168.2.1 [R2]ip route-static 192.168.4.0 255.255.255.0 192.168.3.2

ensp中配置路由

配置接口IP地址并通过静态路由.默认路由配置实现全网互通. 搭建环境 eNSP中配置默认路由 代码 [R1]ip route-static 0.0.0.0 0.0.0.0 192.168.2.2[R3]ip route-static 0.0.0.0 0.0.0.0 192.168.3.1[R2]ip route-static 192.168.1.0 255.255.255.0 192.168.2.1[R2]ip route-static 192.168.4.0 255.255.255.0 192

配置静态路由实验全网互通

实验环境: 实验要求:需要在三台路由器上配置静态路由,以实现各网段之间的互通.      R1Loopback 0配置192.168.10.1/24      R1F0/0接口配置192.168.1.1/24      R1F0/1接口配置192.168.2.1/24 R2Loopback 0配置192.168.20.1/24      R2F0/0接口配置192.168.3.2/24 R2F0/1接口配置192.168.1.2/24 R3Loopback 0配置192.168.30.1/24

Ensp配置静态路由和默认路由

原理: ' 实验场景: 实验拓扑: 实验编址: 按照实验拓扑和实验编址搭好实验环境, 测试连通性 两台PC ping一下,发现无法连通 查看一下路由表: 可以看到在R1的路由表上,没有关于PC2所在网段的路由信息 同样的,R2上没有关于PC1和PC2所在网段的路由信息 R3上没有关于PC1所在网段的路由信息 也就是说在初始状态下,各个路由器只有与自身直连网段的路由信息. 现在PC1与PC2之间跨越了几个不同网段,要ping通需要在3台路由器上配置相应的路由信息. 可以通过配置静态路由来实现. 在

linux 下配置静态路由

实验拓扑图 1.  首先在B计算机下给eth0和eth1设置IP地址 打开配置文件 #vim /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=网卡的代号 BOOTPROTO=是否使用 dhcp, 试验中选择不使用 HWADDR=是否加入网卡卡号(MAC) IPADDR=就是IP地址 NETMASK=掩码 NETWORK=网域,也就是你所在的是哪一个网段 ONBOOT=这里要选择启用,也就是YES GATEWAY=网关 BROADCAST=广播地址

配置静态路由实现全网互通

<网络与技术应用> 第(第八)章-实验报告 实 验 任 务 配置静态路由实现全网互通 详 细 实 验 步 骤 1. 在R1上分别配置192.168.20.0/24  192.168.30.0/24  192.168.3.0/24 的静态路由. 配置端口IP地址 配置loopback地址 配置静态路由 2. 在R2上分别配置192.168.10.0/24  192.168.30.0/24  192.168.2.0/24 的静态路由. 配置端口IP地址 配置loopback地址 配置静态路由 3.

静态路由实验二(浮动静态路由及负载均衡)

原理概述: 浮动静态路由(Floating Static Route)是一种特殊的静态路由,通过配置去往相同的 目的网段,但优先级不同的静态路由,以保证在网络中优先级较高的路由,即主路由失效的情况下提供备份路由.正常情况下,备份路由 不会出现在路由表中.      负载均衡(Load sharing),当数据有多条可选路径前往同一目的网络,可以通过配 置相同优先级和开销的静态路由实现负载均衡,使得数据的传输均衡地分配到多条路径上,从而实现数据分流.减轻单条路径负载过重的效果. 而当其中某一条路径

ubuntu配置静态路由及重启生效

ubuntu配置静态路由及重启生效 第一种方法:使用route命令(添加临时路由) 添加到主机的路由 # route add -host 192.168.1.123 dev eth0 # route add -host 192.168.1.123 gw 192.168.1.1 添加到网络的路由 # route add -net 192.168.1.123 netmask 255.255.255.0 eth0 # route add -net 192.168.1.123 netmask 255.2

网络设备配置与管理----配置静态路由实现两个公司网络互联

理论学习 问题1:静态路由和动态路由的区别? 1>静态路由是在路由器中设置的固定路由,动态路由靠配置的动态路由协议进行的自动路由计算和路由表项更新. 2>静态路由的故障解决方式不如动态路由完善 3>动态路由协议会占带宽和CPU资源,执行优先级没有静态路由高. 问题2:简述路由的构成元素以及各个元素的作用? 构成元素:路由类型.目的网络.子网掩码.转发接口或下一跳网关.管理距离.度量值等 路由类型:表示路由表项的类型或来源 目的网络:需转发数据到目标网络地址 子网掩码:标定网络地址的数据坐