三层交换机配置及实验

  • 三层交换技术
  • 传统的MLS(多层交换)
  • 基于CEF的MLS
  • 链路聚合


三层交换技术

三层交换机使用三层交换技术实现vlan间通信,二层交换加三层转发的功能
特点:一次路由,多次交换

传统的MLS(多层交换)

①从三层引擎中获悉二层重写信息在硬件中创建一个MLS条目
②负责重写和转发数据流中的后续数据包

基于CEF的MLS

①转发信息库(FIB):相当于路由表的功能
②邻接关系表:能看到邻端的MAC地址

三层交换机具有路由功能和高速转发数据包

链路聚合

链路聚合有两种
手工负载分担
该模式下所有接口都参与数据的转发,平均分担流量;
如果某条链路故障,链路聚合组会自动在剩余的活动链路中平均分担流量;
当需要在两个直连设备间提供一个较大的带宽而设备不支持LACP协议时。
静态LACP
需手工创建以太trunk口,手工加入以太trunk成员接口,由LACP协商确定活动接口和非活动接口;
M:N模式m条链路处于活动状态,n条处于非活动状态,当m条链路中有条链路出现故障,会从n条备份链路选择优先级最高的接替故障链路,并从非活跃状态变为活跃状态开始转发数据。

实验:

三层交换机监控网络与外网互通的原理 监控三层交换机配置_链路

首先将主机IP地址配好,然后将主机分别划分到相应vlan中

[sw1]vlan 10
[sw1-vlan10]vlan 20
[sw1-vlan20]
Apr  7 2021 16:16:44-08:00 sw1 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 6, the c
hange loop count is 0, and the maximum number of records is 4095.int e0/0/1
[sw1-Ethernet0/0/1]
[sw1-Ethernet0/0/1]p l a
[sw1-Ethernet0/0/1]p d v 10
[sw1-Ethernet0/0/1]int e0
Apr  7 2021 16:17:34-08:00 sw1 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 8, the c
hange loop count is 0, and the maximum number of records is
[sw1-Ethernet0/0/1]
[sw1-Ethernet0/0/1]int e0/0/2
[sw1-Ethernet0/0/2]p l a
[sw1-Ethernet0/0/2]p d v 20
[sw1-Ethernet0/0/2]
[sw1-Ethernet0/0/2]dis vl
The total number of vlans is : 3
--------------------------------------------------------------------------------
U: Up;         D: Down;         TG: Tagged;         UT: Untagged;
MP: Vlan-mapping;               ST: Vlan-stacking;
#: ProtocolTransparent-vlan;    *: Management-vlan;
--------------------------------------------------------------------------------

VID  Type    Ports                                                          
--------------------------------------------------------------------------------
1    common  UT:Eth0/0/3(U)     Eth0/0/4(U)     Eth0/0/5(U)     Eth0/0/6(U)     
                Eth0/0/7(D)     Eth0/0/8(D)     Eth0/0/9(D)     Eth0/0/10(D)    
                Eth0/0/11(D)    Eth0/0/12(D)    Eth0/0/13(D)    Eth0/0/14(D)    
                Eth0/0/15(D)    Eth0/0/16(D)    Eth0/0/17(D)    Eth0/0/18(D)    
                Eth0/0/19(D)    Eth0/0/20(D)    Eth0/0/21(D)    Eth0/0/22(D)    
                GE0/0/1(D)      GE0/0/2(D)                                      

10   common  UT:Eth0/0/1(U)                                                     

20   common  UT:Eth0/0/2(U)                                                     


VID  Status  Property      MAC-LRN Statistics Description      
--------------------------------------------------------------------------------

1    enable  default       enable  disable    VLAN 0001                         
10   enable  default       enable  disable    VLAN 0010                         
20   enable  default       enable  disable    VLAN 0020                         
[sw1-Ethernet0/0/2]
[sw2]vlan 30
[sw2-vlan30]vlan
Apr  7 2021 16:20:26-08:00 sw2 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 c
hange loop count is 0, and the maximum number of records is 4095. 40
[sw2-vlan40]int e0/0/1
[sw2-Ethernet0/0/1]p l a 
[sw2-Ethernet0/0/1]p d v 30
[sw2-Ethernet0/0/1]int e0/0/2
[sw2-Ethernet0/0/2]p l a
[sw2-Ethernet0/0/2]p d v 40
[sw2-Ethernet0/0/2]
[sw2-Ethernet0/0/2]dis vl
The total number of vlans is : 3
--------------------------------------------------------------------------------
U: Up;         D: Down;         TG: Tagged;         UT: Untagged;
MP: Vlan-mapping;               ST: Vlan-stacking;
#: ProtocolTransparent-vlan;    *: Management-vlan;
--------------------------------------------------------------------------------

VID  Type    Ports                                                          
--------------------------------------------------------------------------------
1    common  UT:Eth0/0/3(U)     Eth0/0/4(U)     Eth0/0/5(U)     Eth0/0/6(U)     
                Eth0/0/7(U)     Eth0/0/8(U)     Eth0/0/9(U)     Eth0/0/10(D)    
                Eth0/0/11(D)    Eth0/0/12(D)    Eth0/0/13(D)    Eth0/0/14(D)    
                Eth0/0/15(D)    Eth0/0/16(D)    Eth0/0/17(D)    Eth0/0/18(D)    
                Eth0/0/19(D)    Eth0/0/20(D)    Eth0/0/21(D)    Eth0/0/22(D)    
                GE0/0/1(D)      GE0/0/2(D)                                      

30   common  UT:Eth0/0/1(U)                                                     

40   common  UT:Eth0/0/2(U)                                                     


VID  Status  Property      MAC-LRN Statistics Description      
--------------------------------------------------------------------------------

1    enable  default       enable  disable    VLAN 0001                         
30   enable  default       enable  disable    VLAN 0030                         
40   enable  default       enable  disable    VLAN 0040                         
[sw2-Ethernet0/0/2]
[sw3]vlan 50
[sw3-vlan50]
Apr  7 2021 16:23:52-08:00 sw3 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 7, the c
hange loop count is 0, and the maximum number of records is 4095.vlan 60
[sw3-vlan60]int e0/0/1
[sw3-Ethernet0/0/1]p l a
[sw3-Ethernet0/0/1]p d v 5
Apr  7 2021 16:24:42-08:00 sw3 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 9, the c
hange loop count is 0, and the maximum number of records is 4095.0
[sw3-Ethernet0/0/1]int e0/0/2
[sw3-Ethernet0/0/2]p l a
[sw3-Ethernet0/0/2]p d 
Apr  7 2021 16:24:52-08:00 sw3 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 11, the 
change loop count is 0, and the maximum number of records is 4095.v 60
[sw3-Ethernet0/0/2]
[sw3-Ethernet0/0/2]dis vl
The total number of vlans is : 3
--------------------------------------------------------------------------------
U: Up;         D: Down;         TG: Tagged;         UT: Untagged;
MP: Vlan-mapping;               ST: Vlan-stacking;
#: ProtocolTransparent-vlan;    *: Management-vlan;
--------------------------------------------------------------------------------

VID  Type    Ports                                                          
--------------------------------------------------------------------------------
1    common  UT:Eth0/0/3(U)     Eth0/0/4(U)     Eth0/0/5(U)     Eth0/0/6(U)     
                Eth0/0/7(D)     Eth0/0/8(D)     Eth0/0/9(D)     Eth0/0/10(D)    
                Eth0/0/11(D)    Eth0/0/12(D)    Eth0/0/13(D)    Eth0/0/14(D)    
                Eth0/0/15(D)    Eth0/0/16(D)    Eth0/0/17(D)    Eth0/0/18(D)    
                Eth0/0/19(D)    Eth0/0/20(D)    Eth0/0/21(D)    Eth0/0/22(D)    
                GE0/0/1(D)      GE0/0/2(D)                                      

50   common  UT:Eth0/0/1(U)                                                     

60   common  UT:Eth0/0/2(U)                                                     


VID  Status  Property      MAC-LRN Statistics Description      
--------------------------------------------------------------------------------

1    enable  default       enable  disable    VLAN 0001                         
50   enable  default       enable  disable    VLAN 0050                         
60   enable  default       enable  disable    VLAN 0060                         
[sw3-Ethernet0/0/2]

在sw1,sw2,sw3中配置链路聚合,并将接口变为trunk模式

