锐捷交换机配置命令
(完整版)锐捷交换机命令大全

【第一部分】交换机支持的命令:1.交换机基本状态:switch: ;ROM状态,路由器是rommon>hostname> ;用户模式hostname# ;特权模式hostname(config)# ;全局配置模式hostname(config-if)# ;接口状态2.交换机口令设置:switch>enable ;进入特权模式switch#config terminal ;进入全局配置模式switch(config)#hostname;设置交换机的主机名switch(config)#enable secret xxx ;设置特权加密口令switch(config)#enable password xxa ;设置特权非密口令switch(config)#line console 0 ;进入控制台口switch(config-line)#line vty 0 4 ;进入虚拟终端switch(config-line)#login ;允许登录switch(config-line)#password xx ;设置登录口令xxswitch#exit ;返回命令3.交换机VLAN设置:switch#vlan database ;进入VLAN设置switch(vlan)#vlan 2 ;建VLAN 2switch(vlan)#no vlan 2 ;删vlan 2switch(config)#int f0/1 ;进入端口1switch(config-if)#switchport access vlan 2 ;当前端口加入vlan 2 switch(config-if)#switchport mode trunk ;设置为干线switch(config-if)#switchport trunk allowed vlan 1,2 ;设置允许的vlan switch(config-if)#switchport trunk encap dot1q ;设置vlan 中继switch(config)#vtp domain;设置发vtp域名switch(config)#vtp password;设置发vtp密码switch(config)#vtp mode server ;设置发vtp模式switch(config)#vtp mode client ;设置发vtp模式4.交换机设置IP地址:switch(config)#interface vlan 1 ;进入vlan 1switch(config-if)#ip address;设置IP地址switch(config)#ip default-gateway;设置默认网关switch#dir flash: ;查看闪存5.交换机显示命令:switch#write ;保存配置信息switch#show vtp ;查看vtp配置信息switch#show run ;查看当前配置信息switch#show vlan ;查看vlan配置信息switch#show interface ;查看端口信息switch#show int f0/0 ;查看指定端口信息【第二部分】路由器支持的命令:1.路由器显示命令:router#show run ;显示配置信息router#show interface ;显示接口信息router#show ip route ;显示路由信息router#show cdp nei ;显示邻居信息router#reload ;重新起动2.路由器口令设置:router>enable ;进入特权模式router#config terminal ;进入全局配置模式router(config)#hostname;设置交换机的主机名router(config)#enable secret xxx ;设置特权加密口令router(config)#enable password xxb ;设置特权非密口令router(config)#line console 0 ;进入控制台口router(config-line)#line vty 0 4 ;进入虚拟终端router(config-line)#login ;要求口令验证router(config-line)#password xx ;设置登录口令xx router(config)#(Ctrl+z) ;返回特权模式router#exit ;返回命令3.路由器配置:router(config)#int s0/0 ;进入Serail接口router(config-if)#no shutdown ;激活当前接口router(config-if)#clock rate 64000 ;设置同步时钟router(config-if)#ip address;设置IP地址router(config-if)#ip address second ;设置第二个IProuter(config-if)#int f0/0.1 ;进入子接口router(config-subif.1)#ip address;设置子接口IProuter(config-subif.1)#encapsulation dot1q;绑定vlan中继协议router(config)#config-register 0x2142 ;跳过配置文件router(config)#config-register 0x2102 ;正常使用配置文件router#reload ;重新引导4.路由器文件操作:router#copy running-config startup-config ;保存配置router#copy running-config tftp ;保存配置到tftprouter#copy startup-config tftp ;开机配置存到tftprouter#copy tftp flash: ;下传文件到flashrouter#copy tftp startup-config;下载配置文件ROM状态:Ctrl+Break ;进入ROM监控状态rommon>confreg 0x2142 ;跳过配置文件rommon>confreg 0x2102 ;恢复配置文件rommon>reset;重新引导rommon>copy xmodem: flash: ;从console传输文件rommon>IP_ADDRESS=10.65.1.2 ;设置路由器IP rommon>IP_SUBNET_MASK=255.255.0.0 ;设置路由器掩码rommon>TFTP_SERVER=10.65.1.1 ;指定TFTP服务器IP rommon>TFTP_FILE=c2600.bin ;指定下载的文件rommon>tftpdnld ;从tftp下载rommon>dir flash: ;查看闪存内容rommon>boot ;引导IOS5.静态路由:ip route;命令格式router(config)#ip route 2.0.0.0 255.0.0.0 1.1.1.2 ;静态路由举例router(config)#ip route 0.0.0.0 0.0.0.0 1.1.1.2 ;默认路由举例6.动态路由:router(config)#ip routing ;启动路由转发router(config)#router rip ;启动RIP路由协议。
锐捷交换机、路由器设备配置指令

