您好,欢迎访问代理记账网站
  • 价格透明
  • 信息保密
  • 进度掌控
  • 售后无忧

网络层---路由及实验(浮动静态)

​​​​​​在这里插入图片描述
R1,R2,R3各接口地址

[R1-GigabitEthernet0/0/1]dis cu
[V200R003C00]
#
 sysname R1
#
 snmp-agent local-engineid 800007DB03000000000000
 snmp-agent 
#
 clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
 drop illegal-mac alarm
#
 set cpu-usage threshold 80 restore 75
#
aaa 
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default 
 domain default_admin 
 local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
 local-user admin service-type http
#
firewall zone Local
 priority 15
#
interface GigabitEthernet0/0/0
 ip address 192.168.10.254 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 12.1.1.1 255.255.255.0 
#
interface GigabitEthernet0/0/2
 ip address 13.1.1.1 255.255.255.0 
#
interface NULL0
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
[R1-GigabitEthernet0/0/1]
[R2-GigabitEthernet0/0/2]dis cu
[V200R003C00]
#
 sysname R2
#
 snmp-agent local-engineid 800007DB03000000000000
 snmp-agent 
#
 clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
 drop illegal-mac alarm
#
 set cpu-usage threshold 80 restore 75
#
aaa 
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default 
 domain default_admin 
 local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
 local-user admin service-type http
#
firewall zone Local
 priority 15
#
interface GigabitEthernet0/0/0
 ip address 12.1.1.2 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 192.168.20.254 255.255.255.0 
#
interface GigabitEthernet0/0/2
 ip address 23.1.1.1 255.255.255.0 
#
interface NULL0
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
[R2-GigabitEthernet0/0/2]
[R3-GigabitEthernet0/0/1]dis cu
[V200R003C00]
#
 sysname R3
#
 snmp-agent local-engineid 800007DB03000000000000
 snmp-agent 
#
 clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
 drop illegal-mac alarm
#
 set cpu-usage threshold 80 restore 75
#
aaa 
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default 
 domain default_admin 
 local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
 local-user admin service-type http
#
firewall zone Local
 priority 15
#
interface GigabitEthernet0/0/0
 ip address 13.1.1.2 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 23.1.1.2 255.255.255.0 
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
[R3-GigabitEthernet0/0/1]

首先给R1,R2上配置到彼此连接的主机网段

[R1]ip route-static 192.168.20.0 24 12.1.1.2
[R1]dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 14       Routes : 14       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       12.1.1.0/24  Direct  0    0           D   12.1.1.1        GigabitEthernet
0/0/1
       12.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
     12.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
       13.1.1.0/24  Direct  0    0           D   13.1.1.1        GigabitEthernet
0/0/2
       13.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
     13.1.1.255/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
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.10.0/24  Direct  0    0           D   192.168.10.254  GigabitEthernet
0/0/0
 192.168.10.254/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
 192.168.10.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
   192.168.20.0/24  Static  60   0          RD   12.1.1.2        GigabitEthernet
0/0/1
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[R1]
[R2]ip route-static 192.168.10.0 24 12.1.1.1
[R2]dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 14       Routes : 14       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       12.1.1.0/24  Direct  0    0           D   12.1.1.2        GigabitEthernet
0/0/0
       12.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
     12.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       23.1.1.0/24  Direct  0    0           D   23.1.1.1        GigabitEthernet
0/0/2
       23.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
     23.1.1.255/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
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.10.0/24  Static  60   0          RD   12.1.1.1        GigabitEthernet
0/0/0
   192.168.20.0/24  Direct  0    0           D   192.168.20.254  GigabitEthernet
0/0/1
 192.168.20.254/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
 192.168.20.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[R2]

此时pc3可以与pc4通信
在这里插入图片描述

同理pc4也能通信pc3
在这里插入图片描述

现在在R1,R2上配置浮动路由,在R3上配置普通静态

[R1]ip route-static 192.168.20.0 24 13.1.1.2 preference 70
[R2]ip route-static 192.168.10.0 24 23.1.1.2 preference 70
[R3]ip route-static 192.168.10.0 24 13.1.1.1
[R3]ip route-static 192.168.20.0 24 23.1.1.1

查看R1,R2,R3的路由表

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

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       12.1.1.0/24  Direct  0    0           D   12.1.1.1        GigabitEthernet
0/0/1
       12.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
     12.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
       13.1.1.0/24  Direct  0    0           D   13.1.1.1        GigabitEthernet
0/0/2
       13.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
     13.1.1.255/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
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.10.0/24  Direct  0    0           D   192.168.10.254  GigabitEthernet
0/0/0
 192.168.10.254/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
 192.168.10.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
   192.168.20.0/24  Static  60   0          RD   12.1.1.2        GigabitEthernet
0/0/1
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

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

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       12.1.1.0/24  Direct  0    0           D   12.1.1.2        GigabitEthernet
0/0/0
       12.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
     12.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       23.1.1.0/24  Direct  0    0           D   23.1.1.1        GigabitEthernet
0/0/2
       23.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
     23.1.1.255/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
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.10.0/24  Static  60   0          RD   12.1.1.1        GigabitEthernet
0/0/0
   192.168.20.0/24  Direct  0    0           D   192.168.20.254  GigabitEthernet
0/0/1
 192.168.20.254/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
 192.168.20.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

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

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       13.1.1.0/24  Direct  0    0           D   13.1.1.2        GigabitEthernet
0/0/0
       13.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
     13.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       23.1.1.0/24  Direct  0    0           D   23.1.1.2        GigabitEthernet
0/0/1
       23.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
     23.1.1.255/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
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.10.0/24  Static  60   0          RD   13.1.1.1        GigabitEthernet
0/0/0
   192.168.20.0/24  Static  60   0          RD   23.1.1.1        GigabitEthernet
0/0/1
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[R3]

发现R1,R2配的浮动静态路由并没有生效,将R1与R2之间的链路断开

[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]shu
[R1-GigabitEthernet0/0/1]
Apr  5 2021 02:46:44-08:00 R1 %%01IFPDT/4/IF_STATE(l)[7]:Interface GigabitEthern
et0/0/1 has turned into DOWN state.
[R1-GigabitEthernet0/0/1]
Apr  5 2021 02:46:44-08:00 R1 %%01IFNET/4/LINK_STATE(l)[8]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the DOWN state. 
[R1-GigabitEthernet0/0/1]

此时再查看R1,R2的路由表

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

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       13.1.1.0/24  Direct  0    0           D   13.1.1.1        GigabitEthernet
0/0/2
       13.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
     13.1.1.255/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
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.10.0/24  Direct  0    0           D   192.168.10.254  GigabitEthernet
0/0/0
 192.168.10.254/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
 192.168.10.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
   192.168.20.0/24  Static  70   0          RD   13.1.1.2        GigabitEthernet
0/0/2
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

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

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       23.1.1.0/24  Direct  0    0           D   23.1.1.1        GigabitEthernet
0/0/2
       23.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
     23.1.1.255/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
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.10.0/24  Static  70   0          RD   23.1.1.2        GigabitEthernet
0/0/2
   192.168.20.0/24  Direct  0    0           D   192.168.20.254  GigabitEthernet
0/0/1
 192.168.20.254/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
 192.168.20.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[R2]

发现优先级60的静态没了,而配置的优先级70的浮动静态出现了,此时pc3与pc4互相通信

在这里插入图片描述
在这里插入图片描述
pc之间相互通信是从下面的路线走的。
所以浮动静态是当主线路因某种原因无法工作时,可以自动切换到其他线路,不会造成过大的损失。当主线路正常工作时,浮动路由也不会影响主线路的信息传输,相当于一个主线路备份。


分享:

低价透明

统一报价,无隐形消费

金牌服务

一对一专属顾问7*24小时金牌服务

信息保密

个人信息安全有保障

售后无忧

服务出问题客服经理全程跟进