锐捷交换机常用操作命令
锐捷交换机常用命令

(3.交换机对已经绑定的IP进行MAC检查,如果不相同,丢弃该帧;对没有绑定的不检查,并照样转发该报文,建议在核心层层使用.
2. 交换机防主机欺骗用功能
S2126#conf
S2126(config)# int g0/23
----进入第23接口,准备在该接口绑定用户的MAC和ip地址
S2126(config-if)# switchport port-security ----开启端口安全功能
S2126(config)#end ----退会特权模式
S2126# wr ----保存配置
注释:可以通过在接口下设置最大的安全地址个数从而来控制控制该接口下可使用的主机数,安全地址的个数跟交换机的硬件资源有关,建议在接入层上使用该项.
S2126(config-if)#switchport port-security maximum 1设置最大mac地址绑定数量,适合该口下只接一台电脑.
S2126(config-if)# switchport port-security mac-address 0016.d390.6cc5 ip-address 172.16.40.101 ----在23端口下绑定ip地址是172.16.40.101 MAC地址是0016.d390.6cc5的主机,确保该主机可以正常使用网络,如果该主机修改ip或者MAC地址则无法使用网络,可以添加多条来实现对接入主机的控制
1.交换机地址绑定(address-bind)功能
S2126#conf
S2126(config)# address-bind 172.16.40.101 0016.d390.6cc5
----绑定ip地址为172.16.40.101 MAC地址为0016.d390.6cc5的主机让其使用网络
锐捷交换机常见基本命令

MSTP
• • • • • • • • vlan 100 vlan 200 interface FastEthernet 0/1 switchport mode trunk interface FastEthernet 0/10 switchport access vlan 100 interface FastEthernet 0/16 switchport access vlan 200
• • • • • • • •
router rip !启用rip路由协议 version 2 !配置rip版本号(默认版本1) network 192.168.1.0 0.0.0.3 network 192.168.2.0 !发布直连网络号 !接口下启• • •
r1(config)#line vty 0 !创建telnet线路(虚拟) r1(config-line)#password 口令 !配置口令 r1(config-line)#login !允许登录
• • • • • •
router ospf 1 !启用OSPF进程 network 10.1.1.0 0.0.0.3 area 0 network 192.168.2.0 0.0.0.255 area 0 !发布直连网络号 !接口启用OSPF(接受/发送OSPF路由)
• • • • •
ip prefix-list test permit 192.168.1.0/24 !前缀列表 router rip distribute-list prefix test in FastEthernet 0/0 !路由过滤
• • • • • • •
router ospf 2 area 0 authentication message-digest interface FastEthernet 0/0 ip ospf authentication ip ospf message-digest-key 1 md5 12345 1:KEY ID 12345:预共享密钥
(完整版)锐捷交换机命令大全

【第一部分】交换机支持的命令: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路由协议。
锐捷交换机、路由器常用命令

锐捷交换机、路由器常用命令锐捷交换机、路由器常用命令推荐交换机配置命令模式EXEC模式:用户模式switch>交换机信息的查看,简单测试命令特权模式switch#查看、管理交换机配置信息,测试、调试配置模式:全局配置模式switch(config)#配置交换机的整体参数接口配置模式switch(config-if)#配置交换机的接口参数进入全局配置模式Switch#c onfigure terminalSwitch(config)#exitSwitch#进入接口配置模式Switch(config)#interface fastethernet 0/1 Switch(config-if)#exitSwitch(config)#从子模式下直接返回特权模式Switch(config-if)#endSwitch#命令行其他功能获得帮助switch#?switch#show ?命令简写全写:switch# configure terminal简写:Switch# config使用历史命令Switch# (向上键)Switch# (向下键)配置交换机Telnet功能配置远程登陆密码Switch(config)#enable secret level 1 0 ruijie配置进入特权模式密码Switch (config)#enable secret level 15 0 ruijie 为交换机配置管理IPSwitch (config)#interface vlan 1Switch (config-if)#no shutdownSwitch (config-if)#ip address 192.168.1.1 255.255.255.0Switch (config-if)#end配置文件的管理保存配置将当前运行的参数保存到flash 中用于系统初始化时初始化参数Switch#copy running-config startup-config Switch#write memorySwitch#write删除配置永久性的删除flash 中不需要的文件使用命令delete flash:config.text删除当前的配置:在配置命令前加no例:switch(config-if)# no ip address查看配置文件内容Switch#show configure 查看保存在FLASH 里的配置信息Switch#show running-config 查看RAM里当前生效的配置配置Port VLAN创建VLAN10,将它命名为test的例子Switch# configure terminalSwitch(config)# vlan 10Switch(config-vlan)# name testSwitch(config-vlan)# end把接口0/10加入VLAN10Switch# configure terminalSwitch(config)# interface fastethernet 0/10 Switch(config-if)# switchport mode access Switch(config-if)# switchport access vlan 10 Switch(config-if)# end将一组接口加入某一个VLANSwitch(config)#interface range fastethernet 0/1-8,0/15,0/20Switch(config-if-range)# switchport access vlan 20注:连续接口0/1-8,不连续接口用逗号隔开,但一定要写明模块编号配置Tag VLAN-Trunk把Fa0/1配成Trunk口Switch# configure terminalSwitch(config)# interface fastethernet0/1 Switch(config-if)# switchport mode trunk把端口Fa0/20 配置为Trunk端口,但是不包含VLAN 2:Switch(config)# interface fastethernet 0/20 Switch(config-if)# switchport trunk allowed vlan remove 2Switch(config-if)# endNative VLAN配置命令:Switch(config-if)# switchport trunk native vlan 20Switch(config-if)# end注意:每个Trunk口的缺省native VLAN是VLAN 1 在配置Trunk链路时,请确保连接链路两端的Trunk口属于相同的native VLAN保存/清除VLAN信息将VLAN信息保存到flash中Switch#write memory从flash中只清除VLAN信息Switch#delete flash:vlan.dat从RAM中删除VLANSwitch(config)#no vlan VLAN-id生成树协议的配置开启生成树协议Switch(config)#Spanning-tree关闭生成树协议Switch(config)#no Spanning-tree配置生成树协议的类型Switch(config)#Spanning-tree mode stp/rstp锐捷全系列交换机默认使用MSTP协议配置交换机优先级Switch(config)#spanning-tree priority <0-61440>(“0”或“4096”的倍数、共16个、缺省32768)恢复到缺省值Switch(config)# no spanning-tree priority配置交换机端口的优先级Switch(config)#interface interface-typeinterface-numberSwitch(config-if)#spanning-tree port-priority number配置STP、RSTPSpanning Tree 的缺省配置:关闭STPSTP Priority 是32768STP port Priority 是128STP port cost 根据端口速率自动判断Hello Time 2秒Forward-delay Time 15秒Max-age Time 20秒可通过spanning-tree reset 命令让spanning tree 参数恢复到缺省配置查看生成树协议配置显示生成树状态Switch#show spanning-tree显示端口生成树协议的状态Switch#show spanning-tree interface fastethernet <0-2/1-24>配置aggregate port将该接口加入一个APSwitch#c onfigure terminalSwitch(config) # interface interface-type interface-idSwitch(config-if-range)#port-groupport-group-number如果这个AP不存在,可自动创建AG端口查看聚合端口的汇总信息Switch#show aggregateport summary查看聚合端口的流量平衡方式Switch#show aggregateport load-balance路由器上配置telnet第一步: 配置端口地址RouterA# configure terminal !进入全局配置模式RouterA(config)# interface fastethernet 1/0!进入路由器接口配置模式RouterA(config-if)# ip address 192.168.0.1 255.255.255.0!配置路由器管理接口IP 地址RouterA(config-if)# no shutdown !开启路由器f 1/0接口第二步:配置远程登录密码RouterA(config)# line vty 0 4 !进入路由器线路配置模式RouterA(config-line)#login !配置远程登录RouterA(config-line)# password star !设置路由器远程登录密码为“star”RouterA(config-line)#end第三步:配置路由器特权模式密码RouterA(config)# enable secret star !设置路由器特权模式密码为“star”或者RouterA(config)# enable password star查看配置文件show version !查看版本及引导信息show running-config !查看运行配置show startup-config !查看用户保存在NVRAM中的配置文件保存配置文件Router#copy running-config startup-config Router#write memoryRouter#write删除配置文件Router#delete flash:config.text !删除初始配置文件查看路由信息router#show ip routeCodes: C - connected,S –static,R –RIP,O- OSPFIA - OSPF inter area,E1-OSPF external type 1 E2 - OSPF external type 2,* - candidate default Gateway of last resort is 10.5.5.5 to network 0.0.0.0172.16.0.0/24 is subnetted, 1 subnetsC 172.16.11.0 is directly connected, serial1/2 O E2 172.22.0.0/16 [110/20] via 10.3.3.3, 01:03:01, Serial1/2S* 0.0.0.0/0 [1/0] via 10.5.5.5静态路由配置命令配置静态路由用命令ip routerouter(config)#ip route [网络编号] [子网掩码] [转发路由器的IP地址/本地接口]例:ip route 192.168.10.0 255.255.255.0 serial 1/2例:ip route 192.168.10.0 255.255.255.0 172.16.2.1静态路由描述转发路径的方式有两种指向本地接口(即从本地某接口发出)指向下一跳路由器直连接口的IP地址(即将数据包交给X.X.X.X)配置默认路由:router(config)#ip route 0.0.0.0 0.0.0.0 [转发路由器的IP地址/本地接口]RIP路由协议的版本RIPv1有类路由协议,不支持VLSM以广播的形式发送更新报文不支持认证RIPv2无类路由协议,支持VLSM以组播的形式发送更新报文支持明文和MD5的认证配置RIP协议配置步骤1、开启RIP路由协议进程Router(config)#router rip2、申请本路由器参与RIP协议的直连网段信息Router(config-router)#network 192.168.1.03、指定RIP协议的版本2(默认是version1) Router(config-router)#version 24、在RIPv2版本中关闭自动汇总Router(config-router)#no auto-summary查看RIP配置信息验证RIP的配置Router#show ip protocols显示路由表的信息Router#show ip route清除IP路由表的信息Router#clear ip route在控制台显示RIP的工作状态Router#debug ip ripOSPF协议OSPF配置如下:1、创建loopback接口,定义ROUTE ID routerA(config)#interface loopback 10routerA(config)#ip address 192.168.100.1 255.255.255.02、开启OSPF进程routerA(config)#router ospf 1010代表进程编号,只具有本地意义3、申请直连网段routerA(config-router)#network 10.1.1.0 0.0.0.255 area 0注意反掩码和区域号查看OSPF配置信息验证OSPF的配置Router#show ip ospf显示路由表的信息Router#show ip route清除IP路由表的信息Router#clear ip route在控制台显示OSPF的工作状态Router#debug ip ospf三层交换的路由功能三层交换机默认开启路由功能Switch(config)#ip routing (开启三层交换机路由功能)三层交换机配置路由接口的两种方法开启三层交换机物理接口的路由功能Switch(config)#interface fastethernet 0/5 Switch(config-if)#no switchportSwitch(config-if)#ip address 192.168.1.1 255.255.255.0Switch(config-if)#no shutdown关闭物理接口路由功能Switch(config-if)# switchport采用SVI方式(switch virtual interface)Switch(config)#interface vlan 10Switch(config-if)#ip address 192.168.1.1.255 255.255.0Switch(config-if)#no shutdown三层交换机和路由器相连的网络方法一(SVI):Switch(config)#interface f0/10Switch(config-if)#switchport access vlan 10 Switch(config-if)#exitSwitch(config)#interface vlan 10 switch(config-if)#ip address 192.168.10.1 255.255.255.0Switch(config-if)#no shutdown方法二(路由接口):Switch(config)#interface f0/10Switch(config-if)#no switchportSwitch(config-if)#ip address 192.168.10.1 255.255.255.0Switch(config-if)#no shutdown三层交换机路由协议的配置静态路由Switch(config)#ip route x.x.x.x x.x.x.x [x.x.x.x/interface]RIPSwitch(config)#router ripSwitch(config-router)#network X.X.X.X Switch(config-router)#version 2注:三层交换机不支持no auto-summary OSPFSwitch(config)#router ospfSwitch(config)#network X.X.X.X X.X.X.X area x查看三层交换机路由配置查看路由接口信息Switch#show ip interface查看路由表。
锐捷交换机主要命令

锐捷交换机主要命令锐捷交换机基本操作1.进入特权模式Switch>enableSwitch#2.返回用户模式Switch#exitPress RETURN to get started!Switch>配置模式:全局配置模式[主机名(config)#]:配置交换机的整体参数子模式:1.线路配置模式[主机名(config-line)#]:配置交换机的线路参数2.接口配置模式[主机名(config-if)#]:配置交换机的接口参数1.进入全局配置模式下Switch#configure terminalSwitch(config)#exitSwitch#2.进入线路配置模式Switch(config)#line console 0Switch(config-line)#exitSwitch(config)#3.进入接口配置模式Switch(config)#interface fastEthernet 0/1Switch(config-if)#exitSwitch(config)#从子模式下直接返回特权模式Switch(config-if)#endSwitch#交换机操作帮助特点:1.支持命令简写(按TAB键将命令补充完整)2.在每种操作模式下直接输入“?”显示该模式下所有的命令3.命令空格“?”显示命令参数并对其解释说明4.字符“?”显示以该字符开头的命令5.命令历史缓存: (Ctrl+P)显示上一条命令,(Ctrl+N)显示下一条命令6.错误提示信息交换机显示命令:显示交换机硬件及软件的信息Switch#show version显示当前运行的配置参数Switch#show running-config显示保存的配置参数Switch#show configure常用交换机EXEC命令将当前运行的配置参数复制到flash:Switch#write memoryBuilding configuration...[OK]Switch#清空flash中的配置参数:Switch#delete flash:config.textSwitch#交换机重新启动:Switch#reloadSystem configuration has been modified. Save? [yes/no]:nProceed with reload? [confirm]配置交换机主机名:Switch(config)#hostname S2126GS2126G(config)#配置交换机口令:1、配置交换机的登陆密码S2126G(config)#enable secret level 1 0 star“0”表示输入的是明文形式的口令2、配置交换机的特权密码S2126G(config)#enable secret level 15 0 Star“0”表示输入的是明文形式的口令常用交换机配置命令:1、为交换机分配管理IP地址S2126G(config)#interface vlan 1S2126G(config-if)#ip address {IP address} {IP subnetmask}[secondary] 2、将接口启用S2126G(config-if)#no shutdown3、将接口关闭S2126G(config-if)#shutdown4、配置接口速率S2126G(config-if)#speed [10|100|auto]5、配置接口双工模式S2126G(config-if)#duplex [auto|full|half显示接口状态:S2126G#show interfaces测定目的端的可达性:S2126G>ping {IP address}从TFTP服务器下载配置参数:S2126G#copy tftp startup-config管理交换机MAC地址表:1、查看MAC地址表S2126G#show mac-address-table2、配置MAC地址表记录的生存时间(缺省为300秒)S2126G(config)#mac-address-table aging-time <10-1000000>3、查看MAC地址表记录的生存时间S2126G#show mac-address-table aging-timeVLAN的配置:1.添加一个VLANS2126G(config)#vlan <1-4094>S2126G(config-vlan)#2.为VLAN命名(可选)S2126G(config-vlan)#name将交换机端口分配到VLAN1.配置Port VLANSwitch(config-if)#switchport access vlan <1-4094>2.配置Tag VLANSwitch(config-if)#switchport mode trunk1).配置本地(native)VLANSwitch(config-if)#switchport trunk native vlan <1-4094>2).从主干链路中清除VLANSwitch(config-if)#switchport trunk allowed vlan except注:VLAN1不可被清除VLAN的验证:1.显示全部的VLAN:Switch#show vlan2.显示单独的VLAN :Switch#show vlan id <1-4094>将VLAN信息保存到flash中:Switch#write memory从flash中清除VLAN信息:Switch#delete flash:vlan.datRSTP的配置:1.启用生成树:S2126G(config)#spanning-tree2.配置交换机优先级:S2126G(config)#spanning-tree priority <0-61440>“0”或“4096”的倍数(RSTP BPDU该值后12bit全0)3.配置交换机端口优先级:S2126G(config-if)#spanning-tree port-priority <0-240>“0”或“16”的倍数(RSTP BPDU该值后4bit全0)4、生成树hello时间的配置(由Root决定):S2126G(config)#spanning-tree hello-time <1-10>5、生成树的验证:Switch#show spanning-treeSwitch#show spanning-tree interface <接口名称> <接口编号>以上用于锐捷交换机的。
锐捷交换机常用操作命令

一、交换机配置模式介绍 (2)二、交换机基本配置 (2)2.1 接口介质类型配置 (3)2.2 接口速度/双工配置 (3)2.3 VLAN配置 (4)2.4 端口镜像 (5)2.5 端口聚合 (6)2.6 交换机堆叠 (6)2.7 ACL配置 (7)2.8 端口安全 (8)2.9 交换机防攻击配置 (10)2.10 DHCP配置 (13)2.11 三层交换机配置 (14)三、交换机常用查看命令 (16)一、交换机配置模式介绍交换机配置模式主要有:用户模式:此模式只可以简单的查看一些交换机的配置和一些简单的修改。
Switch>特权模式:此模式可以查看一些交换机的配置,后面讲述的很多show命令便是在此模式下进行的,还可以对一些简单的设置配置,例如时间。
Switch> enable //在用户模式下输入enable将进入配置模式Switch#全局配置模式:此模式下可以进行对交换机的配置,例如:命名、配置密码、设路由等。
Switch#configure erminal //特权模式下可以通过config terminal 命令进入配置模式Switch(config)#端口配置模式:此模式下对端口进行配置,如配置端口ip等。
Switch(config)#interface gigabitEthernet 1/1//配置模式下输入interface gigabitEthernet 1/1进入到端口g 1/1接口模式。
二、交换机基本配置交换机命名:在项目实施的时候,建议为处于不同位置的交换机命名,便于记忆,可提高后期管理效率。
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,此命令用户二层设备。
锐捷网络交换机常用命令

锐捷网络交换机常用操作命令手册目录一、交换机配置模式介绍3二、交换机基本配置32.1 接口介质类型配置42.2 接口速度/双工配置52.3 VLAN配置62.4 端口镜像92.5 端口聚合102.6 交换机堆叠112.7 ACL配置122.8 端口安全142.9 交换机防攻击配置162.10 DHCP配置212.11 三层交换机配置22三、交换机常用查看命令24一、交换机配置模式介绍交换机配置模式主要有:? 用户模式:此模式只可以简单的查看一些交换机的配置和一些简单的修改。
Switch>? 特权模式:此模式可以查看一些交换机的配置,后面讲述的很多show命令便是在此模式下进行的,还可以对一些简单的设置配置,例如时间。
Switch> enable //在用户模式下输入enable将进入配置模式Switch#? 全局配置模式:此模式下可以进行对交换机的配置,例如:命名、配置密码、设路由等。
Switch#configure erminal //特权模式下可以通过config terminal 命令进入配置模式Switch(config)#? 端口配置模式:此模式下对端口进行配置,如配置端口ip等。
Switch(config)#interface gigabitEthernet 1/1 //配置模式下输入interface gigabitEthernet 1/1进入到端口g 1/1接口模式。
二、交换机基本配置? 交换机命名:在项目实施的时候,建议为处于不同位置的交换机命名,便于记忆,可提高后期管理效率。
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,此命令用户二层设备。
锐捷交换机、路由器常用命令

锐捷交换机、路由器常用命令EXEC模式:用户模式switch>交换机信息的查看,简单测试命令特权模式switch#查看、管理交换机配置信息,测试、调试配置模式:全局配置模式switch(config)#配置交换机的整体参数接口配置模式switch(config-if)#配置交换机的接口参数进入全局配置模式Switch#c onfigure terminalSwitch(config)#exitSwitch#进入接口配置模式Switch(config)#interface fastethernet 0/1 Switch(config-if)#exitSwitch(config)#从子模式下直接返回特权模式Switch(config-if)#endSwitch#命令行其他功能获得帮助switch#?switch#show ?命令简写全写:switch# configure terminal简写:Switch# config使用历史命令Switch# (向上键)Switch# (向下键)配置交换机T elnet功能配置远程登陆密码Switch(config)#enable secret level 1 0 ruijie配置进入特权模式密码Switch (config)#enable secret level 15 0 ruijie为交换机配置管理IPSwitch (config)#interface vlan 1Switch (config-if)#no shutdownSwitch (config-if)#ip address 192.168.1.1 255.255.255.0 Switch (config-if)#end配置文件的管理保存配置将当前运行的参数保存到flash 中用于系统初始化时初始化参数Switch#copy running-config startup-configSwitch#write memorySwitch#write删除配置永久性的删除flash 中不需要的文件使用命令delete flash:config.text删除当前的配置:在配置命令前加no例:switch(config-if)# no ip address查看配置文件内容Switch#show configure 查看保存在FLASH里的配置信息Switch#show running-config 查看RAM里当前生效的配置配置Port VLAN创建VLAN10,将它命名为test的例子Switch# configure terminalSwitch(config)# vlan 10Switch(config-vlan)# name testSwitch(config-vlan)# end把接口 0/10加入VLAN10Switch# configure terminalSwitch(config)# interface fastethernet 0/10Switch(config-if)# switchport mode accessSwitch(config-if)# switchport access vlan 10Switch(config-if)# end将一组接口加入某一个VLANSwitch(config)#interface range fastethernet 0/1-8,0/15,0/20Switch(config-if-range)# switchport access vlan 20注:连续接口0/1-8,不连续接口用逗号隔开,但一定要写明模块编号配置Tag VLAN-Trunk把Fa0/1配成Trunk口Switch# configure terminalSwitch(config)# interface fastethernet0/1Switch(config-if)# switchport mode trunk把端口Fa0/20 配置为Trunk端口,但是不包含VLAN 2:Switch(config)# interface fastethernet 0/20Switch(config-if)# switchport trunk allowed vlan remove 2 Switch(config-if)# endNative VLAN配置命令:Switch(config-if)# switchport trunk native vlan 20Switch(config-if)# end注意:每个Trunk口的缺省native VLAN是VLAN 1在配置Trunk链路时,请确保连接链路两端的Trunk口属于相同的native VLAN保存/清除VLAN信息将VLAN信息保存到flash中Switch#write memory从flash中只清除VLAN信息Switch#delete flash:vlan.dat从RAM中删除VLANSwitch(config)#no vlan VLAN-id生成树协议的配置开启生成树协议Switch(config)#Spanning-tree关闭生成树协议Switch(config)#no Spanning-tree配置生成树协议的类型Switch(config)#Spanning-tree mode stp/rstp锐捷全系列交换机默认使用MSTP协议配置交换机优先级Switch(config)#spanning-tree priority <0-61440> (“0”或“4096”的倍数、共16个、缺省32768)恢复到缺省值Switch(config)# no spanning-tree priority配置交换机端口的优先级Switch(config)#interface interface-type interface-number Switch(config-if)#spanning-tree port-priority number配置STP、RSTPSpanning Tree 的缺省配置:关闭STPSTP Priority 是32768STP port Priority 是128STP port cost 根据端口速率自动判断Hello Time 2秒Forward-delay Time 15秒Max-age Time 20秒可通过spanning-tree reset 命令让spanning tree参数恢复到缺省配置查看生成树协议配置显示生成树状态Switch#show spanning-tree显示端口生成树协议的状态Switch#show spanning-tree interface fastethernet <0-2/1-24>配置aggregate port将该接口加入一个APSwitch#c onfigure terminalSwitch(config) # interface interface-type interface-idSwitch(config-if-range)#port-group port-group-number如果这个AP不存在,可自动创建AG端口查看聚合端口的汇总信息Switch#show aggregateport summary查看聚合端口的流量平衡方式Switch#show aggregateport load-balance路由器上配置telnet第一步: 配置端口地址RouterA# configure terminal !进入全局配置模式RouterA(config)# interface fastethernet 1/0!进入路由器接口配置模式RouterA(config-if)# ip address 192.168.0.1 255.255.255.0!配置路由器管理接口IP地址RouterA(config-if)# no shutdown !开启路由器f 1/0接口第二步:配置远程登录密码RouterA(config)# line vty 0 4 !进入路由器线路配置模式RouterA(config-line)# login !配置远程登录RouterA(config-line)# password star !设置路由器远程登录密码为“star”RouterA(config-line)#end第三步:配置路由器特权模式密码RouterA(config)# enable secret star !设置路由器特权模式密码为“star”或者RouterA(config)# enable password star查看配置文件show version !查看版本及引导信息show running-config !查看运行配置show startup-config !查看用户保存在NVRAM中的配置文件保存配置文件Router#copy running-config startup-configRouter#write memoryRouter#write删除配置文件Router#delete flash:config.text !删除初始配置文件查看路由信息router#show ip routeCodes: C - connected,S – static, R – RIP, O- OSPFIA - OSPF inter area,E1-OSPF external type 1E2 - OSPF external type 2,* - candidate default Gateway of last resort is 10.5.5.5 to network 0.0.0.0172.16.0.0/24 is subnetted, 1 subnetsC 172.16.11.0 is directly connected, serial1/2O E2 172.22.0.0/16 [110/20] via 10.3.3.3, 01:03:01, Serial1/2 S* 0.0.0.0/0 [1/0] via 10.5.5.5静态路由配置命令配置静态路由用命令ip routerouter(config)#ip route [网络编号] [子网掩码] [转发路由器的IP地址/本地接口]例:ip route 192.168.10.0 255.255.255.0 serial 1/2例:ip route 192.168.10.0 255.255.255.0 172.16.2.1静态路由描述转发路径的方式有两种指向本地接口(即从本地某接口发出)指向下一跳路由器直连接口的IP地址(即将数据包交给X.X.X.X)配置默认路由:router(config)#ip route 0.0.0.0 0.0.0.0 [转发路由器的IP地址/本地接口]RIP路由协议的版本RIPv1有类路由协议,不支持VLSM以广播的形式发送更新报文不支持认证RIPv2无类路由协议,支持VLSM以组播的形式发送更新报文支持明文和MD5的认证配置RIP协议配置步骤1、开启RIP路由协议进程Router(config)#router rip2、申请本路由器参与RIP协议的直连网段信息Router(config-router)#network 192.168.1.03、指定RIP协议的版本2(默认是version1)Router(config-router)#version 24、在RIPv2版本中关闭自动汇总Router(config-router)#no auto-summary查看RIP配置信息验证 RIP的配置Router#show ip protocols显示路由表的信息Router#show ip route清除 IP路由表的信息Router#clear ip route在控制台显示 RIP的工作状态Router#debug ip ripOSPF协议OSPF配置如下:1、创建loopback接口,定义ROUTE IDrouterA(config)#interface loopback 10routerA(config)#ip address 192.168.100.1 255.255.255.0 2、开启OSPF进程routerA(config)#router ospf 1010代表进程编号,只具有本地意义3、申请直连网段routerA(config-router)#network 10.1.1.0 0.0.0.255 area 0 注意反掩码和区域号查看OSPF配置信息验证 OSPF的配置Router#show ip ospf显示路由表的信息Router#show ip route清除 IP路由表的信息Router#clear ip route在控制台显示 OSPF的工作状态Router#debug ip ospf三层交换的路由功能三层交换机默认开启路由功能Switch(config)#ip routing (开启三层交换机路由功能)三层交换机配置路由接口的两种方法开启三层交换机物理接口的路由功能Switch(config)#interface fastethernet 0/5Switch(config-if)#no switchportSwitch(config-if)#ip address 192.168.1.1 255.255.255.0Switch(config-if)#no shutdown关闭物理接口路由功能Switch(config-if)# switchport采用SVI方式(switch virtual interface)Switch(config)#interface vlan 10Switch(config-if)#ip address 192.168.1.1.255 255.255.0Switch(config-if)#no shutdown三层交换机和路由器相连的网络方法一(SVI):Switch(config)#interface f0/10Switch(config-if)#switchport access vlan 10Switch(config-if)#exitSwitch(config)#interface vlan 10 switch(config-if)#ip address 192.168.10.1 255.255.255.0Switch(config-if)#no shutdown方法二(路由接口):Switch(config)#interface f0/10Switch(config-if)#no switchportSwitch(config-if)#ip address 192.168.10.1 255.255.255.0Switch(config-if)#no shutdown三层交换机路由协议的配置静态路由Switch(config)#ip route x.x.x.x x.x.x.x [x.x.x.x/interface]RIPSwitch(config)#router ripSwitch(config-router)#network X.X.X.XSwitch(config-router)#version 2注:三层交换机不支持no auto-summary OSPFSwitch(config)#router ospfSwitch(config)#network X.X.X.X X.X.X.X area x 查看三层交换机路由配置查看路由接口信息Switch#show ip interface。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
一、交换机配置模式介绍 (2)二、交换机基本配置 (2)2.1 接口介质类型配置 (3)2.2 接口速度/双工配置 (3)2.3 VLAN配置 (4)2.4 端口镜像 (5)2.5 端口聚合 (6)2.6 交换机堆叠 (6)2.7 ACL配置 (7)2.8 端口安全 (8)2.9 交换机防攻击配置 (10)2.10 DHCP配置 (13)2.11 三层交换机配置 (14)三、交换机常用查看命令 (16)一、交换机配置模式介绍交换机配置模式主要有:用户模式:此模式只可以简单的查看一些交换机的配置和一些简单的修改。
Switch>特权模式:此模式可以查看一些交换机的配置,后面讲述的很多show命令便是在此模式下进行的,还可以对一些简单的设置配置,例如时间。
Switch> enable //在用户模式下输入enable将进入配置模式Switch#全局配置模式:此模式下可以进行对交换机的配置,例如:命名、配置密码、设路由等。
Switch#configure erminal //特权模式下可以通过config terminal 命令进入配置模式Switch(config)#端口配置模式:此模式下对端口进行配置,如配置端口ip等。
Switch(config)#interface gigabitEthernet 1/1//配置模式下输入interface gigabitEthernet 1/1进入到端口g 1/1接口模式。
二、交换机基本配置交换机命名:在项目实施的时候,建议为处于不同位置的交换机命名,便于记忆,可提高后期管理效率。
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,此命令用户二层设备。
通过以上几个命令的配置,设备便可以实现远程管理,在项目实施时(尤其是设备位置比较分散)特别能提高效率。
2.1 接口介质类型配置锐捷为了降低SME客户的总体拥有成本,推出灵活选择的端口形式:电口和光口复用接口,方便用户根据网络环境选择对应的介质类型。
但光口和电口同时只能用其一,如使用了光口1F,则电口1不能使用。
接口介质类型的转换:Switch(config)#interface gigabitethernet 0/1Switch(config-if)#medium-type fiber //把接口工作模式改为光口Switch(config-if)#medium-type copper //把接口工作模式改为电口默认情况下,接口是工作在电口模式在项目实施中,如果光纤模块指示灯不亮,工作模式是否正确也是故障原因之一。
2.2 接口速度/双工配置命令格式:Switch(config)#interface interface-id //进入接口配置模式Switch(config-if)#speed {10 | 100 | 1000 | auto } //设置接口的速率参数,或者设置为autoSwitch(config-if)#duplex {auto | full | half} //设置接口的双工模式1000只对千兆口有效;默认情况下,接口的速率为auto,双工模式为auto。
配置实例:实例将gigabitethernet 0/1的速率设为1000M,双工模式设为全双工:Switch(config)#interface gigabitethernet 0/1Switch(config-if)#speed 1000Switch(config-if)#duplex full光口不能修改速度和双工配置,只能auto。
2.3 VLAN配置添加VLAN到端口:在交换机上建立VLAN:Switch (config)#vlan 100 //建立VLAN 100Switch (config)#name ruijie //该VLAN名称为ruijie将交换机接口划入VLAN 100中:Switch (config)#interface range f 0/1-48 //range表示选取了系列端口1-48,这个对多个端口进行相同配置时非常有用Switch (config-if-range)#switchport access vlan 100 //将接口划到VLAN 100中Switch (config-if-range)#no switchport access vlan //将接口划回到默认VLAN 1中,即端口初始配置交换机端口的工作模式:Switch(config)#interface fastEthernet 0/1Switch(config-if)#switchport mode access //该端口工作在access模式下Switch(config-if)#switchport mode trunk //该端口工作在trunk模式下如果端口下连接的是PC,则该端口一般工作在access模式下,默认配置为access模式。
如果端口是上联口,且交换机有划分多个VLAN,则该端口工作在TRUNK模式下。
NATIVE VLAN配置:Switch(config)#interface fastEthernet 0/1Switch(config-if)#switchport mode trunkSwitch(config-if)#switchport trunk native vlan 100 //设置该端口NATIVE VLAN为100 端口只有工作在TRUNK模式下,才可以配置NATIVE VLAN;在TRUNK上Native VLAN的数据是无标记的(Untagged),所以即使没有在端口即使没有工作在TRUNK模式下,Native Vlan仍能正常通讯;默认情况下,锐捷交换机的NATIVE VLAN为1。
建议不要更改。
VLAN修剪配置:Switch(config)#interface fastEthernet 0/2Switch(config-if)#switchport trunk allowed vlan remove 2-9,11-19,21-4094 //设定VLAN要修剪的VLANSwitch(config-if)#no switchport trunk allowed vlan //取消端口下的VLAN修剪VLAN信息查看:Switch#show vlanVLAN Name Status Ports---- -------------------------------- --------- ------------------------------- 1 default active Fa0/1 ,Fa0/11,Fa0/12Fa0/13,Fa0/14,Fa0/15Fa0/16,Fa0/17,Fa0/18Fa0/19,Fa0/20,Fa0/21Fa0/22,Fa0/23,Fa0/24100 VLAN0100 active Fa0/1 ,Fa0/2 ,Fa0/3Fa0/4 ,Fa0/5 ,Fa0/6Fa0/7 ,Fa0/8 ,Fa0/9Fa0/10Switch#2.4 端口镜像端口镜像配置:Switch (config)# monitor session 1 destination interface GigabitEthernet 0/2//配置G0/2为镜像端口Switch (config)# monitor session 1 source interface GigabitEthernet 0/1 both//配置G0/1为被镜像端口,且出入双向数据均被镜像。
Switch (config)# no monitor session 1 //去掉镜像1S21、S35等系列交换机不支持镜像目的端口当作普通用户口使用,如果需要做用户口,请将用户MAC与端口绑定。
锐捷SME交换机镜像支持一对多镜像,不支持多对多镜像。
去除TAG标记:Switch (config)# monitor session 1 destination interface GigabitEthernet 0/2 encapsulation replicate// encapsulation replicate表述镜像数据不带TAG标记。
目前该功能只有S37、S57、S86、S96交换机支持,其他型号交换机不支持。
锐捷交换机支持两种模式:镜像目的口输出报文是否带TAG根据源数据流输入的时候是否带TAG来决定。
强制所有的镜像输出报文都不带TAG ,受限于目前芯片的限制,只支持二层转发报文不带Tag,经过三层路由的报文,镜像目的端口输出的报文会带Tag。
端口镜像信息查看:S3750#sh monitor session 1Session: 1Source Ports:Rx Only : NoneTx Only : NoneBoth : Fa0/1Destination Ports: Fa0/2encapsulation replicate: true2.5 端口聚合端口聚合配置:Switch(config)#interface fastEthernet 0/1Switch (config-if)#port-group 1 //把端口f0/1加入到聚合组1中。
Switch (config-if)#no port-group 1 //把端口f0/1从聚合组1中去掉。
S2126G/50G交换机最大支持的6个AP,每个AP最多能包含8个端口。