锐捷交换机、路由器设备配置指令一、交换机RG-S3760-B配置指令RG-S3760-2#conf t设置链路聚合RG-S3760-2(config)#int range fa0/23-24RG-S3760-2(config-if-range)#port-group 1RG-S3760-2(config-if-range)#exitRG-S3760-2(config)#int aggregateport 1RG-S3760-2(config-if-AggregatePort 1)#sw mo trRG-S3760-2(config-if-AggregatePort 1)#exit创建Vlan10-40RG-S3760-2(config)#vlan 10RG-S3760-2(config-vlan)#vlan 20RG-S3760-2(config-vlan)#vlan 30RG-S3760-2(config-vlan)#vlan 40RG-S3760-2(config-vlan)#exit给Vlan30、40分配端口RG-S3760-2(config)#int range fa0/4-10RG-S3760-2(config-if-range)#sw mo acRG-S3760-2(config-if-range)#sw ac vlan 30RG-S3760-2(config-if-range)#no shutdownRG-S3760-2(config-if-range)#exitRG-S3760-2(config)#int range fa0/11-16RG-S3760-2(config-if-range)#sw mo acRG-S3760-2(config-if-range)#sw ac vlan 40RG-S3760-2(config-if-range)#exit二、交换机RG-S3760-A配置指令RG-S3760-1#conf tRG-S3760-1#ip routing设置链路聚合RG-S3760-1(config)#int range fa0/23-24RG-S3760-1(config-if-range)#port-group 1RG-S3760-1(config-if-range)#no shutdownRG-S3760-1(config-if-range)#exitRG-S3760-1(config)#int aggregateport 1RG-S3760-1(config-if-AggregatePort 1)#sw mo trRG-S3760-1(config-if-AggregatePort 1)#exit创建Vlan10-40RG-S3760-1(config)#vlan 10RG-S3760-1(config-vlan)#vlan 20RG-S3760-1(config-vlan)#vlan 30RG-S3760-1(config-vlan)#vlan 40给Vlan10、20分配端口RG-S3760-1(config)#int range fa0/4-10RG-S3760-1(config-if-range)#sw mo acRG-S3760-1(config-if-range)#sw ac vlan 10RG-S3760-1(config-if-range)#exitRG-S3760-1(config)#int range fa0/11-16RG-S3760-1(config-if-range)#sw mo acRG-S3760-1(config-if-range)#sw ac vlan 20RG-S3760-1(config-if-range)#exit给Vlan10-40配置管理 IPRG-S3760-1(config)#int vlan 10RG-S3760-1(config-if-VLAN 10)#ip address 172.16.10.254 255.255.255.0RG-S3760-1(config-if-VLAN 10)#no shutdownRG-S3760-1(config-if-VLAN 10)#exitRG-S3760-1(config)#int vlan 20RG-S3760-1(config-if-VLAN 20)#ip address 172.16.20.254 255.255.255.0RG-S3760-1(config-if-VLAN 20)#no shutdownRG-S3760-1(config-if-VLAN 20)#exitRG-S3760-1(config)#int vlan 30RG-S3760-1(config-if-VLAN 30)#ip address 172.16.30.253 255.255.255.0RG-S3760-1(config-if-VLAN 30)#no shutdownRG-S3760-1(config-if-VLAN 30)#exitRG-S3760-1(config)#int vlan 40RG-S3760-1(config-if-VLAN 40)#ip address 172.16.40.253 255.255.255.0RG-S3760-1(config-if-VLAN 40)#no shutdownRG-S3760-1(config-if-VLAN 40)#exit设置三层路由接口IPRG-S3760-1(config)#int fa0/1RG-S3760-1(config-if-FastEthernet 0/1)#no switchportRG-S3760-1(config-if-FastEthernet 0/1)#ip address 192.168.1.2 255.255.255.252 RG-S3760-1(config-if-FastEthernet 0/1)#no shutdownRG-S3760-1(config-if-FastEthernet 0/1)#exit设置动态路由、默认路由RG-S3760-1(config)#router ripRG-S3760-1(config-router)#version 2RG-S3760-1(config-router)#no auto-summaryRG-S3760-1(config-router)#network 192.168.1.0RG-S3760-1(config-router)#network 172.16.10.0RG-S3760-1(config-router)#network 172.16.20.0RG-S3760-1(config-router)#network 172.16.30.0RG-S3760-1(config-router)#network 172.16.40.0RG-S3760-1(config-router)#exitRG-S3760-1(config)#ip route 0.0.0.0 0.0.0.0 fa0/1RG-S3760-1(config)#end三、路由器RSR20-A配置指令Red-Giant#conf tRed-Giant(config)#hostname RSR20-ARSR20-A(config)#int fa1/0RSR20-A(config-if)#ip address 192.168.1.1 255.255.255.252 RSR20-A(config-if)#no shutdownRSR20-A(config-if)#exit设置电信IPRSR20-A(config)#int s1/2RSR20-A(config-if)#ip address 119.1.1.1 255.255.255.252 RSR20-A(config-if)#no shutdownRSR20-A(config-if)#exit设置动态路由、默认路由RSR20-A(config)#router ripRSR20-A(config-router)#version 2RSR20-A(config-router)#no auto-summaryRSR20-A(config-router)#network 192.168.1.0RSR20-A(config)#ip route 0.0.0.0 0.0.0.0 s1/2配置NATRSR20-A(config)#int fa1/0RSR20-A(config-if)#ip nat insideRSR20-A(config-if)#exitRSR20-A(config)#int s1RSR20-A(config-if)#ip nat outsideRSR20-A(config-if)#exitRSR20-A(config)#access-list 10 permit 172.16.10.0 0.0.0.255 RSR20-A(config)#access-list 10 permit 172.16.20.0 0.0.0.255 RSR20-A(config)#access-list 10 permit 172.16.30.0 0.0.0.255 RSR20-A(config)#access-list 10 permit 172.16.40.0 0.0.0.255RSR20-A(config)#ip nat pool net10 119.1.1.1 119.1.1.1 netmask 255.255.255.252 RSR20-A(config)#ip nat inside source list 10 pool net10 overload创建ACL,禁止172.16.20.0网去访问外网RSR20-A(config)#access-list 20 deny 172.16.20.0 0.0.0.255RSR20-A(config)#access-list 20 permit anyRSR20-A(config)#int fa1/0RSR20-A(config-if)#ip access-group 20 inRSR20-A(config-if)#exit四、路由器Internet配置指令R2600_2#conf tR2600_2 (config)#hostname Internet设置Internet路由器IPInternet (config)#int s1/2Internet (config-if)#ip address 119.1.1.2 255.255.255.252Internet (config-if)#clock rate 9600Internet (config-if)#no shutdownInternet (config-if)#exit设置Web服务器网关地址Internet 2(config)#int fa1/0Internet (config-if)#ip address 192.168.6.254 255.255.255.0Internet (config-if)#no shutdownInternet (config-if)#exit。
锐捷交换机配置命令