[sw1]int et 1
[sw1-Eth-Trunk1]mode lacp-static 
[sw1-Eth-Trunk1]trunkport e 0/0/
Apr  7 2021 16:29:34-08:00 sw1 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 11, the 
change loop count is 0, and the maximum number of records is 4095.3 to 0/0/5
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw1-Eth-Trunk1]p l t
[sw1-Eth-Trunk1]p t a v a
[sw2]int et 1
[sw2-Eth-Trunk1]mo l
[sw2-Eth-Trunk1]
Apr  7 2021 16:32:16-08:00 sw2 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 11, the 
change loop count is 0, and the maximum number of records is 4095. tr e 0/0/3 to
 0/0/5
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw2-Eth-Trunk1]
Apr  7 2021 16:32:29-08:00 sw2 %%01IFNET/4/IF_STATE(l)[20]:Interface Eth-Trunk1 
has turned into UP state.
[sw2-Eth-Trunk1]int et 2
[sw2-Eth-Trunk2]m l
[sw2-Eth-Trunk2]tr e 0/0/6 
Apr  7 2021 16:34:26-08:00 sw2 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 13, the 
change loop count is 0, and the maximum number of records is 4095.to 0/0/8
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw2-Eth-Trunk2]p l t
[sw2-Eth-Trunk2]p t a v a
[sw3-Ethernet0/0/2]int et 2
[sw3-Eth-Trunk2]m l 
[sw3-Eth-Trunk2]tr	
[sw3-Eth-Trunk2]tr 
Apr  7 2021 16:36:23-08:00 sw3 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 13, the 
change loop count is 0, and the maximum number of records is 4095.e 0/0/3 to 0/0
/5
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw3-Eth-Trunk2]p l t
[sw3-Eth-Trunk2]p t a v a

分别在sw1,sw2,sw3与sw4的接口配置trunk

[sw1-Eth-Trunk1]int e0/0/6
[sw1-Ethernet0/0/6]p l t
[sw1-Ethernet0/0/6] p t a v a
[sw2-Eth-Trunk2]int e0/0/9
[sw2-Ethernet0/0/9]p l t
[sw2-Ethernet0/0/9]p t a v a
[sw3-Eth-Trunk2]int e0/0/6
[sw3-Ethernet0/0/6]p l t
[sw3-Ethernet0/0/6]p t a v a
[sw4]int g0/0/1
[sw4-GigabitEthernet0/0/1]p l t
[sw4-GigabitEthernet0/0/1]p t 
Apr  7 2021 16:43:04-08:00 sw4 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 c
hange loop count is 0, and the maximum number of records is 4095.a v a 
[sw4-GigabitEthernet0/0/1]int g0/0/2
[sw4-GigabitEthernet0/0/2]p l t
Apr  7 2021 16:43:14-08:00 sw4 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 6, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw4-GigabitEthernet0/0/2]p t a v a 
[sw4-GigabitEthernet0/0/2]int g0/0/3
[sw4-GigabitEthernet0/0/3]
Apr  7 2021 16:43:24-08:00 sw4 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 8, the c
hange loop count is 0, and the maximum number of records is 4095.p l t
[sw4-GigabitEthernet0/0/3]p t a v a

在sw4上配置vlanif并配置ip地址

[sw4]vlan ba 10 20 30 40 50 60 80
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw4]int vlan 10
[sw4-Vlanif10]
Apr  7 2021 16:52:25-08:00 sw4 %%01IFNET/4/IF_STATE(l)[5]:Interface Vlanif10 has
 turned into UP state.
[sw4-Vlanif10]ip add 192.168.1.254 24
[sw4]int vl 20
[sw4-Vlanif20]
Apr  7 2021 17:06:22-08:00 sw4 %%01IFNET/4/IF_STATE(l)[0]:Interface Vlanif20 has
 turned into UP state.ip add 192.168.2.254 24
[sw4-Vlanif10]int vl 30
[sw4-Vlanif30]
Apr  7 2021 17:07:13-08:00 sw4 %%01IFNET/4/IF_STATE(l)[2]:Interface Vlanif30 has
 turned into UP state.ip add 192.168.3.254 24
[sw4-Vlanif30]
Apr  7 2021 17:07:20-08:00 sw4 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
 on the interface Vlanif30 has entered the UP state.
Apr  7 2021 17:07:25-08:00 sw4 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 15, the 
change loop count is 0, and the maximum number of records is 4095.
[sw4-Vlanif30]int vl 40
Apr  7 2021 17:07:35-08:00 sw4 %%01IFNET/4/IF_STATE(l)[4]:Interface Vlanif40 has
 turned into UP state.ip add 192.168.4.254 24
[sw4-Vlanif40]
Apr  7 2021 17:07:46-08:00 sw4 %%01IFNET/4/LINK_STATE(l)[5]:The line protocol IP
 on the interface Vlanif40 has entered the UP state.int vl
Apr  7 2021 17:07:55-08:00 sw4 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 16, the 
change loop count is 0, and the maximum number of records is 4095. 50
[sw4-Vlanif50]
Apr  7 2021 17:07:56-08:00 sw4 %%01IFNET/4/IF_STATE(l)[6]:Interface Vlanif50 has
 turned into UP state.ip add 192.168.5.254 24
[sw4-Vlanif50]
Apr  7 2021 17:08:03-08:00 sw4 %%01IFNET/4/LINK_STATE(l)[7]:The line protocol IP
 on the interface Vlanif50 has entered the UP state.int
Apr  7 2021 17:08:05-08:00 sw4 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 17, the 
change loop count is 0, and the maximum number of records is 40iiint vl 60
[sw4-Vlanif60]
Apr  7 2021 17:08:19-08:00 sw4 %%01IFNET/4/IF_STATE(l)[8]:Interface Vlanif60 has
 turned into UP state.
[sw4-Vlanif60]ip add 192.168.6.254 24
[sw4-Vlanif60]
Apr  7 2021 17:08:28-08:00 sw4 %%01IFNET/4/LINK_STATE(l)[9]:The line protocol IP
 on the interface Vlanif60 has entered the UP state.
[sw4-Vlanif80]dis cu
#
sysname sw4
#
vlan batch 10 20 30 40 50 60 80
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default
 domain default_admin
 local-user admin password simple admin
 local-user admin service-type http
#
interface Vlanif1
#
interface Vlanif10
 ip address 192.168.1.254 255.255.255.0
#
interface Vlanif20
 ip address 192.168.2.254 255.255.255.0
#
interface Vlanif30
 ip address 192.168.3.254 255.255.255.0
#
interface Vlanif40
 ip address 192.168.4.254 255.255.255.0
#
interface Vlanif50
 ip address 192.168.5.254 255.255.255.0
#
interface Vlanif60
 ip address 192.168.6.254 255.255.255.0
#
interface Vlanif80
 ip address 192.168.8.1 255.255.255.0
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/4
#
interface GigabitEthernet0/0/5
#
interface GigabitEthernet0/0/6
#
interface GigabitEthernet0/0/7
#
interface GigabitEthernet0/0/8
#
interface GigabitEthernet0/0/9
#
interface GigabitEthernet0/0/10
#
interface GigabitEthernet0/0/11
#
interface GigabitEthernet0/0/12
#
interface GigabitEthernet0/0/13
#
interface GigabitEthernet0/0/14
#
interface GigabitEthernet0/0/15
#
interface GigabitEthernet0/0/16
#
interface GigabitEthernet0/0/17
#
interface GigabitEthernet0/0/18
#
interface GigabitEthernet0/0/19
#
interface GigabitEthernet0/0/20
#
interface GigabitEthernet0/0/21
#
interface GigabitEthernet0/0/22
#
interface GigabitEthernet0/0/23
#
interface GigabitEthernet0/0/24
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
#
return
[sw4-Vlanif80]

将路由器的接口地址配置好

[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.8.2 24
Apr  7 2021 19:07:23-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 12.1.1.1 24
Apr  7 2021 19:07:36-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R1-GigabitEthernet0/0/1]int g0/0/2
[R1-GigabitEthernet0/0/2]ip add 13.1.1.1 24
Apr  7 2021 19:07:49-08:00 R1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/2 has entered the UP state. 
[R1-GigabitEthernet0/0/2]
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
Apr  7 2021 19:08:41-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 24.1.1.1 24
Apr  7 2021 19:09:03-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R2-GigabitEthernet0/0/1]
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 13.1.1.2 24
Apr  7 2021 19:09:43-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 34.1.1.1 24
Apr  7 2021 19:09:52-08:00 R3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R3-GigabitEthernet0/0/1]
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]
[R4-GigabitEthernet0/0/0]ip add 34.1.1.2 24
[R4-GigabitEthernet0/0/0]
Apr  7 2021 19:10:21-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip add 24.1.1.2 24
Apr  7 2021 19:10:33-08:00 R4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R4-GigabitEthernet0/0/1]int g0/0/2
[R4-GigabitEthernet0/0/2]ip add 192.168.7.254 24
[R4-GigabitEthernet0/0/2]
Apr  7 2021 19:10:48-08:00 R4 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/2 has entered the UP state. 
[R4-GigabitEthernet0/0/2]

在交换机上配置静态

[sw4]ip route-static 0.0.0.0 0 192.168.8.2
[sw4-GigabitEthernet0/0/4]dis ip ro
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 17       Routes : 17       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   Static  60   0          RD   192.168.8.2     Vlanif80
      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.1.0/24  Direct  0    0           D   192.168.1.254   Vlanif10
  192.168.1.254/32  Direct  0    0           D   127.0.0.1       Vlanif10
    192.168.2.0/24  Direct  0    0           D   192.168.2.254   Vlanif20
  192.168.2.254/32  Direct  0    0           D   127.0.0.1       Vlanif20
    192.168.3.0/24  Direct  0    0           D   192.168.3.254   Vlanif30
  192.168.3.254/32  Direct  0    0           D   127.0.0.1       Vlanif30
    192.168.4.0/24  Direct  0    0           D   192.168.4.254   Vlanif40
  192.168.4.254/32  Direct  0    0           D   127.0.0.1       Vlanif40
    192.168.5.0/24  Direct  0    0           D   192.168.5.254   Vlanif50
  192.168.5.254/32  Direct  0    0           D   127.0.0.1       Vlanif50
    192.168.6.0/24  Direct  0    0           D   192.168.6.254   Vlanif60
  192.168.6.254/32  Direct  0    0           D   127.0.0.1       Vlanif60
    192.168.8.0/24  Direct  0    0           D   192.168.8.1     Vlanif80
    192.168.8.1/32  Direct  0    0           D   127.0.0.1       Vlanif80

在R1上配置静态

[R1]ip route-static 192.168.0.0 16 192.168.8.1
[R1]ip route-static 192.168.7.0 24 13.1.1.2 preference 70
[R1]ip route-static 192.168.7.0 255.255.255.0 12.1.1.2
[R1]dis ip ro
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 15       Routes : 15       

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.0.0/16  Static  60   0          RD   192.168.8.1     GigabitEthernet
0/0/0
    192.168.7.0/24  Static  70   0          RD   13.1.1.2        GigabitEthernet
0/0/2
    192.168.8.0/24  Direct  0    0           D   192.168.8.2     GigabitEthernet
0/0/0
    192.168.8.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
  192.168.8.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[R1]

R2上的静态配置

[R2]ip route-static 192.168.0.0 16 12.1.1.1
[R2]ip route-static 192.168.7.0 24 24.1.1.2
[R2]dis ip ro
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 12       Routes : 12       

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
       24.1.1.0/24  Direct  0    0           D   24.1.1.1        GigabitEthernet
0/0/1
       24.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
     24.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.0.0/16  Static  60   0          RD   12.1.1.1        GigabitEthernet
0/0/0
    192.168.7.0/24  Static  60   0          RD   24.1.1.2        GigabitEthernet
0/0/1
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[R2]

R3上的静态配置

[R3]ip route-static 192.168.0.0 16 13.1.1.1
[R3]ip route-static 192.168.7.0 24 34.1.1.2
[R3]dis ip ro
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
       34.1.1.0/24  Direct  0    0           D   34.1.1.1        GigabitEthernet
0/0/1
       34.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
     34.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.0.0/24  Static  60   0          RD   13.1.1.1        GigabitEthernet
0/0/0
    192.168.7.0/24  Static  60   0          RD   34.1.1.2        GigabitEthernet
0/0/1
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[R3]

R4上的静态配置

[R4]ip route-static 0.0.0.0 0 24.1.1.1
[R4]ip route-static 0.0.0.0 0 34.1.1.1 preference 70
[R4]dis ip ro
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 14       Routes : 14       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   Static  60   0          RD   24.1.1.1        GigabitEthernet
0/0/1
       24.1.1.0/24  Direct  0    0           D   24.1.1.2        GigabitEthernet
0/0/1
       24.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
     24.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
       34.1.1.0/24  Direct  0    0           D   34.1.1.2        GigabitEthernet
0/0/0
       34.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
     34.1.1.255/32  Direct  0    0           D   127.0.0.1       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
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
    192.168.7.0/24  Direct  0    0           D   192.168.7.254   GigabitEthernet
0/0/2
  192.168.7.254/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
  192.168.7.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[R4]

此时全网互通

三层交换机监控网络与外网互通的原理 监控三层交换机配置_三层交换机监控网络与外网互通的原理_02


三层交换机监控网络与外网互通的原理 监控三层交换机配置_云计算_03


三层交换机监控网络与外网互通的原理 监控三层交换机配置_三层交换_04


三层交换机监控网络与外网互通的原理 监控三层交换机配置_三层交换机_05


三层交换机监控网络与外网互通的原理 监控三层交换机配置_三层交换机监控网络与外网互通的原理_06


三层交换机监控网络与外网互通的原理 监控三层交换机配置_云计算_07


在这里插入图片描述

三层交换机监控网络与外网互通的原理 监控三层交换机配置_三层交换_08


三层交换机监控网络与外网互通的原理 监控三层交换机配置_云计算_09


三层交换机监控网络与外网互通的原理 监控三层交换机配置_链路_10


原来pc21路线是经过R2到达pc7

三层交换机监控网络与外网互通的原理 监控三层交换机配置_三层交换_11


将R2端口断开后走的路线是走R3

三层交换机监控网络与外网互通的原理 监控三层交换机配置_三层交换_12