您的位置:首页 > 编程语言 > PHP开发

cisco交换机端口聚合、VTP、ACL配置实例

2013-07-29 00:31 357 查看
端口聚合又称作链路聚合,即将几个链路作聚合处理以达到增加交换机之间的连接带宽,避免网络瓶颈的目的。 链路聚合控制协议实现了如何将两个以上的以太网链路组合起来成为高带宽通道。其实现方法是在交换机上把多个物理端口的链路连接捆绑在一起形成一个简单的逻辑连接 这个逻辑连接被称为聚合端口。 冗余链路和流量负载平衡是端口聚合的根本目的。

一、二层端口上的链路聚合

端口的聚合有两种方式,一种是手动的方式,一个是自动协商的方式。

(1)手动方式 这种方式很简单,设置端口成员链路两端的模式为“on”。

命令格式为: channel-group <number组号> mode on

(2)自动方式 自动方式有两种协议:PAgP(Port Aggregation Protocol)和LACP(Link aggregation Control Protocol)。

PAgP:Cisco设备的端口聚合协议,有auto和desirable两种模式。 auto模式在协商中只收不发,desirable模式的端口收发协商的数据包。 LACP:标准的端口聚合协议802.3ad,有active和passive两种模式。 active相当于PAgP的auto,而passive相当于PAgP的desirable。

1:假设要把F0/23和F0/24聚合,那么分别在起端口配置里面输入:

switch(config)#int range fastethernet 0/23-24

switch(config-if)#switchport trunk encapsulation dot1q

switch(config-if)#switchport mode trunk

switch(config-if)#channel-group 1 mode on //注意这里的on就说明用的是手动的方式,如果用自动方式,那么就要看你在接口上启用的是什么协议了

switch(config-if)#channel-protocol {pagp|lacp} //之后的配置就看你起用了什么协议

二、三层端口上的链路聚合

由于EtherChannel大多工作在物理层,所以可将多个3层接口组合成一条单独的通道。

下面来看步骤:

switch(config)#interface port-channel 1 //创建逻辑端口通道

switch(config-if)#ip address 192.168.10.1 255.255.255.0 //配置通道IP地址

switch(config-if)#interface gi1/0/1 //将二层端口添加到三层逻辑通道

switch(config-if)#no ip address //移除任何协议寻址

switch(config-if)#no switchport //确保端口工作在三层

switch(config-if)#ip channel-group 1 mode on //将端口分配给EtherChannel

switch(config-if)#interface gi1/0/2

switch(config-if)#no ip address

switch(config-if)#no switchport

switch(config-if)#ip channel-group 1 mode on

1、为使Port Channel正常工作,Port
Channel的成员端口必须具备以下相同的属性:

a) 端口均为全双工模式;

b) 端口速率相同;

c) 端口的类型必须一样,比如同为以太口或同为光纤口;

d) 端口同为Access端口并且属于同一个VLAN或同为Trunk端口;

e) 如果端口为Trunk端口,则其Allowed
VLAN和Native VLAN属性也应该相同。

2、支持任意两个交换机物理端口的汇聚,最大组数为6个,组内最多的端口数为8个。

3、一些命令不能在port-channel上的端口使用,包括:arp,bandwidth,ip,ip-forward

等;

4、在使用强制生成端口聚合组时,由于汇聚是手工配置触发的,如果由于端口的VLAN

信息不一致导致汇聚失败的话,汇聚组一直会停留在没有汇聚的状态,必须通过往该group增加和删除端口来触发端口再次汇聚,如果VLAN信息还是不一致仍然不能汇聚成功。直到VLAN信息都一致并且有增加和删除端口触发汇聚的情况下端口才能汇聚成功;

5、检查对端交换机的对应端口是否配置端口聚合组,且要查看配置方式是否相同,如果本端是手工方式则对端也应该配置成手工方式,如果本端是LACP动态生成则对端也应该是LACP动态生成,否则端口聚合组不能正常工作;还有一点要注意的是如果两端收发的都是LACP协议,至少有一端是ACTIVE的,否则两端都不会发起LACP数据报;

6、port-channel一旦形成之后,所有对于端口的设置只能在port-channel端口上进行;

7、LACP必须和Security和802.1X的端口互斥,如果端口已经配置上述两种协议,就不允许被起用LACP;

三、端口聚合的两端接口类型可以一致,也可以不一致,比如一端是三层接口,一端是二层接口,三层接口一般是网关或者路由接口

channel-group mode 另解:

(1)ON, 这种模式会强制端口不使用思科私有PAgP而形成EtherChannel.

在这种模式下,如果希望EtherChannel能够正确的工作,那么就要求链路伙伴的EtherChannel都处于On模式。

(2)Auto 这中模式会使端口进入自动协商。如果端口接收到PAgP数据包,那么就形成EtherChannel. 但是这种模式下端口不会主动发起协商。

(3)Desirable 这种模式是cisco的PAGP协商模式,主动协商建立通道,将使得端口利用PAgP进入形成EtherChannel的协商状态。在配置EtherChannel的时候,推荐使用desirable

实验:

网络拓扑:





**************** 基本配置 ****************

SW1> en ;进入特权模式

SW1# conf t ;进入全局配置模式

SW1(config)# hostname SW1 ;设置交换机的主机名

SW1(config)# enable secret cisco ;设置特权加密口令

SW1(config)# enable password cisco ;设置特权非密口令

SW1(config)# line console 0 ;进入控制台口

SW1(config-line)# login ;允许登录

SW1(config-line)# password cisco1 ;设置登录口令xx

SW1(config)# line vty 0 4 ;进入虚拟终端

SW1(config-line)# login ;允许登录

SW1(config-line)# password cisco2 ;设置登录口令xx

SW1# exit ;返回命令

**************** 链路聚合 ****************

SW1:2960

interface Port-channel 1

description Channel group member f0/1-2

switchport

switchport trunk encapsulation dot1q

switchport mode trunk

int ran f0/1 - 2

description Connect to SW5 on port f0/1-2

switchport trunk encapsulation dot1q

switchport mode trunk

channel-group 1 mode desirable

switchport trunk allowed vlan all

SW2:2960

interface Port-channel 2

description Channel group member f0/1-2

switchport

switchport trunk encapsulation dot1q

switchport mode trunk

int ran f0/1 - 2

description Connect to SW5 on port f0/3-4

switchport trunk encapsulation dot1q

switchport mode trunk

channel-group 2 mode desirable

switchport trunk allowed vlan all

SW3:2960

interface Port-channel 3

description Channel group member f0/1-2

switchport

switchport trunk encapsulation dot1q

switchport mode trunk

int ran f0/1 - 2

description Connect to SW5 on port f0/5-6

switchport trunk encapsulation dot1q

switchport mode trunk

channel-group 3 mode desirable

switchport trunk allowed vlan all

SW4:2960

interface Port-channel 4

description Channel group member f0/1-2

switchport

switchport trunk encapsulation dot1q

switchport mode trunk

int ran f0/1 - 2

description Connect to SW5 on port f0/7-8

switchport trunk encapsulation dot1q

switchport mode trunk

channel-group 4 mode desirable

switchport trunk allowed vlan all

SW5: 3560

interface Port-channel 1

description Channel group member SW1 f0/1-2

switchport

switchport trunk encapsulation dot1q

switchport mode trunk

int ran f0/1 - 2

description Connect to SW1 on port f0/1-2

switchport trunk encapsulation dot1q

switchport mode trunk

channel-group 1 mode auto

switchport trunk allowed vlan all

interface Port-channel 2

description Channel group member SW2 f0/1-2

switchport

switchport trunk encapsulation dot1q

switchport mode trunk

int ran f0/3 - 4

description Connect to SW2 on port f0/1-2

switchport trunk encapsulation dot1q

switchport mode trunk

channel-group 2 mode auto

switchport trunk allowed vlan all

interface Port-channel 3

description Channel group member SW3 f0/1-2

switchport

switchport trunk encapsulation dot1q

switchport mode trunk

int ran f0/5 - 6

description Connect to SW3 on port f0/1-2

switchport trunk encapsulation dot1q

switchport mode trunk

channel-group 3 mode auto

switchport trunk allowed vlan all

interface Port-channel 4

description Channel group member SW4 f0/1-2

switchport

switchport trunk encapsulation dot1q

switchport mode trunk

int ran f0/7 - 8

description Connect to SW4 on port f0/1-2

switchport trunk encapsulation dot1q

switchport mode trunk

channel-group 4 mode auto

switchport trunk allowed vlan all

sh ip int bri

**************** 配置VTP ****************

SW5: 3560

SW5#vlan database

SW5(vlan)#vtp server

Device mode already VTP SERVER.

SW5(vlan)#vtp domain tianyu

Changing VTP domain name from NULL to tianyu

SW5(vlan)#vtp password cisco

Setting device VLAN database password to cisco