锐捷网络交换机的配置命令集交换机:>Enable 进入特权模式#Exit 返回上一级操作模式#End 返回到特权模式#write memory 或copy running-config startup-config 保存配置文件#del flash:config.text 删除配置文件(交换机及1700系列路由器)#erase startup-config 删除配置文件(2500系列路由器)#del flash:vlan.dat 删除Vlan配置信息(交换机)#Configure terminal 进入全局配置模式(config)# hostname switchA 配置设备名称为switchA(config)#banner motd & 配置每日提示信息 &为终止符(config)#enable secret level 1 0 star 配置远程登陆密码为star(config)#enable secret level 15 0 star 配置特权密码为starLevel 1为普通用户级别,可选为1~15,15为最高权限级别;0表示密码不加密(config)#enable services web-server 开启交换机WEB管理功能Services 可选以下:web-server(WEB管理)、telnet-server(远程登陆)等查看信息:#show running-config 查看当前生效的配置信息#show interface fastethernet 0/3 查看F0/3端口信息#show interface serial 1/2 查看S1/2端口信息#show interface 查看所有端口信息#show ip interface brief 以简洁方式汇总查看所有端口信息#show ip interface 查看所有端口信息#show version 查看版本信息#show mac-address-table 查看交换机当前MAC地址表信息#show running-config 查看当前生效的配置信息#show vlan 查看所有VLAN信息#show vlan id 10 查看某一VLAN (如VLAN10)的信息#show interface fastethernet 0/1 switchport 查看某一端口模式(如F 0/1) #show aggregateport 1 summary 查看聚合端口AG1的信息#show spanning-tree 查看生成树配置信息#show spanning-tree interface fastethernet 0/1 查看该端口的生成树状态#show port-security 查看交换机的端口安全配置信息#show port-security address 查看地址安全绑定配置信息#show ip access-lists listname 查看名为listname的列表的配置信息#show access-lists端口的基本配置:(config)#Interface fastethernet 0/3 进入F0/3的端口配置模式(config)#interface range fa 0/1-2,0/5,0/7-9 进入F0/1、F0/2、F0/5、F0/7、F0/8、F0/9的端口配置模式(config-if)#speed 10 配置端口速率为10M,可选10,100,auto(config-if)#duplex full 配置端口为全双工模式,可选full(全双工),half(半双式),auto(自适应)(config-if)#no shutdown 开启该端口(config-if)#switchport access vlan 10 将该端口划入VLAN10中,用于VLAN(config-if)#switchport mode trunk 将该端口设为trunk模式,用于Tag vlan 可选模式为access , trunk(config-if)#port-group 1 将该端口划入聚合端口AG1中,用于聚合端口聚合端口的创建(config)# interface aggregateport 1 创建聚合接口AG1(config-if)# switchport mode trunk 配置并保证AG1为 trunk 模式(config)#int f0/23-24(config-if-range)#port-group 1 将端口(端口组)划入聚合端口AG1中生成树(config)#spanning-tree 开启生成树协议(config)#spanning-tree mode stp 指定生成树类型为stp可选模式stp , rstp , mstp(config)#spanning-tree priority 4096 设置交换机的优先级为4096 , 优先级值小为高。
锐捷交换机配置命令

VLAN的基本配置
(config)#vlan 10 创建VLAN10
(config-vlan)#name vlanname 命名VLAN为vlanname
(config-if)#switchport access vlan 10 将该端口划入VLAN10中
某端口的接口配置模式下进行
(config-if)# switchport port-secruity maxmum 1 配置端口的最大连接数为1,最大连接数为128
(config-if)# switchport port-secruity violation shutdown
配置安全违例的处理方式为shutdown,可选为protect (当安全地址数满后,将未知名地址丢弃)、restrict(当违例时,发送一个Trap通知)、shutdown(当违例时将端口关闭,并发送Trap通知,可在全局模式下用errdisable recovery来恢复)
(config-if)# ip address 192.168.1.1 255.255.255.0
(config-if)# no shutdown
三层交换机路由协议
(config)# ip route 172.16.1.0 255.255.255.0 172.16.2.1 配置静态路由
查看信息
#show running-config 查看当前生效的配置信息
#show interface fastethernet 0/3 查看F0/3端口信息
#show interface serial 1/2 查看S1/2端口信息
#show interface 查看所有端口信息
#show vlan 查看所有VLAN信息
锐捷交换机配置命令

>Enable 进入特权模式#Exit 返回上一级操作模式#End 返回到特权模式#write memory 或copy running-config startup-config 保存配置文件#del flash:config.text 删除配置文件(交换机及1700系列路由器)#erase startup-config 删除配置文件(2500系列路由器)#del flash:vlan.dat 删除Vlan配置信息(交换机)#Configure terminal 进入全局配置模式(config)# hostname switchA配置设备名称为switchA(config)#banner motd & 配置每日提示信息&为终止符(config)#enable secret level 1 0 star 配置远程登陆密码为star(config)#enable secret level 15 0 star 配置特权密码为starLevel 1为普通用户级别,可选为1~15,15为最高权限级别;0表示密码不加密(config)#enable services web-server 开启交换机WEB管理功能Services 可选以下:web-server(WEB管理)、telnet-server(远程登陆)等查看信息#show running-config 查看当前生效的配置信息#show interface fastethernet 0/3 查看F0/3端口信息#show interface serial 1/2 查看S1/2端口信息#show interface 查看所有端口信息#show ip interface brief 以简洁方式汇总查看所有端口信息#show ip interface 查看所有端口信息#show version 查看版本信息#show mac-address-table 查看交换机当前MAC地址表信息#show running-config 查看当前生效的配置信息#show vlan 查看所有VLAN信息#show vlan id 10 查看某一VLAN (如VLAN10)的信息#show interface fastethernet 0/1 switchport 查看某一端口模式(如F 0/1)#show aggregateport 1 summary 查看聚合端口AG1的信息#show spanning-tree 查看生成树配置信息#show spanning-tree interface fastethernet 0/1 查看该端口的生成树状态#show port-security 查看交换机的端口安全配置信息#show port-security address 查看地址安全绑定配置信息#show ip access-lists listname 查看名为listname的列表的配置信息#show access-lists端口的基本配置(config)#Interface fastethernet 0/3 进入F0/3的端口配置模式(config)#interface range fa 0/1-2,0/5,0/7-9 进入F0/1、F0/2、F0/5、F0/7、F0/8、F0/9的端口配置模式(config-if)#speed 10 配置端口速率为10M,可选10,100,auto(config-if)#duplex full 配置端口为全双工模式,可选full(全双工),half(半双式),auto(自适应)(config-if)#no shutdown 开启该端口(config-if)#switchport access vlan 10 将该端口划入VLAN10中,用于VLAN(config-if)#switchport mode trunk 将该端口设为trunk模式,用于Tag vlan可选模式为access , trunk(config-if)#port-group 1 将该端口划入聚合端口AG1中,用于聚合端口聚合端口的创建(config)# interface aggregateport 1 创建聚合接口AG1(config-if)# switchport mode trunk 配置并保证AG1为trunk 模式(config)#int f0/23-24(config-if-range)#port-group 1 将端口(端口组)划入聚合端口AG1中生成树(config)#spanning-tree 开启生成树协议(config)#spanning-tree mode stp 指定生成树类型为stp可选模式stp , rstp , mstp(config)#spanning-tree priority 4096 设置交换机的优先级为4096 , 优先级值小为高。
锐捷交换机常用配置命令详解

交换机升级
*
方式二:XMODEM的升级方式 要升级的软件版本与当前运行版本有一定的要求时,可以通过XMODEM方式来进行升级。 步骤:主机的配置接口和PC机的串口相连接,并把超级终端速率设置为57600重新启动交换机后不断按ESC键,直到出现以下界面 TOOLS MENU ***************************************************** ******* 1 -- Download ****** ******* 2 -- Upload ****** ******* 3 -- File Info ****** ******* 4 -- Delete File ****** ******* 5 -- Rename File ****** ******* 6 -- Run Main File ****** ******* 7 -- Format Flash ****** ******* 8 -- Defrag Flash ****** ******* 9 -- download all files(DHCP + TFTP)****** ***************************************************** Input command:
*
锐捷网络使用培训
BRAND PLANING
内部材料
*
培训内容
CONTENTS
01
交换机的配置命令
03
GSN相关配置
02
SAM相关配置
交换机的配置培训
*
交换机的密码配置
如何清除密码
交换机的VLAN配置
交换机升级
交换机防病毒访问控制列表
锐捷交换机配置命令

#del flash:vlan.dat 删除Vlan配置信息(交换机)
#Configure terminal 进入全局配置模式
(config)# hostname switchA 配置设备名称为switchA
Level 1为普通用户级别,可选为1~15,15为最高权限级别;0表示密码不加密
(config)#enable services web-server 开启交换机WEB管理功能
Services 可选以下:web-server(WEB管理)、telnet-server(远程登陆)等
从TFTP服务器下载配置参数:S2126G#copy tftp startup-config
管理交换机MAC地址表:
1、查看MAC地址表
S2126G#show mac-address-table
2、配置MAC地址表记录的生存时间(缺省为300秒)
S2126G(config)#mac-address-table aging-time <10-1000000>
S2126G(config-vlan)#name
将交换机端口分配到VLAN
1.配置Port VLAN
Switch(config-if)#switchport access vlan <1-4094>
2.配置Tag VLAN
Switch(config-if)#switchport mode trunk
1).配置本地(native)VLAN
Switch(config-if)#switchport trunk native vlan <1-4094>
锐捷交换机配置命令大全

锐捷交换机配置命令一、交换机基本配置交换机命名:在项目实施的时候,建议为处于不同位置的交换机命名,便于记忆,可提高后期管理效率。
switch(config)#hostname ruijie //ruijie为该交换机的名字交换机配置管理密码:配置密码可以提高交换机的安全性,另外,telnet登录交换机的时候,必须要求有telnet管理密码。
switch (config)#enable secret level 1 0 rg //配置telnet管理密码为rg,其中1表示telnet 密码,0表示密码不加密switch (config)#enable secret level 15 0 rg //配置特权模式下的管理密码rg,其中15表示为特权密码交换机配置管理IPswitch (config)#interface vlan 1 //假设管理VLAN为VLAN 1switch (config-if)#ip address 192.168.1.1 255.255.255.0 //给管理VLAN配置管理IP地址switch (config-if)#no shutdown //激活管理IP,养成习惯,无论配置什么设备,都使用一下这个命令交换机配置网关:switch(config)#ip default-gateway 192.168.1.254 //假设网关地址为192.168.1.254,此命令用户二层设备。
通过以上几个命令的配置,设备便可以实现远程管理,在项目实施时(尤其是设备位置比较分散)特别能提高效率。
1.1 接口介质类型配置锐捷为了降低SME客户的总体拥有成本,推出灵活选择的端口形式:电口和光口复用接口,方便用户根据网络环境选择对应的介质类型。
但光口和电口同时只能用其一,如图1,如使用了光口1F,则电口1不能使用。
接口介质类型的转换:Switch(config)#interface gigabitethernet 0/1Switch(config-if)#medium-type fiber //把接口工作模式改为光口Switch(config-if)#medium-type copper //把接口工作模式改为电口默认情况下,接口是工作在电口模式在项目实施中,如果光纤模块指示灯不亮,工作模式是否正确也是故障原因之一。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
交换机>Enable 进入特权模式#Exit 返回上一级操作模式#End 返回到特权模式#write memory 或 copy running-config startup-config#del flash:config.text删除配置文件(交换机及1700系列路由器) #erase startup-config 删除配置文件(2500系列路由器)#del flash:vlan.dat 删除Vlan 配置信息(交换机)#Configure terminal 进入全局配置模式(config )# hostname switchA 配置设备名称为 switchA配置每日提示信息 &为终止符(config)#enable secret level 1 0 star 配置远程登陆密码为 star(config )#enable secret level 15 0 star 配置特权密码为 starLevel 1为普通用户级别,可选为 1〜15, 15为最高权限级别;0表示密码不加密(config )#enable services web-server 开启交换机 WEB 管理功能Services 可选以下:web-server (WEB 管理)、telnet-server (远程登陆)等查看信息#show running-config 查看当前生效的配置信息查看所有VLAN 信息 #show ip access-lists listname 查看名为 listname 的列表的配置信息#show access-lists端口的基本配置(config)#Interface fastethernet 0/3 (config)#interface range fa 0/1-2,0/5,0/7-9置模式(config-if)#speed 10(config-if)#duplex full(config-if)#no shutdown保存配置文件 (config)#banner motd & #show running-config 查看当前生效的配置信息#show interface fastethernet 0/3 #show interface serial 1/2 #show interface #show ip interface brief 查看F0/3端口信息查看S1/2端口信息查看所有端口信息以简洁方式汇总查看所有端口信息#show ip interface #show version 查看所有端口信息查看版本信息#show mac-address-table查看交换机当前MAC 地址表信息#show vlan id 10 查看某一 VLAN (如VLAN10)的信息#show interface fastethernet 0/1 switchport查看某一端口模式(如 F 0/1) #show aggregateport 1 summary查看聚合端口 AG1 的信息 查看生成树配置信息查看该端口的生成树状态 #show spanning-tree #show spanning-tree interface fastethernet 0/1查看交换机的端口安全配置信息#show port-security address 查看地址安全绑定配置信息#show port-security #show vlan进入F0/3的端口配置模式进入 F0/1、F0/2、F0/5、F0/7、F0/8、F0/9 的端口配配置端口速率为10M,可选10,100,auto配置端口为全双工模式,可选full(全双工),half(半双式),auto(自适应)开启该端口(config)# ip route 172.16.1.0 255.255.255.0 172.16.2.1 配置静态路由(config-if)#switchport access vlan 10 将该端口划入 VLAN10 中,用于 VLAN将该端口设为trunk 模式,用于Tag vlan(config-if)# switchport port-secruity violation shutdown 配置安全违例的处理方式为 shutdown ,可选为protect (当安全地址数满后,将未知名地址丢弃 )、 restrict(当违例时,发送一个 Trap 通知)、shutdown(当违例时将端口关闭,并发送Trap 通知,可在全局模式下用errdisable recovery 来恢复) 2 .IP 和MAC 地址绑定(config-if)#switchport port-security mac-address xxxx.xxxx.xxxx ip-address 172.16.1.1接口配置模式下配置 MAC 地址xxxx.xxxx.xxxx 和IP172.16.1.1进行绑定(MAC 地址注意用小写)三层路由功能(针对三层交换机)开启三层交换机的路由功能(config)# interface fastethernet 0/1开启端口的三层路由功能(这样就可以为某一端口配置 IP)(config-if)# ip address 192.168.1.1 255.255.255.0(config-if)# no shutdown三层交换机路由协议(config-if)#switchport mode trunk 可选模式为 access , trunk(config-if)#port-group 1聚合端口的创建 将该端口划入聚合端口 AG1中,用于聚合端口(config)# interface aggregateport 1创建聚合接口 AG1 (config-if)# switchport mode trunk配置并保证AG1为trunk 模式 (config)#int fO/23-24(config-if-range)#port-group 1生成树 将端口(端口组)划入聚合端口 AG1中(config)#spanning-tree 开启生成树协议(config)#spanning-tree mode stp指定生成树类型为 stp可选模式 stp , rstp , mstp (config)#spanning-tree priority 4096 设置交换机的优先级为 4096 ,优先级值小为高。
优先级可选值为0 , 4096,8192,……,为4096的倍数。
交换机默认值为 32768VLAN 的基本配置(config)#vlan 10 创建 VLAN10(config-vlan)#name vlanname 命名 VLAN 为 vlanname(config-if)#switchport access vlan 10 将该端口划入 VLAN10 中某端口的接口配置模式下进行(config)#interface vlan 10 进入 VLAN 10 的虚拟端口配置模式(config-if)# ip address 192.168.1.1 255.255.255.0 为 VLAN10 的虚拟端口配置 IP 及掩码,二层交换 机只能配置一个IP ,此IP 是作为管理IP 使用,例如,使用 Telnet 的方式登录的IP 地址(config-if)# no shutdown端口安全 启用该端口(config)# interface fastethernet 0/1进入一个端口 (config-if)# switchport port-security1 •配置最大连接数限制 开启该端口的安全功能(config-if)# switchport port-secruity maxmum 1配置端口的最大连接数为 1,最大连接数为128 (config)# ip routing (config-if)# no switchport注:172.16.1.0 255.255.255.0 为目标网络的网络号及子网掩码172.1621 为下一跳的地址,也可用接口表示,如ip route 172.16.1.0 255.255.255.0 serial1/2(172.16.2.0 所接的端口)(config)# router rip 开启RIP 协议进程(config-router)# network 172.16.1.0 申明本设备的直连网段信息(config-router)# version 2 开启RIP V2,可选为version 1(RIPV1)、version 2(RIPV2)(config-router)# no auto-summary 关闭路由信息的自动汇总功能(只有在RIPV2支持)(config)# router ospf 开启OSPF路由协议进程(针对1762,无需使用进程ID)(config)# router ospf 1 开启OSPF路由协议进程(针对2501,需要加OSPF进程ID) (config-router)# network 192.168.1.0 0.0.0.255 area 0申明直连网段信息,并分配区域号(area0为骨干区域)IP ACL :交换机采用命名的访问控制列表;分标准(stand)和扩展(extended)两种1标准ACL(config)#ip access-list stand listname 定义命名标准列表,命名为listname ,stand 为标准列表(config-std-nacl)#deny 192.168.30.0 0.0.0.255 拒绝来自192.168.30.0 网段的IP 流量通过注:deny :拒绝通过;可选:deny(拒绝通过)、permit(允许通过)192.168.30.0 0.0.0.255 :源地址及源地址通配符;可使用any表示任何IP(config-std-nacl)#permit any(config-std-nacl)#end 返回2.扩展ACL(config)#ip access-list extended listname定义命名扩展列表,命名为listname,extended 为扩展(config-ext-nacl)#deny tcp 192.168.30.0 0.0.0.255 192.168.10.0 0.0.0.255 eq www 拒绝源地址为192.168.30.0网段的IP访问目的地址为192.168.10.0网段的WWW 服务注:deny :拒绝通过,可选:deny(拒绝通过)、permit(允许通过)tcp:协议名称,协议可以是udp, ip,eigrp, gre, icmp, igmp, igrp 等等。