三层交换机、LACP和路由器混合配置!

三层交换机

1.含义:

  • 三层交换相当于二层交换机交换加上三层路由转发
  • 使用三层交换技术实现了VLAN间的通信

2.三层交换机配置实验

实验目的:全网互通,R1和R4之间设置浮动路由
在这里插入图片描述
1)设置好各PC机的IP地址、子网掩码和网关,及路由器接口的IP地址

[R1-GigabitEthernet0/0/0]ip address 10.0.0.2 24
[R1-GigabitEthernet0/0/1]ip address 30.0.0.1 24
[R1-GigabitEthernet2/0/0]ip address 50.0.0.1 24
[R2-GigabitEthernet0/0/0]ip address 50.0.0.2 24
[R2-GigabitEthernet0/0/1]ip address 20.0.0.1 24
[R3-GigabitEthernet0/0/0]ip address 30.0.0.2 24
[R3-GigabitEthernet0/0/1]ip address 40.0.0.1 24

[R4-GigabitEthernet0/0/0]ip address 20.0.0.2 24
[R4-GigabitEthernet0/0/1]ip address 192.168.7.1 24
[R4-GigabitEthernet2/0/0]ip address 40.0.0.2 24

2)分别在SW1、SW2和SW3上设置vlan,并设置三台二层交换机之间lacp链路聚合,设置三台二层交换机与三层交换机的trunk模式

[SW1]vlan batch 10 20 30 40 50 60
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1]int e0/0/4
[SW1-Ethernet0/0/4]p l a
[SW1-Ethernet0/0/4]p d v 10
[SW1-Ethernet0/0/4]int e0/0/5
[SW1-Ethernet0/0/5]p l a 
[SW1-Ethernet0/0/5]p d v 20
[SW1-Ethernet0/0/5]int e0/0/6
[SW1-Ethernet0/0/6]p l t
[SW1-Ethernet0/0/6]p t a v a
[SW1]int Eth-Trunk 1
[SW1-Eth-Trunk1]mode lacp-static 
[SW1-Eth-Trunk1]max active-linknumber 2
[SW1-Eth-Trunk1]trunkport e 0/0/1 to 0/0/3
[SW1-Eth-Trunk1]p l t
[SW1-Eth-Trunk1]p t a v a
[SW1]dis eth-trunk 1
Eth-Trunk1's state information is:
Local:
LAG ID: 1                   WorkingMode: STATIC                               
Preempt Delay: Disabled     Hash arithmetic: According to SIP-XOR-DIP         
System Priority: 32768      System ID: 4c1f-ccbe-0835                         
Least Active-linknumber: 1  Max Active-linknumber: 2                          
Operate status: up          Number Of Up Port In Trunk: 2                     
--------------------------------------------------------------------------------
ActorPortName          Status   PortType PortPri PortNo PortKey PortState Weight
Ethernet0/0/1          Selected 100M     32768   2      289     10111100  1     
Ethernet0/0/2          Selected 100M     32768   3      289     10111100  1     
Ethernet0/0/3          Unselect 100M     32768   4      289     10100000  1     

Partner:
--------------------------------------------------------------------------------
ActorPortName          SysPri   SystemID        PortPri PortNo PortKey PortState
Ethernet0/0/1          32768    4c1f-ccbc-6753  32768   2      289     10111100
Ethernet0/0/2          32768    4c1f-ccbc-6753  32768   3      289     10111100
Ethernet0/0/3          32768    4c1f-ccbc-6753  32768   4      289     10110000
[SW2]vlan batch 10 20 30 40 50 60 
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW2]int e0/0/7
[SW2-Ethernet0/0/7]p l a
[SW2-Ethernet0/0/7]p d v 30
[SW2-Ethernet0/0/7]int e0/0/8
[SW2-Ethernet0/0/8]p l a 
[SW2-Ethernet0/0/8]p d v 40
[SW2-Ethernet0/0/8]int e0/0/9
[SW2-Ethernet0/0/9]p l t
[SW2-Ethernet0/0/9]p t a v a
[SW2]int Eth-Trunk 1
[SW2-Eth-Trunk1]mode lacp-static
[SW2-Eth-Trunk1]trunkport e 0/0/1 to 0/0/3
[SW2]int Eth-Trunk 2
[SW2-Eth-Trunk2]mode lacp-static 
[SW2-Eth-Trunk2]max active-linknumber 2
[SW2-Eth-Trunk2]trunkport e 0/0/4 to 0/0/6
[SW2-Eth-Trunk1]p l t
[SW2-Eth-Trunk1]p t a v a
[SW2]dis eth-trunk 2
Eth-Trunk2's state information is:
Local:
LAG ID: 2                   WorkingMode: STATIC                               
Preempt Delay: Disabled     Hash arithmetic: According to SIP-XOR-DIP         
System Priority: 32768      System ID: 4c1f-ccbc-6753                         
Least Active-linknumber: 1  Max Active-linknumber: 2                          
Operate status: up          Number Of Up Port In Trunk: 2                     
--------------------------------------------------------------------------------
ActorPortName          Status   PortType PortPri PortNo PortKey PortState Weight
Ethernet0/0/4          Selected 100M     32768   5      545     10111100  1     
Ethernet0/0/5          Selected 100M     32768   6      545     10111100  1     
Ethernet0/0/6          Unselect 100M     32768   7      545     10100000  1     

Partner:
--------------------------------------------------------------------------------
ActorPortName          SysPri   SystemID        PortPri PortNo PortKey PortState
Ethernet0/0/4          32768    4c1f-ccd4-0a44  32768   2      545     10111100
Ethernet0/0/5          32768    4c1f-ccd4-0a44  32768   3      545     10111100
Ethernet0/0/6          32768    4c1f-ccd4-0a44  32768   4      545     10110000
[SW3]vlan batch 10 20 30 40 50 60
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW3]int e0/0/4
[SW3-Ethernet0/0/4]p l a 
[SW3-Ethernet0/0/4]p d v 50
[SW3-Ethernet0/0/4]int e0/0/5
[SW3-Ethernet0/0/5]p l a 
[SW3-Ethernet0/0/5]p d v 60
[SW3-Ethernet0/0/5]int e0/0/6
[SW3-Ethernet0/0/6]p l t
[SW3-Ethernet0/0/6]p t a v a
[SW3]int Eth-Trunk 2
[SW3-Eth-Trunk2]mode lacp-static 
[SW3-Eth-Trunk2]trunkport e 0/0/1 to 0/0/3
[SW3-Eth-Trunk2]p l t
[SW3-Eth-Trunk2]p t a v a
[SW3]dis eth-trunk 2
Eth-Trunk2's state information is:
Local:
LAG ID: 2                   WorkingMode: STATIC                               
Preempt Delay: Disabled     Hash arithmetic: According to SIP-XOR-DIP         
System Priority: 32768      System ID: 4c1f-ccd4-0a44                         
Least Active-linknumber: 1  Max Active-linknumber: 8                          
Operate status: up          Number Of Up Port In Trunk: 2                     
--------------------------------------------------------------------------------
ActorPortName          Status   PortType PortPri PortNo PortKey PortState Weight
Ethernet0/0/1          Selected 100M     32768   2      545     10111100  1     
Ethernet0/0/2          Selected 100M     32768   3      545     10111100  1     
Ethernet0/0/3          Unselect 100M     32768   4      545     10110000  1     

Partner:
--------------------------------------------------------------------------------
ActorPortName          SysPri   SystemID        PortPri PortNo PortKey PortState
Ethernet0/0/1          32768    4c1f-ccbc-6753  32768   5      545     10111100
Ethernet0/0/2          32768    4c1f-ccbc-6753  32768   6      545     10111100
Ethernet0/0/3          32768    4c1f-ccbc-6753  32768   7      545     10100000

3)在RSW上添加vlan,在G0/0/1、G0/0/2和G0/0/3设置trunk模式,将G0/0/4添加到vlan80中,并在其vlanif接口设置IP地址。

[RSW]int g0/0/1
[RSW-GigabitEthernet0/0/1]p l t
[RSW-GigabitEthernet0/0/1]p t a v a
[RSW]int g0/0/2
[RSW-GigabitEthernet0/0/2]p l t
[RSW-GigabitEthernet0/0/2]p t a v a
[RSW-GigabitEthernet0/0/2]int g0/0/3
[RSW-GigabitEthernet0/0/3]p l t
[RSW-GigabitEthernet0/0/3]p t a v a
[RSW]vlan batch 10 20 30 40 50 60
Info: This operation may take a few seconds. Please wait for a moment...done.
[RSW]int Vlanif 10
[RSW-Vlanif10]ip address 192.168.1.1 24
[RSW-Vlanif10]int Vlanif 20
[RSW-Vlanif20]ip address 192.168.2.1 24
[RSW-Vlanif20]int Vlanif 30
[RSW-Vlanif30]ip address 192.168.3.1 24
[RSW-Vlanif30]int Vlanif 40
[RSW-Vlanif40]ip address 192.168.4.1 24
[RSW-Vlanif40]int Vlanif 50
[RSW-Vlanif50]ip address 192.168.5.1 24
[RSW-Vlanif50]int Vlanif 60
[RSW-Vlanif60]ip address 192.168.6.1 24
[RSW]int g0/0/4
[RSW-GigabitEthernet0/0/4]p l a
[RSW-GigabitEthernet0/0/4]port default v 80
[RSW]int Vlanif 80
[RSW-Vlanif80]ip address 10.0.0.1 24

4)最后分别设置好静态路由,在RI和R4上设置浮动路由

[RSW]ip route-static 192.168.7.0 24  10.0.0.2
[R1]ip route-static 192.168.7.0 24 50.0.0.2
[R1]ip route-static 192.168.7.0 24 30.0.0.2 pre	
[R1]ip route-static 192.168.7.0 24 30.0.0.2 preference 70
[R1]ip route-static 0.0.0.0 0.0.0.0 10.0.0.1
[R2]ip route-static 192.168.7.0 24 20.0.0.2
[R2]ip route-static 0.0.0.0 0.0.0.0 50.0.0.1
[R3]ip route-static 192.168.7.0 24 40.0.0.2
[R3]ip route-static 0.0.0.0 0.0.0.0 30.0.0.1
[R4]ip route-static 0.0.0.0 0.0.0.0 20.0.0.1
[R4]ip route-static 0.0.0.0 0.0.0.0 40.0.0.1 preference 70

5)用ping命令测试此时全网互通,把R1–R2–R4这条路断开仍能互通

PC>ping 192.168.5.2

Ping 192.168.5.2: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.5.2: bytes=32 seq=2 ttl=127 time=63 ms
From 192.168.5.2: bytes=32 seq=3 ttl=127 time=78 ms
From 192.168.5.2: bytes=32 seq=4 ttl=127 time=79 ms
From 192.168.5.2: bytes=32 seq=5 ttl=127 time=78 ms

--- 192.168.5.2 ping statistics ---
  5 packet(s) transmitted
  4 packet(s) received
  20.00% packet loss
  round-trip min/avg/max = 0/74/79 ms
PC>ping 192.168.7.2

Ping 192.168.7.2: 32 data bytes, Press Ctrl_C to break
From 192.168.7.2: bytes=32 seq=1 ttl=124 time=78 ms
From 192.168.7.2: bytes=32 seq=2 ttl=124 time=47 ms
From 192.168.7.2: bytes=32 seq=3 ttl=124 time=47 ms
From 192.168.7.2: bytes=32 seq=4 ttl=124 time=47 ms
From 192.168.7.2: bytes=32 seq=5 ttl=124 time=63 ms

--- 192.168.7.2 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 47/56/78 ms
  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值