SW5(vlan)#exit

APPLY completed.

Exiting....

SW1:2960

SW1#vlan database

SW1(vlan)#vtp client

Setting device to VTP CLIENT mode.

SW1(vlan)#vtp domain tianyu

Domain name already set to tianyu .

SW1(vlan)#vtp password cisco

Setting device VLAN database password to cisco.

SW1(vlan)#vlan 3 name db

SW1(vlan)#vlan 4 name platform

SW1(vlan)#vlan 5 name web

SW1(vlan)#end

SW1(config)#int range f0/3 - 8

SW1(config-if-range)#switchport mode access

SW1(config-if-range)#switchport access vlan 3

SW1(config-if-range)#no sh

SW1(config-if-range)#exit

SW1(config)#int ran f0/9 - 14

SW1(config-if-range)#switchport mode access

SW1(config-if-range)#switchport access vlan 4

SW1(config-if-range)#no sh

SW1(config-if-range)#exit

SW1(config)#int ran f0/15 - 24

SW1(config-if-range)#switchport mode access

SW1(config-if-range)#switchport access vlan 5

SW1(config-if-range)#no sh

SW1(config-if-range)#exit

SW2:2960

SW2#vlan database

SW2(vlan)#vtp client

Setting device to VTP CLIENT mode.

SW2(vlan)#vtp domain tianyu

Domain name already set to tianyu .

SW2(vlan)#vtp password cisco

Setting device VLAN database password to cisco.

SW2(config)#int range f0/3 - 8

SW2(config-if-range)#switchport mode access

SW2(config-if-range)#switchport access vlan 3

SW2(config-if-range)#no sh

SW2(config-if-range)#exit

SW2(config)#int ran f0/9 - 14

SW2(config-if-range)#switchport mode access

SW2(config-if-range)#switchport access vlan 4

SW2(config-if-range)#no sh

SW2(config-if-range)#exit

SW2(config)#int ran f0/15 - 24

SW2(config-if-range)#switchport mode access

SW2(config-if-range)#switchport access vlan 5

SW2(config-if-range)#no sh

SW2(config-if-range)#exit

/*SW3、SW4也类似的配置*/

SW5: 3560

SW5(config)#ip routing

SW5(config)#int vlan 3

SW5(config-if)#ip add 192.168.3.1 255.255.255.0

SW5(config-if)#no sh

SW5(config-if)#exit

SW5(config)#int vlan 4

SW5(config-if)#ip add 192.168.4.1 255.255.255.0

SW5(config-if)#no sh

SW5(config-if)#exit

SW5(config)#int vlan 5

SW5(config-if)#ip add 192.168.5.1 255.255.255.0

SW5(config-if)#no sh

SW5(config-if)#exit

sh ip route

sh vtp stat

sh vlan bri

sh int tr

**************** 配置ACL ****************

/*vlan3与vlan5之间互访,vlan4与vlan5之间互访,禁止vlan3与vlan4之间互访*/

SW5(config)# access-list 101 permit ip 192.168.3.0 0.0.0.255 192.168.5.0 0.0.0.255

SW5(config)# access-list 102 permit ip 192.168.4.0 0.0.0.255 192.168.5.0 0.0.0.255

SW5(config)# access-list 103 permit ip 192.168.5.0 0.0.0.255 0.0.0.0 255.255.255.255

**************** 应用ACL至VLAN端口 ****************

SW5(config)# int vlan 3

SW5(config-if)# ip access-group 101 in

SW5(config)# int vlan 4

SW5(config-if)# ip access-group 102 in

SW5(config)# int f0/24

SW5(config-if)# ip access-group 103 in

**************** 端口镜像:3560 ****************

监听指定vlan

SW5#show monitor 检查是否已存在镜像的配置

SW5#conf t 进入全局模式

SW5(config)#no monitor session 1

SW5(config)#monitor session 1 source vlan 3 - 5 both 监控vlan 3 - 5

SW5(config)#monitor session 1 destination int f0/23 把信息复制到f0/23

SW5(config)#end 返回

SW5#show monitor

监听指定端口

SW5#show monitor 检查是否已存在镜像的配置

SW5#conf t 进入全局模式

SW5(config)#no monitor session 1

SW5(config)#monitor session 2 source int f0/24 both 监控端口f0/24

SW5(config)#monitor session 2 destination int f0/23 把信息复制到f0/23

SW5(config)#end 返回

SW5#show monitor session 2

经过以上配置后,就可以用sinffer进行抓包了!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: