交换机配置命令

合集下载

交换机配置命令大全

交换机配置命令大全

交换机配置命令大全交换机是网络中非常重要的设备,它可以实现局域网内计算机之间的数据传输和通信。

在进行交换机的配置时,我们需要掌握一些基本的配置命令,以确保交换机能够正常运行并满足网络的需求。

下面将介绍一些常用的交换机配置命令,希望对大家有所帮助。

1. 设置交换机的主机名。

在配置交换机之前,我们首先需要设置交换机的主机名,以便在网络中进行识别和管理。

我们可以通过以下命令来设置交换机的主机名:```。

Switch(config)#hostname S1。

```。

这条命令将交换机的主机名设置为S1,您也可以根据实际情况进行修改。

2. 配置交换机的管理IP地址。

为了实现对交换机的远程管理,我们需要为交换机配置一个IP地址。

我们可以通过以下命令来配置交换机的管理IP地址:```。

Switch(config)#interface vlan 1。

Switch(config-if)#ip address 192.168.1.1 255.255.255.0。

Switch(config-if)#no shutdown。

```。

这条命令将VLAN 1接口的IP地址设置为192.168.1.1,子网掩码为255.255.255.0,并启用该接口。

3. 配置交换机端口。

在实际网络中,我们需要对交换机的端口进行配置,以满足不同设备的连接需求。

以下是一些常用的端口配置命令:```。

Switch(config)#interface fastethernet 0/1。

Switch(config-if)#switchport mode access。

Switch(config-if)#switchport access vlan 10。

```。

这条命令将FastEthernet 0/1端口设置为接入模式,并将该端口划分到VLAN 10中。

4. 配置交换机的VLAN。

VLAN是虚拟局域网的缩写,它可以将一个物理局域网划分成多个逻辑上的局域网。

交换机基本配置命令汇总大全

交换机基本配置命令汇总大全

交换机基本配置命令汇总大全一、交换机基本操作:1.1进入特权模式Switch>enableSwitch#1.2返回用户模式Switch#exitPress RETURN to get started!Switch>二、配置模式:全局配置模式[主机名(config)#]:配置交换机的整体参数2.1子模式:1.线路配置模式[主机名(config-line)#]:配置交换机的线路参数2.接口配置模式[主机名(config-if)#]:配置交换机的接口参数2.2进入、退出全局配置模式Switch#configure terminalSwitch(config)#exitSwitch#2.3进入、退出线路配置模式Switch(config)#line console0Switch(config-line)#exitSwitch(config)#2.4进入、退出接口配置模式Switch(config)#interface fastEthernet0/1Switch(config-if)#exitSwitch(config)#2.5从子模式下直接返回特权模式Switch(config-if)#endSwitch#三、交换机操作帮助:Ø支持命令简写(按TAB键将命令补充完整)Ø在每种操作模式下直接输入“?”显示该模式下所有的命令Ø命令空格“?”显示命令参数并对其解释说明Ø“字符?”显示以该字符开头的命令Ø命令历史缓存:(Ctrl+P)显示上一条命令,(Ctrl+N)显示下一条命令Ø错误提示信息四、交换机显示命令:Ø显示交换机硬件及软件的信息Switch#show versionØ显示当前运行的配置参数Switch#show running-configØ显示保存的配置参数Switch#show configure五、常用交换机flash中的命令:5.1将当前运行的配置参数复制到flashSwitch#write memoryBuilding configuration...[OK]Switch#5.2清空flashSwitch#delete flash:config.textSwitch#5.3交换机重新启动:Switch#reloadSystem configuration has been modified.Save?[yes/no]:n Proceed with reload?[confirm]5.4配置交换机主机名:Switch(config)#hostname S2126G-1S2126G-1(config)#5.5配置交换机口令:1)配置交换机的登陆密码S2126G(config)#enable secret level10star“0”表示输入的是明文形式的口令2)配置交换机的特权密码S2126G(config)#enable secret level150star“0”表示输入的是明文形式的口令六、常用交换机配置命令:6.1为交换机分配管理IPS2126G(config)#interface vlan1S2126G(config-if)#ip address{IP address}{IP subnetmask}[secondary]6.2将接口启用S2126G(config-if)#no shutdown6.3将接口关闭S2126G(config-if)#shutdown6.4配置接口速率S2126G(config-if)#speed[10|100|auto]6.5配置接口双工模式S2126G(config-if)#duplex[auto|full|half]七、显示接口状态:S2126G#show interface八、测定目的端的可达性:S2126G>ping{IP address}九、从TFTP服务器下载配置参数:S2126G#copy tftp startup-config十、管理交换机MAC地址表:10.1查看MACS2126G#show mac-address-table10.2配置MACS2126G(config)#mac-address-table aging-time<10-1000000> 10.3查看MACS2126G#show mac-address-table aging-time十一、VLAN的配置:11.1添加一个VLANS2126G(config)#vlan<1-4094>S2126G(config-vlan)#11.2为VLANS2126G(config-vlan)#name名字十二、将交换机端口分配到VLAN12.1配置Port VLANSwitch(config-if)#switchport access vlan<1-4094>12.2配置Tag VLANSwitch(config-if)#switchport mode trunk1)配置本地(native)VLANSwitch(config-if)#switchport trunk native vlan<1-4094> Native VLAN即PVID,默认情况下每个trunk口的native VLAN是12)从主干链路中清除VLANSwitch(config-if)#switchport trunk allowed vlanexcept vlan-list注:VLAN1不可被清除3)在主干链路中允许所有VLANSwitch(config-if)#switchport trunk allowed vlan all4)向主干链路中加入VLANSwitch(config-if)#switchport trunk allowed vlanadd vlan-list12.3VLAN1.显示全部的VLAN:Switch#show vlan2.显示单独的VLAN:Switch#show vlan id<1-4094>十三、RSTP的配置:13.1启用生成树:S2126G(config)#spanning-tree13.2配置交换机优先级:S2126G(config)#spanning-tree priority<0-61440>“0”或“4096”的倍数(RSTP BPDU该值后12bit全0)13.3配置交换机端口优先级:S2126G(config-if)#spanning-tree port-priority<0-240>“0”或“16”的倍数(RSTP BPDU该值后4bit全0)13.4生成树helloS2126G(config)#spanning-tree hello-time<1-10>13.5生成树的验证:Switch#show spanning-treeSwitch#show spanning-tree interface<接口名称><接口编号>十四、三层交换机路由功能:14.1开启三层交换机的路由功能Switch(config)#ip routing14.2开启端口的三层路由功能Switch(config)#interface fastethernet0/1Switch(config-if)#no switchport(这样就可以为某一端口配置IP)Switch(config-if)#ip address192.168.1.1255.255.255.0 Switch(config-if)#no shutdown。

华为交换机配置命令大全

华为交换机配置命令大全

华为交换机配置命令大全华为交换机是一种高性能、高可靠的数据通信设备,广泛应用于各种网络环境中。

为了更好地使用华为交换机,我们需要了解一些基本的配置命令。

本文将为大家详细介绍华为交换机的配置命令大全,帮助大家更好地了解和使用华为交换机。

1. 登录华为交换机。

首先,我们需要登录华为交换机进行配置。

一般来说,我们可以通过串口、Telnet或SSH方式登录交换机。

以SSH方式登录为例,我们可以使用以下命令:```shell。

ssh -l username 192.168.1.1。

```。

其中,username为登录用户名,192.168.1.1为交换机的IP地址。

登录成功后,我们需要输入密码进行验证。

2. 查看交换机当前配置。

在登录成功后,我们可以使用以下命令查看交换机的当前配置信息:```shell。

display current-configuration。

```。

这条命令可以显示出交换机当前的全部配置信息,包括接口配置、VLAN配置、路由配置等。

3. 配置交换机接口。

接下来,我们可以对交换机的接口进行配置。

比如,我们可以通过以下命令配置一个VLAN接口:```shell。

interface Vlanif1。

ip address 192.168.1.1 255.255.255.0。

```。

这条命令将为VLAN接口Vlanif1配置IP地址为192.168.1.1,子网掩码为255.255.255.0。

4. 配置交换机VLAN。

除了配置接口,我们还可以对交换机的VLAN进行配置。

比如,我们可以使用以下命令创建一个VLAN:```shell。

vlan 10。

```。

这条命令将创建一个VLAN ID为10的VLAN。

5. 配置交换机路由。

在需要进行路由配置时,我们可以使用以下命令添加静态路由:```shell。

ip route-static 0.0.0.0 0.0.0.0 192.168.1.254。

```。

(完整版)华为交换机命令大全

(完整版)华为交换机命令大全

华为交换机基本配置命令详解1、配置文件相关命令[Quidway]display current-configuration 显示当前生效的配置[Quidway]display saved-configuration显示flash中配置文件,即下次上电启动时所用的配置文件reset saved-configuration 檫除旧的配置文件reboot 交换机重启display version 显示系统版本信息2、基本配置[Quidway]super password 修改特权用户密码[Quidway]sysname 交换机命名[Quidway]interface ethernet 1/0/1 进入接口视图[Quidway]interface vlan 1进入接口视图[Quidway-Vlan-interfacex]ip address 10.1.1.11 255.255.0.0配置VLAN的IP地址[Quidway]ip route-static 0.0.0.0 0.0.0.0 10.1.1.1静态路由=网关3、telnet配置[Quidway]user-interface vty 0 4 进入虚拟终端[S3026-ui-vty0-4]authentication-mode password 设置口令模式[S3026-ui-vty0-4]set authentication-mode password simple xmws123设置口令[S3026-ui-vty0-4]user privilege level 3 用户级别4、端口配置[Quidway-Ethernet1/0/1]duplex {half|full|auto} 配置端口工作状态[Quidway-Ethernet1/0/1]speed {10|100|auto} 配置端口工作速率[Quidway-Ethernet1/0/1]flow-control 配置端口流控[Quidway-Ethernet1/0/1]mdi {across|auto|normal} 配置端口平接扭接[Quidway-Ethernet1/0/1]port link-type {trunk|access|hybrid} 设置端口工作模式[Quidway-Ethernet1/0/1]undo shutdown 激活端口[Quidway-Ethernet1/0/2]quit 退出系统视图5、链路聚合配置[DeviceA] link-aggregation group 1 mode manual 创建手工聚合组1[Qw_A] interface ethernet 1/0/1 将以太网端口Ethernet1/0/1加入聚合组1 [Qw_A-Ethernet1/0/1] port link-aggregation group 1[Qw_A-Ethernet1/0/1] interface ethernet 1/0/2 将以太网端口Ethernet1/0/1加入聚合组1[Qw_A-Ethernet1/0/2] port link-aggregation group 1[Qw_A] link-aggregation group 1 service-type tunnel # 在手工聚合组的基础上创建t unnel业务环回组。

华为、H3C、锐捷三家交换机配置命令详解

华为、H3C、锐捷三家交换机配置命令详解

华为、H3C、锐捷三家交换机配置命令详解一、华为交换机基础配置命令1<Quidway> //用户视图,也就是在Quidway模式下运行命令。

<Quidway>system-view //进入配置视图[Quidway] vlan 10 //创建vlan 10,并进入vlan10配置视图,如果vlan10存在就直接进入vlan10配置视图[Quidway-vlan10] quit //回到配置视图[Quidway] vlan 100 //创建vlan 100,并进入vlan100配置视图,如果vlan10存在就直接进入vlan100配置视图[Quidway-vlan100] quit //回到配置视图2[Quidway] interface GigabitEthernet2/0/1 (10G光口)[Quidway- GigabitEthernet2/0/1] port link-type access //定义端口传输模式[Quidway- GigabitEthernet2/0/1] port default vlan 100 //将端口加入vlan100 [Quidway- GigabitEthernet2/0/1] quit //回到配置视图[Quidway] interface GigabitEthernet1/0/0 //进入1号插槽上的第一个千兆网口配置视图中。

0代表1号口[Quidway- GigabitEthernet1/0/0] port link-type access //定义端口传输模式[Quidway- GigabitEthernet2/0/1] port default vlan 10 //将这个端口加入到vlan10中[Quidway- GigabitEthernet2/0/1] quit3<Quidway>system-view[Quidway]vlan 10[Quidway-vlan10]port GigabitEthernet 1/0/0 to 1/0/29 //将0到29号口加入到vlan10中[Quidway-vlan10]quit4[Quidway] interface Vlanif100 // 进入vlan100接口视图与vlan 100命令进入的地方不同[Quidway-Vlanif100] ip address 119.167.200.90 255.255.255.252 // 定义vlan100管理IP三层交换网关路由[Quidway-Vlanif100] quit //返回视图[Quidway] interface Vlanif10 // 进入vlan10接口视图与vlan 10命令进入的地方不同[Quidway-Vlanif10] ip address 119.167.206.129 255.255.255.128 // 定义vlan10管理IP三层交换网关路由[Quidway-Vlanif10] quit5[Quidway]ip route-static 0.0.0.0 0.0.0.0 119.167.200.89 //配置默认网关。

华为路由器交换机配置命令大全

华为路由器交换机配置命令大全

华为路由器交换机配置命令大全华为路由器交换机配置命令大全一、登录与认证命令1.Telnet 登录命令2.SSH 登录命令3.Console 登录命令4.用户认证命令二、设备管理命令1.设备信息查看命令2.设备参数配置命令3.设备重启命令4.设备保存配置命令三、接口配置命令1.查看接口状态命令2.配置接口描述命令3.配置接口IP地质命令4.配置接口MTU命令5.开启/关闭接口命令四、路由配置命令1.配置静态路由命令2.配置默认路由命令3.配置动态路由命令4.查看路由表命令5.清空路由表命令五、VLAN 配置命令1.配置VLAN命令2.配置端口VLAN命令3.配置VLAN接口命令六、交换机功能配置命令1.配置端口镜像命令2.配置链路聚合命令3.配置交换机端口安全命令4.配置交换机QoS命令七、安全配置命令1.配置访问控制列表命令2.配置NAT命令3.配置防火墙命令4.配置SSL VPN命令附录:附件:1.示例配置文件2.常见问题解答法律名词及注释:1.Telnet:一种远程登录协议,用于远程连接路由器或交换机进行管理和配置。

2.SSH:Secure Shell,一种用于远程登录的网络协议,提供安全的数据通信和用户认证方式。

3.Console:一种通过串口连接设备进行本地登录的方式。

4.VLAN:Virtual Local Area Network,虚拟局域网,将不同的物理分组划分到不同的逻辑分组中,实现逻辑分离。

5.MTU:Maximum Transmission Unit,最大传输单元,指数据链路层上一次发送的帧的最大长度。

6.NAT:Network Address Translation,网络地质转换,用于在私有网络和公共网络之间进行通信的转换技术。

7.QoS:Quality of Service,服务质量,用于在网络通信中对不同数据流进行优先级和带宽控制。

交换机路由器命令大全(结合配置实例)

交换机路由器命令大全(结合配置实例)

交换机路由器命令大全(结合配置实例)交换机路由器命令大全(结合配置实例)交换机和路由器是计算机网络中常用的网络设备,用于实现数据包的转发和路由选择。

在实际应用中,我们需要使用命令来配置交换机和路由器的各项参数。

本文将给出交换机和路由器常用命令的大全,并结合实际配置示例进行说明。

一、交换机命令1. 查看交换机基本信息查看交换机型号、固件版本、序列号等基本信息:show version2. 配置交换机端口设置交换机接口的速率、全双工模式等参数:interface interface_namespeed speed_valueduplex {full | half}3. 查看交换机端口状态查看交换机端口的连接状态、速率、工作模式等信息:show interfaces status4. 配置交换机VLAN创建VLAN和端口关联,实现VLAN的隔离和管理:vlan vlan_idname vlan_nameinterface interface_name5. 查看交换机MAC表显示交换机学习到的MAC地址和对应的端口:show mac-address-table6. 配置交换机链路聚合将多个物理端口绑定为一个逻辑端口,提高带宽和冗余性:interface port-channel channel_numberdescription description_textswitchport mode trunk/access7. 交换机Spanning Tree配置配置交换机的Spanning Tree协议参数,避免网络环路:spanning-tree vlan vlan_idpriority priority_value二、路由器命令1. 查看路由表显示路由器的路由表,包括直连路由、静态路由和动态路由表项:show ip route2. 配置静态路由手动配置路由器的静态路由表,指定目的网络和下一跳信息:ip route destination_network subnet_mask next_hop_ip3. 配置路由器接口配置路由器的接口参数,包括IP地址、子网掩码、描述等:interface interface_nameip address ip_address subnet_maskdescription description_text4. 配置路由器OSPF协议配置路由器之间的OSPF动态路由协议,实现网络的动态路由选择:router ospf process_idnetwork network_address wildcard_mask area area_number5. 配置路由器ACL配置路由器的访问控制列表,用于控制数据包的流量:access-list access_list_number permit/deny source destination6. 配置路由器NAT配置路由器的网络地址转换功能,实现内网与外网的互通:interface interface_nameip nat inside/outside三、配置实例1. 配置交换机端口接口GigabitEthernet0/1配置为100Mbps全双工模式:interface GigabitEthernet0/1speed 100duplex full2. 配置交换机VLAN创建VLAN10,将接口GigabitEthernet0/1划分到VLAN10:vlan 10name VLAN10interface GigabitEthernet0/13. 配置路由器接口将接口GigabitEthernet0/0配置为192.168.1.1/24的IP地址:interface GigabitEthernet0/0ip address 192.168.1.1 255.255.255.0description LAN interface4. 配置静态路由配置路由器的静态路由表,将目的网络192.168.2.0/24指向下一跳192.168.1.2:ip route 192.168.2.0 255.255.255.0 192.168.1.25. 配置路由器ACL设置访问控制列表,允许源IP地址为192.168.1.0/24的流量通过:access-list 1 permit 192.168.1.0 0.0.0.2556. 配置路由器NAT设置路由器的NAT,将内部接口GigabitEthernet0/1地址转换为公网地址:interface GigabitEthernet0/1ip nat inside以上是交换机和路由器常用命令的大全以及配置实例。

交换机命令大全

交换机命令大全

华为交换机基本配置命令一、单交换机VLAN划分命令命令解释system 进入系统视图system-view 进入系统视图quit 退到系统视图undo vlan 20 删除vlan 20sysname 交换机命名disp vlan 显示vlanvlan 20 创建vlan(也可进入vlan 20)port e1/0/1 to e1/0/5 把端口1-5放入VLAN 20 中disp vlan 20 显示vlan里的端口20int e1/0/24 进入端口24port access vlan 20 把当前端口放入vlan 20undo port e1/0/10 表示删除当前VLAN端口10disp curr 显示当前配置二、配置交换机支持TELNETsystem 进入系统视图sysname 交换机命名int vlan 1 进入VLAN 1ip address 192.168.3.100 255.255.255.0 配置IP地址user-int vty 0 4 进入虚拟终端authentication-mode password (aut password) 设置口令模式set authentication password simple 222 (set aut pass sim 222) 设置口令user privilege level 3(use priv lev 3) 配置用户级别disp current-configuration (disp cur) 查看当前配置disp ip int 查看交换机VLAN IP配置删除配置必须退到用户模式reset saved-configuration(reset saved) 删除配置reboot 重启交换机三、跨交换机VLAN的通讯在sw1上:vlan 10 建立VLAN 10int e1/0/5 进入端口5port access vlan 10 把端口5加入vlan 10vlan 20 建立VLAN 20int e1/0/15 进入端口15port access vlan 20 把端口15加入VLAN 20int e1/0/24 进入端口24port link-type trunk 把24端口设为TRUNK端口port trunk permit vlan all 同上在SW2上:vlan 10 建立VLAN 10int e1/0/20 进入端口20port access vlan 10 把端口20放入VLAN 10int e1/0/24 进入端口24port link-type trunk 把24端口设为TRUNK端口port trunk permit vlan all (port trunk permit vlan 10 只能为vlan 10使用)24端口为所有VLAN使用disp int e1/0/24 查看端口24是否为TRUNKundo port trunk permit vlan all 删除该句四、路由的配置命令system 进入系统模式sysname 命名int e1/0 进入端口ip address 192.168.3.100 255.255.255.0 设置IPundo shutdown 打开端口disp ip int e1/0 查看IP接口情况disp ip int brief 查看IP接口情况user-int vty 0 4 进入口令模式authentication-mode password(auth pass) 进入口令模式set authentication password simple 222 37 设置口令user privilege level 3 进入3级特权save 保存配置reset saved-configuration 删除配置(用户模式下运行)undo shutdown 配置远程登陆密码int e1/4ip route 192.168.3.0(目标网段)255.255.255.0 192.168.12.1(下一跳:下一路由器的接口)静态路由ip route 0.0.0.0 0.0.0.0 192.168.12.1 默认路由disp ip rout 显示路由列表华3C AR-18E1/0(lan1-lan4)E2/0(wan0)E3/0(WAN1)路由器连接使用直通线。

H3C交换机基础配置命令详解

H3C交换机基础配置命令详解

H3C交换机基础配置命令详解交换机的配置华为与H3C比较类似,这里面我们今天就来了解下,基础的配置命令,大家可以重点看下vlan的划分,这个在项目应用中较多。

一、基本配置<H3C> //用户直行模式提示符,用户视图<H3C>system-view //进入配置视图[H3C] sysname xxx //设置主机名成为xxx这里使用修改特权用户密码一、用户配置<H3C>system-view[H3C]super passwordH3C //设置用户分级密码[H3C]undo superpassword //删除用户分级密码[H3C]localuser bigheap 1234561 //Web网管用户设置,1(缺省)为管理级用户,缺省admin,admin[H3C]undo localuserbigheap //删除Web网管用户[H3C]user-interface aux0 //只支持0[H3C-Aux]idle-timeout 250 //设置超时为2分50秒,若为0则表示不超时,默认为5分钟[H3C-Aux]undoidle-timeout //恢复默认值[H3C]user-interface vty0 //只支持0和1[H3C-vty]idle-timeout 250 //设置超时为2分50秒,若为0则表示不超时,默认为5分钟[H3C-vty]undoidle-timeout //恢复默认值[H3C-vty]set authentication password123456 //设置telnet密码,必须设置[H3C-vty]undo set authenticationpassword //取消密码[H3C]displayusers //显示用户[H3C]displayuser-interface //用户界面状态三、VLAN配置[H3C]vlan 2 //创建VLAN2[H3C]undo vlanall //删除除缺省VLAN外的所有VLAN,缺省VLAN不能被删除[H3C-vlan2]port Ethernet 0/4 to Ethernet0/7 //将4到7号端口加入到VLAN2中,此命令只能用来加access端口,不能用来增加trunk或者hybrid端口[H3C-vlan2]port-isolateenable //打开VLAN内端口隔离特性,不能二层转发,默认不启用该功能[H3C-Ethernet0/4]port-isolate uplink-portvlan 2 //设置4为VLAN2的隔离上行端口,用于转发二层数据,只能配置一个上行端口,若为trunk,则建议允许所有VLAN通过,隔离不能与汇聚同时配置[H3C]display vlanall //显示所有VLAN的详细信息S1550E支持基于端口的VLAN,通过创建不同的user-group来实现,一个端口可以属于多个user-group,不属于同一个user-group的端口不能互相通信[H3C]user-group20 //创建user-group 20,默认只存在user-group 1[H3C-UserGroup20]port Ethernet 0/4 toEthernet 0/7 //将4到7号端口加入到VLAN20中,初始时都属于user-group 1中[H3C]display user-group20 //显示user-group 20的相关信息四、交换机IP配置[H3C]vlan 20 //创建vlan[H3C]management-vlan 20 //管理vlan[H3C]interface vlan-interface20 //进入并管理vlan20[H3C]undo interface vlan-interface20 //删除管理VLAN接口[H3C-Vlan-interface20]ip address192.168.1.2 255.255.255.0 //配置管理VLAN接口静态IP地址(缺省为192.168.0.234) [H3C-Vlan-interface20]undo ipaddress //删除IP地址[H3C-Vlan-interface20]ip gateway192.168.1.1 //指定缺省网关(默认无网关地址)[H3C-Vlan-interface20]undo ip gateway[H3C-Vlan-interface20]shutdown //关闭接口[H3C-Vlan-interface20]undoshutdown //开启[H3C]display ip //显示管理VLAN接口IP的相关信息[H3C]display interface vlan-interface20 //查看管理VLAN的接口信息<H3C>debuggingip //开启IP调试功能<H3C>undo debugging ip五、DHCP客户端配置[H3C-Vlan-interface20]ip addressdhcp-alloc // 管理VLAN接口通过DHCP方式获取IP地址[H3C-Vlan-interface20]undo ip addressdhcp-alloc // 取消[H3C]display dhcp //显示DHCP客户信息<H3C>debuggingdhcp-alloc //开启DHCP调试功能<H3C>undo debugging dhcp-alloc六、端口配置[H3C]interface Ethernet0/3 //进入端口[H3C-Ethernet0/3]shutdown //关闭端口[H3C-Ethernet0/3]speed100 //速率可为10,100,1000和auto(缺省)[H3C-Ethernet0/3]duplexfull //双工,可为half,full和auto(缺省) 光口和汇聚后不能配置[H3C-Ethernet0/3]flow-control //开启流控,默认为关闭[H3C-Ethernet0/3]broadcast-suppression20 //设置抑制广播百分比为20%,可取5,10,20,100,缺省为100,同时组播和未知单播也受此影响[H3C-Ethernet0/3]loopbackinternal //内环测试[H3C-Ethernet0/3]loopbackexternal //外环测试,需插接自环头,必须为全双工或者自协商模式[H3C-Ethernet0/3]port link-typetrunk //设置链路的类型为trunk,可为access(缺省),trunk[H3C-Ethernet0/3]port trunk pvid vlan20 //设置20为该trunk 的缺省VLAN,默认为1(trunk线路两端的PVID必须一致) [H3C-Ethernet0/3]port access vlan20 //将当前access端口加入指定的VLAN[H3C-Ethernet0/3]port trunk permit vlanall //允许所有的VLAN通过当前的trunk端口,可多次使用该命令[H3C-Ethernet0/3]mdiauto //设置以太端口为自动监测,normal(缺省)为直通线,across为交叉线[H3C]link-aggregation Ethernet 0/1 toEthernet 0/4 //将1-4口加入汇聚组,1为主端口,两端需要同时配置,设置了端口镜像以及端口隔离的端口无法汇聚[H3C]undo link-aggregation Ethernet0/1 //删除该汇聚组[H3C]link-aggregation modeegress //配置端口汇聚模式为根据目的MAC地址进行负荷分担,可选为ingress,egress和both,缺省为both[H3C]monitor-port Ethernet0/2 //将该端口设置为镜像端口,必须先设置镜像端口,删除时必须先删除被镜像端口,而且它们不能同在一个端口,该端口不能在汇聚组中,设置新镜像端口时,新取代旧,被镜像不变[H3C]mirroring-port Ethernet 0/3 toEthernet 0/4 both //将端口3和4设置为被镜像端口,both为同时监控接收和发送的报文,inbound表示仅监控接收的报文,outbound表示仅监控发送的报文[H3C]display mirror[H3C]display interface Ethernet 0/3<H3C>resetcounters //清除所有端口的统计信息[H3C]display link-aggregation Ethernet0/3 //显示端口汇聚信息[H3C-Ethernet0/3]virtual-cable-test //诊断该端口的电路状况七、集群配置S2100只能作为成员交换机加入集群中,加入后系统名改为'集群名_成员编号.原系统名'的格式.即插即用功能通过两个功能实现: 集群管理协议MAC组播地址协商和管理VLAN协商[H3C]cluster enable //启用群集功能,缺省为启用[H3C]cluster //进入群集视图[H3C-cluster]administrator-address H-H-Hname switch H-H-H为命令交换机的MAC,加入switch集群[switch_1.H3C-cluster]undoadministrator-address //退出集群[H3C]displaycluster //显示集群信息[H3C]management-vlan2 //集群报文只能在管理VLAN中转发,同一集群需在同一个管理VLAN中,需在建立集群之前指定管理VLAN八、QOS优先级配置QoS配置步骤:设置端口的优先级,设置交换机信任报文的优先级方式,队列调度,端口限速[H3C-Ethernet0/3]priority7 //设置端口优先级为7,默认为0[H3C]priority-trustcos //设置交换机信任报文的优先级方式为cos(802.1p优先级,缺省值),还可以设为dscp方式(dscp优先级方式) [H3C]queue-scheduler hq-wrr 2 4 68 //设置队列调度算法为HQ-WRR(默认为WRR),权重为2,4,6,8[H3C-Ethernet0/3]line-rate inbound29 //将端口进口速率限制为2Mbps,取1-28时,速率为rate*8*1024/125,即64,128,192...1.792M;29-127时,速率为(rate-27)*1024,即2M,3M,4M...100M,千兆时可继续往下取,128-240时,速率为(rate-115)*8*1024,即104M,112M,120M...1000M[H3C]displayqueue-scheduler //显示队列调度模式及参数[H3C]displaypriority-trust //显示优先级信任模式九、系统管理[H3C]mac-address blackhole H-H-H vlan1 //在VLAN1中添加黑洞MAC[H3C]mac-address static H-H-H interfaceEthernet 0/1 vlan 1 //在VLAN1中添加端口一的一个mac[H3C]mac-address timer aging500 //设置MAC地址表的老化时间为500s[H3C]display mac-address[H3C]display arp[H3C]mac-address port-binding H-H-Hinterface Ethernet 0/1 vlan 1 配置端口邦定[H3C]display mac-address port-binding[H3C]display saved-configuration[H3C]display current-configuration<H3C>save[H3C]restoredefault //恢复交换机出厂默认配置,恢复后需重启才能生效[H3C]display version<H3C>reboot[H3C]display device[H3C]sysname bigheap[H3C]info-centerenable //启用系统日志功能,缺省情况下启用[H3C]info-center loghost ip192.168.0.3 //向指定日志主机(只能为UNIX或LINUX,不能为Windows)输出信息,需先开启日志功能,缺省关闭[H3C]info-center loghost level8 //设置系统日志级别为8,默认为5.级别说明:1.emergencies 2.alerts 3.critical4.errors 5.warnings 6.notifications rmational 8.debugging<H3C>terminaldebugging //启用控制台对调试信息的显示,缺省控制台为禁用<H3C>terminallogging //启用控制台对日志信息的显示,缺省控制台为启用<H3C>terminaltrapping //启用控制台对告警信息的显示,缺省控制台为启用[H3C]displayinfo-center //显示系统日志的配置和缓冲区记录的信息[H3C]displaylogbuffer //显示日志缓冲区最近记录的指定数目的日志信息[H3C]displaytrapbuffer //显示告警缓冲区最近记录的指定数目的日志信息<H3C>resetlogbuffer //清除日志缓冲区的信息<H3C>resettrapbuffer //清除告警缓冲区的信息十、网络协议配置NDP即是邻居发现协议,S1550E只能开启或关闭NDP,无法配置,默认有效保留时间为180s,NDP报文发送的间隔60s[H3C]ndp enable //缺省情况下是开启的[H3C-Ethernet0/3]ndpenable //缺省情况下开启[H3C]display ndp //显示NDP配置信息[H3C]display ndp interface Ethernet0/1 //显示指定端口NDP 发现的邻居信息<H3C>debugging ndp interface Ethernet0/1// HABP协议即HuaweiAuthentication Bypass Protocol,华为鉴权旁路协议,是用来解决当交换机上同时配置了802.1x和HGMPv1/v2时,未经授权和认证的端口上将过滤HGMP报文,从而使管理设备无法管理下挂的交换机的问题。

交换机常用命令汇总

交换机常用命令汇总

交换机常用命令汇总华为1、查看交换机当前配置displaycur2、从特权模式进入全局模式(配置模式)sys3、修改交换机名称sysname4、创建Vlan10(创建后自动进入vlan)vlan10quit〃退出vlan5、给VIan配置IP地址interfaceVlanif10ipaddress192.168.30.12 55.255.255.0dhcpselectglobaldhcpenableundodhcenable〃关闭DHCP6、将端口3加入VIanlO进入端口3:interfaceGigabitEthernet0/0/3portlink-typeaccessportdefaultvlan107、配置IP地址池ippool10gateway-list192.168.10.1network192.168.10.1mask255.255.255.0excluded-ip-address192.168.10.2192.168.10.99〃排除IP不参与DHCPexcluded-ip-address192.168.10.200192.168.254〃排除IP不参与DHCPdns-list2.2.2.25.5.5.5〃删除IP地址池:undoippool105、保存配置save6、查看Vlan网关dispipintbrief7、检查OSPF视图下的配置dispcurconfigospf8、查看IP所在端口disparp∣inip9、查看MaC地址所在交换机端口dispmac-add∣inmac地址10、查看交换机里面MaC地址信息dispmac-add Il s进入该端口interfacegigabitethernet0/0/112、disth进入端口后查看端口配置13、nslook-up查看网页地址14、displayiprouting-table显示路由表信息15、显示VLANdiSPlayVlan17、删除Vlan20UndOVlan20清除告警clearalamindexno-trap24、重启交换机reboot 18、 查看全部报警displayalamall 20、开启端口undoshutdown 21、删除undo 22、关闭shutdown 23、退出当前模式返回上一级quit19、25、调试信息显示terminalmonitor26、双电源查看displaypower27、显示cpu信息displaycpu28、查看子卡运行状态displaydevice29、查看设备复位情况displayreboot-info30、查看设备温度displaytemperatureall32、查看内存占用情况displaymemory-usage。

交换机配置命令大全

交换机配置命令大全
(config)#banner motd & 配置每日提示信息 &为终止符
(config)#enable secret level 1 0 star 配置远程登陆密码为star
(config)#enable secret level 15 0 star 配置特权密码为star
(config-vlan)#name vlanname 命名VLAN为vlanname
(config-if)#switchport access vlan 10 将该端口划入VLAN10中
某端口的接口配置模式下进行
(config)#interface vlan 10 进入VLAN 10的虚拟端口配置模式
端口安全
(config)# interface fastethernet 0/1 进入一个端口
(config-if)# switchport port-security 开启该端口的安全功能
1.配置最大连接数限制
(config-if)# switchport port-secruity maxmum 1 配置端口的最大连接数为1,最大连接数为128
(config-if)#no shutdown 开启该端口
(config-if)#switchport access vlan 10 将该端口划入VLAN10中,用于VLAN
(config-if)#switchport mode trunk 将该端口设为trunk模式,用于Tag vlan
(config-if)# ip address 192.168.1.1 255.255.255.0
(config-if)# no shutdown
三层交换机路由协议

常见交换机配置命令

常见交换机配置命令

交换机常用命令及配置(cisco)switch> 用户模式1.进入特权模式enableswitch> enableswitch#2.进入Setup模式setupswitch> enableswitch#setup3.进入全局配置模式configure terminalswitch> enableswitch#configure terminalswitch(conf)#4.交换机命名hostname (以switch01 为例)switch> enableswitch#configure terminalswitch(conf)#hostname switch01switch01(conf)#5.配置密文密码enable secret (以123 为例)switch> enableswitch#configure terminalswitch(conf)# enable secret1236.配置明文密码enable password (以456 为例)switch> enableswitch#configure terminalswitch (conf)# enable password45611.设置虚拟端口的IP地址、网关等(以vlan 1为例)switch> enableswitch#configure terminalswitch(conf)# interface vlan 1switch(conf-if)# ip address192.168.1.254 255.255.255.0//配置交换机端口ip 和子网掩码switch (conf-if)#no shutdown //激活端口switch (conf-if)#exit //退出到上层配置模式switch (conf)#ip default-gateway192.168.1.254 //设置网关地址为什么要设置虚拟端口?虽然PC和交换机都可以配IP地址,但PC上的IP地址是绑定到以太网接口,交换机上的IP地址是绑定到VLAN。

交换机路由器常用命令

交换机路由器常用命令

交换机路由器常用命令交换机和路由器是网络中非常重要的设备,熟练掌握它们的常用命令对于网络管理和故障排除至关重要。

下面为您介绍一些交换机和路由器常用的命令。

一、交换机常用命令1、`enable` 命令这个命令用于进入特权模式。

在特权模式下,可以执行更多高级的配置和管理操作。

2、`configure terminal` 命令输入此命令后,可以进入全局配置模式,对交换机的整体参数进行设置。

3、`interface` 命令通过`interface` 加上接口类型和编号,例如`interface ethernet0/1` ,可以进入特定接口的配置模式,对该接口的参数进行详细配置。

4、`vlan` 命令`vlan` 相关的命令用于创建、删除和配置 VLAN(虚拟局域网)。

比如`vlan 10` 创建 VLAN 10 ,`name VLAN10` 为 VLAN 10 命名。

5、`show vlan` 命令用于查看交换机上已创建的VLAN 信息,包括VLAN 编号、名称、端口成员等。

6、`show interfaces` 命令此命令可以查看交换机各个接口的状态、速率、双工模式等详细信息。

7、`port trunk allowpass vlan` 命令在配置 trunk 链路时,使用该命令允许特定的 VLAN 通过 trunk 链路。

8、`spanningtree` 命令用于配置生成树协议,防止网络环路。

例如`spanningtree moderstp` 可以设置生成树的模式为快速生成树。

二、路由器常用命令1、`enable` 命令同样用于进入特权模式。

2、`configure terminal` 命令进入全局配置模式。

3、`interface` 命令例如`interface fastethernet 0/0` ,进入特定的接口配置模式。

4、`ip address` 命令为接口配置 IP 地址,如`ip address 19216811 2552552550` 。

路由器和交换机命令大全

路由器和交换机命令大全

路由器和交换机命令大全路由器和交换机是计算机网络中常用的设备,它们在数据传输和网络管理中发挥着重要的作用。

掌握路由器和交换机的命令是网络管理和故障排除的基本要求。

本文将为您提供常见的路由器和交换机命令大全,以帮助您更好地理解和应用这些设备。

一、路由器命令1. show ip route:显示路由表中的所有路由信息。

2. show interfaces:显示接口的状态和统计信息。

3. show running-config:显示当前路由器的配置信息。

4. show version:显示路由器的硬件和软件版本信息。

5. configure terminal:进入全局配置模式。

6. interface interface-name:进入指定接口的配置模式。

7. ip address ip-address subnet-mask:为接口配置IP地址和子网掩码。

8. ip route destination-network subnet-mask next-hop:配置静态路由。

9. access-list access-list-number {deny | permit} source destination:配置访问控制列表。

10. clear arp-cache:清除路由器的ARP缓存。

11. debug {protocols | ip | interface}:启用某个调试功能来监控网络流量或接口状态。

二、交换机命令1. show interfaces:显示接口的状态和统计信息。

2. show mac-address-table:显示交换机的MAC地址表。

3. show running-config:显示当前交换机的配置信息。

4. show vlan:显示交换机的VLAN信息。

5. configure terminal:进入全局配置模式。

6. interface interface-name:进入指定接口的配置模式。

交换机命令大全

交换机命令大全

1.在基于IOS的交换机上设置主机名/系统名:switch(config)# hostname hostname在基于CLI的交换机上设置主机名/系统名:switch(enable) set system name name-string2.在基于IOS的交换机上设置登录口令:switch(config)# enable password level 1 password在基于CLI的交换机上设置登录口令:switch(enable) set passwordswitch(enable) set enalbepass3.在基于IOS的交换机上设置远程访问:switch(config)# interface vlan 1switch(config-if)# ip address ip-address netmaskswitch(config-if)# ip default-gateway ip-address在基于CLI的交换机上设置远程访问:switch(enable) set interface sc0 ip-address netmask broadcast-addressswitch(enable) set interface sc0 vlanswitch(enable) set ip route default gateway4.在基于IOS的交换机上启用和浏览CDP信息:switch(config-if)# cdp enableswitch(config-if)# no cdp enable为了查看Cisco邻接设备的CDP通告信息:switch# show cdp interface [type modle/port]switch# show cdp neighbors [type module/port] [detail]在基于CLI的交换机上启用和浏览CDP信息:switch(enable) set cdp {enable|disable} module/port为了查看Cisco邻接设备的CDP通告信息:switch(enable) show cdp neighbors[module/port][vlan|duplex|capabilities|detail]5.基于IOS的交换机的端口描述:switch(config-if)# description description-string基于CLI的交换机的端口描述:switch(enable)set port name module/number description-string6.在基于IOS的交换机上设置端口速度:switch(config-if)# speed{10|100|auto}在基于CLI的交换机上设置端口速度:switch(enable) set port speed moudle/number {10|100|auto}switch(enable) set port speed moudle/number {4|16|auto}7.在基于IOS的交换机上设置以太网的链路模式:switch(config-if)# duplex {auto|full|half}在基于CLI的交换机上设置以太网的链路模式:switch(enable) set port duplex module/number {full|half}8.在基于IOS的交换机上配置静态VLAN:switch# vlan databaseswitch(vlan)# vlan vlan-num name vlaswitch(vlan)# exitswitch# configure teriminalswitch(config)# interface interface module/numberswitch(config-if)# switchport mode accessswitch(config-if)# switchport access vlan vlan-numswitch(config-if)# end在基于CLI的交换机上配置静态VLAN:switch(enable) set vlan vlan-num [name name]switch(enable) set vlan vlan-num mod-num/port-list9. 在基于IOS的交换机上配置VLAN中继线:switch(config)# interface interface mod/portswitch(config-if)# switchport mode trunkswitch(config-if)# switchport trunk encapsulation {isl|dotlq}switch(config-if)# switchport trunk allowed vlan remove vlan-list switch(config-if)# switchport trunk allowed vlan add vlan-list 在基于CLI的交换机上配置VLAN中继线:switch(enable) set trunk module/port[on|off|desirable|auto|nonegotiate]Vlan-range [isl|dotlq|dotl0|lane|negotiate]10.在基于IOS的交换机上配置VTP管理域:switch# vlan databaseswitch(vlan)# vtp domain domain-name在基于CLI的交换机上配置VTP管理域:switch(enable) set vtp [domain domain-name]11.在基于IOS的交换机上配置VTP 模式:switch# vlan databaseswitch(vlan)# vtp domain domain-nameswitch(vlan)# vtp {sever|cilent|transparent}switch(vlan)# vtp password password在基于CLI的交换机上配置VTP 模式:switch(enable) set vtp [domain domain-name][mode{ sever|cilent|transparent }][password password]12. 在基于IOS的交换机上配置VTP版本:switch# vlan databaseswitch(vlan)# vtp v2-mode在基于CLI的交换机上配置VTP版本:switch(enable) set vtp v2 enable13. 在基于IOS的交换机上启动VTP剪裁:switch# vlan databaseswitch(vlan)# vtp pruning在基于CL I 的交换机上启动VTP剪裁:switch(enable) set vtp pruning enable14.在基于IOS的交换机上配置以太信道:switch(config-if)# port group group-number [distribution {source|destination}]在基于CLI的交换机上配置以太信道:switch(enable) set port channel moudle/port-rangemode{on|off|desirable|auto}15.在基于IOS的交换机上调整根路径成本:switch(config-if)# spanning-tree [vlan vlan-list] cost cost在基于CLI的交换机上调整根路径成本:switch(enable) set spantree portcost moudle/port costswitch(enable) set spantree portvlancost moudle/port [costcost][vlan-list]16.在基于IOS的交换机上调整端口ID:switch(config-if)# spanning-tree[vlan vlan-list]port-priorityport-priority在基于CLI的交换机上调整端口ID:switch(enable) set spantree portpri {mldule/port}priorityswitch(enable) set spantree portvlanpri {module/port}priority [vlans]17. 在基于IOS的交换机上修改STP时钟:switch(config)# spanning-tree [vlan vlan-list] hello-time secondsswitch(config)# spanning-tree [vlan vlan-list] forward-time secondsswitch(config)# spanning-tree [vlan vlan-list] max-age seconds在基于CLI的交换机上修改STP时钟:switch(enable) set spantree hello interval[vlan]switch(enable) set spantree fwddelay delay [vlan]switch(enable) set spantree maxage agingtiame[vlan]18. 在基于IOS的交换机端口上启用或禁用Port Fast 特征:switch(config-if)#spanning-tree portfast在基于CLI的交换机端口上启用或禁用Port Fast 特征:switch(enable) set spantree portfast {module/port}{enable|disable}19. 在基于IOS的交换机端口上启用或禁用UplinkFast 特征:switch(config)# spanning-tree uplinkfast [max-update-ratepkts-per-second]在基于CLI的交换机端口上启用或禁用UplinkFast 特征:switch(enable) set spantree uplinkfast {enable|disable}[rate update-rate] [all-protocols off|on]20. 为了将交换机配置成一个集群的命令交换机,首先要给管理接口分配一个IP地址,然后使用下列命令: switch(config)# cluster enable cluster-name cv21. 为了从一条中继链路上删除VLAN,可使用下列命令:switch(enable) clear trunk module/port vlan-range22. 用show vtp domain 显示管理域的VTP参数.23. 用show vtp statistics显示管理域的VTP参数.24. 在Catalyst交换机上定义TrBRF的命令如下:switch(enable) set vlan vlan-name [name name] type trbrf bridge bridge-num[stp {ieee|ibm}]25. 在Catalyst交换机上定义TrCRF的命令如下:switch (enable) set vlan vlan-num [name name] type trcrf{ring hex-ring-num|decring decimal-ring-num} parent vlan-num26. 在创建好TrBRF VLAN之后,就可以给它分配交换机端口.对于以太网交换,可以采用如下命令给VLAN分配端口:switch(enable) set vlan vlan-num mod-num/port-num27. 命令show spantree显示一个交换机端口的STP状态.28. 配置一个ELAN的LES和BUS,可以使用下列命令:ATM (config)# interface atm number.subint multiointATM(config-subif)# lane serber-bus ethernet elan-name29. 配置LECS:ATM(config)# lane database database-nameATM(lane-config-databade)# name elan1-name server-atm-address les1-nsap-addressATM(lane-config-databade)# name elan2-name server-atm-address les2-nsap-addressATM(lane-config-databade)# name …30. 创建完数据库后,必须在主接口上启动LECS.命令如下:ATM(config)# interface atm numberATM(config-if)# lane config database database-nameATM(config-if)# lane config auto-config-atm-address31. 将每个LEC配置到一个不同的ATM子接口上.命令如下:ATM(config)# interface atm number.subint multipointATM(config)# lane client ethernet vlan-num elan-num32. 用show lane server 显示LES的状态.33. 用show lane bus显示bus的状态.34. 用show lane database显示LECS数据库可内容.35. 用show lane client显示LEC的状态.36. 用show module显示已安装的模块列表.37. 用物理接口建立与VLAN的连接:router# configure terminalrouter(config)# interface media module/portrouter(config-if)# description description-stringrouter(config-if)# ip address ip-addr subnet-maskrouter(config-if)# no shutdown38. 用中继链路来建立与VLAN的连接:router(config)# interface module/port.subinterfacerouter(config-ig)# encapsulation[isl|dotlq] vlan-numberrouter(config-if)# ip address ip-address subnet-mask39. 用LANE 来建立与VLAN的连接:router(config)# interface atm module/portrouter(config-if)# no ip addressrouter(config-if)# atm pvc 1 0 5 qsaalrouter(config-if)# atm pvc 2 0 16 ilnirouter(config-if)# interface atm module/port.subinterface multipointrouter(config-if)# ip address ip-address subnet-maskrouter(config-if)# lane client ethernet elan-numrouter(config-if)# interface atm module/port.subinterface multipointrouter(config-if)# ip address ip-address subnet-namerouter(config-if)# lane client ethernet elan-namerouter(config-if)# …40. 为了在路由处理器上进行动态路由配置,可以用下列IOS命令来进行:router(config)# ip routingrouter(config)# router ip-routing-protocolrouter(config-router)# network ip-network-numberrouter(config-router)# network ip-network-number41. 配置默认路由:switch(enable) set ip route default gateway42. 为一个路由处理器分配VLANID,可在接口模式下使用下列命令:router(config)# interface interface numberrouter(config-if)# mls rp vlan-id vlan-id-num43. 在路由处理器启用MLSP:router(config)# mls rp ip44. 为了把一个外置的路由处理器接口和交换机安置在同一个VTP域中:router(config)# interface interface numberrouter(config-if)# mls rp vtp-domain domain-name45. 查看指定的VTP域的信息:router# show mls rp vtp-domain vtp domain name46. 要确定RSM或路由器上的管理接口,可以在接口模式下输入下列命令:router(config-if)#mls rp management-interface47. 要检验MLS-RP的配置情况:router# show mls rp48. 检验特定接口上的MLS配置:router# show mls rp interface interface number49. 为了在MLS-SE上设置流掩码而又不想在任一个路由处理器接口上设置访问列表:set mls flow [destination|destination-source|full]50. 为使MLS和输入访问列表可以兼容,可以在全局模式下使用下列命令:router(config)# mls rp ip input-acl51. 当某个交换机的第3层交换失效时,可在交换机的特权模式下输入下列命令:switch(enable) set mls enable52. 若想改变老化时间的值,可在特权模式下输入以下命令:switch(enable) set mls agingtime agingtime53. 设置快速老化:switch(enable) set mls agingtime fast fastagingtime pkt_threshold54. 确定那些MLS-RP和MLS-SE参与了MLS,可先显示交换机引用列表中的内容再确定:switch(enable) show mls include55. 显示MLS高速缓存记录:switch(enable) show mls entry56. 用命令show in arp显示ARP高速缓存区的内容。

交换机配置命令大全

交换机配置命令大全

交换机配置命令大全Switch命令:全局配置模式:Switch(config)# 配置交换机的全局参数接口配置模式:Switch(config-if)# 对交换机的接口进行配置,如某个接口属于那个Vlan,启用及禁用接口等线路配置模式:Switch(config-line)# 对控制台访问VLAN数据库配置模式:Switch(Vlan)# 对Vlan的参数进行配置一、模式命令:1. 用户模式:Switch>2. 特权模式:Switch>enableSwitch#3. 全局配置模式:Switch#config terminalSwitch(config)#4. 接口配置模式:Switch(config)#interface fastethernet0/1Switch(config-if)#5. Line模式:Switch(config)#line console 0Switch(config-line)#二、特权模式下的命令:1. 查看机MAC地址:Switch#show mac-address-table2. 发现(CDP):Switch#show cdpSwitch#show cdp interface fastethernet0/1Switch#show cdp neighborsSwitch#show cdp neighbors detailSwitch#show cdp entry3. 保存机配置:Switch#copy running-config startup-config或者Switch#write4. 恢复交换机出厂值:Switch#erase startup-configSwitch#reload三、全局配置模式下的命令:1. 配置主机名:Switch(config)#hostname Sw1Sw1(config)#2、设置登陆台密码:Switch(config)#line console 0Switch(config-line)#password 密码Switch(config-line)#login3. 使能口令:Switch(config)#enable Password 密码4. 加密保存的使能口令:Switch(config)#enable secret 密码5. 配置IP地址:Switch(config)#interface vlan 1Switch(config-if)#ip address IP地址网关Switch(config-if)#no shutdown6. 配置交换机网关:Switch(config)#ip default-gateway 网关四、VLAN配置命令:1. 创建vlan命令:a) 全局配置模式下:Switch(config)#vlan 2Switch(config)#name v2Switch(config)#mtu 数值Switch(config)#endb) Vlan数据库下:Switch#vlan databaseSwitch#vlan 2 name v2Switch#vlan 2 mut 数值Switch#exit2. 删除vlan命令:a) 全局配置模式下:Switch(config)#no vlan 2Switch(config)#endb) Vlan数据库下:Switch#no vlan 2 name v2Switch#exit3. 在vlan中添加端口:Switch#config terminalSwitch(config)#interface f0/1(端口)Switch(config-if)#Switchport mode accessSwitch(config-if)#switchport access vlan 2Switch(config-if)#end一次将多个端口添加到vlan中:Switch#config terminalSwitch(config)#interface range f0/1 - 5(端口)Switch(config-if)#switchport access vlan 2Switch(config-if)#end注:switch#show vlan biref(查看vlan信息)4. 配置vlan trunk:1. 配置接口为trunk命令:Switch(config)# interface f0/1(端口)Switch(config-if)#Switchport mode trunk2. 配置接口为动态协商模式的命令:Switch(config)# interface f0/1(端口)Switch(config-if)#switchport mode dynamic desirable/auto 3. 从trunk中删除vlan:Switch(config)# interface f0/1(端口)Switch(config-if)#Switchport trunk allowed vlan remove 2 4. 在trunk中添加vlan:Switch(config)# interface f0/1(端口)Switch(config-if)#Switchport trunk allowed vlan add 2----------------------------------------------------------- Catalyst 2950交换机密码恢复(1)拔下交换机的电源。

华为交换机常用命令配置介绍

华为交换机常用命令配置介绍

华为交换机常用命令配置介绍华为交换机是一种常见的网络设备,用于构建大型网络。

配置华为交换机需要使用一些常用的命令,通过这些命令可以设置交换机的各种功能和参数。

本文将介绍一些常用的华为交换机配置命令,包括基本配置、端口配置和VLAN配置等。

一、基本配置命令:1.设置设备主机名:[HUAWEI] sysname Switch //将设备主机名设置为Switch2.配置管理口:[Switch] interface gigabitethernet 0/0/1 //进入GigabitEthernet 0/0/1接口[Switch-GigabitEthernet0/0/1] port link-type access //设置接口类型为access[Switch-GigabitEthernet0/0/1] port default vlan 10 //设置默认VLAN为103.配置IP地址:[Switch-GigabitEthernet0/0/1] ip address 192.168.1.1255.255.255.0 //配置接口IP地址为192.168.1.1,子网掩码为255.255.255.04.设置设备登录认证:[Switch] aaa //进入AAA视图[Switch-aaa] local-user admin //创建本地用户admin[Switch-aaa] password simple admin123 //设置密码为admin1235.开启SSH远程登录:[Switch] ssh server enable //开启SSH服务[Switch] ssh user admin //创建SSH用户admin[Switch-ssh-user-admin] authentication-type password //设置认证方式为密码[Switch-ssh-user-admin] service-type stelnet //设置服务类型为SSH二、端口配置命令:1.查看端口状态:[Switch] display interface gigabitethernet 0/0/1 //查看GigabitEthernet 0/0/1接口的状态信息2.端口速率设置:[Switch] interface gigabitethernet 0/0/1 //进入GigabitEthernet 0/0/1接口[Switch-GigabitEthernet0/0/1] speed 100 //设置速率为100Mbps 3.端口流量控制:[Switch] interface gigabitethernet 0/0/1 //进入GigabitEthernet 0/0/1接口[Switch-GigabitEthernet0/0/1] flow-control //开启流量控制4.端口VLAN成员关系设置:[Switch] interface gigabitethernet 0/0/1 //进入GigabitEthernet 0/0/1接口[Switch-GigabitEthernet0/0/1] port link-type trunk //设置接口类型为trunk[Switch-GigabitEthernet0/0/1] port trunk allow-pass vlan 1020 //设置允许通过的VLAN为10和20三、VLAN配置命令:1.创建VLAN:[Switch] vlan 10 //创建VLAN 10[Switch-vlan10] quit //退出VLAN 10视图2.VLAN接口配置:[Switch] interface vlanif 10 //进入VLAN 10接口[Switch-Vlan-interface10] ip address 192.168.10.1255.255.255.0 //配置接口IP地址为192.168.10.1,子网掩码为255.255.255.03.VLAN端口关联:[Switch] interface gigabitethernet 0/0/1 //进入GigabitEthernet 0/0/1接口[Switch-GigabitEthernet0/0/1] port link-type hybrid //设置接口类型为hybrid(混合)[Switch-GigabitEthernet0/0/1] port hybrid vlan 10 untagged //设置接口为VLAN 10的未标记端口四、其他常用命令:1.查看设备信息:[Switch] display version //查看设备版本信息[Switch] display interface brief //查看所有接口的基本信息2.保存配置:[Switch] save //保存当前配置3.重启设备:[Switch] reboot //重启设备以上是一些常用的华为交换机配置命令。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

配置命令
交换机之间用交叉线
1进入特权模式:Switch>enable
2配置模式Switch#config
3配置主机名:Switch(config)#hostname S1
4.设置访问口令S1#configure terminal
S1(config)#line console 0
S1(config-line)#password cisco
S1(config-line)#login
S1(config-line)#line vty 0 15
S1(config-line)#password cisco
S1(config-line)#login
S1(config-line)#exit
5.将使能加密口令设置为class。

S1(config)#enable secret class
S1(config)#配置默认网关
6.在虚拟接口vlan99设置交换机ip地址
S1(config)#interface vlan99
S1(config-if)#
S1(config-if)#no shutdown
S1(config-if)#exit
7.交换机VLAN 分配端口
S1(config)#interface fa0/1
S1(config-if)#switchport mode access
S1(config-if)#switchport access vlan 99
S1(config-if)#exit
8.给vlan命名
S1(config)#vlan 10
S1(config-vlan)#name Faculty/Staff
S2.S3.本征vlan即分配端口 s2.s3连接s1 使用中继vlan S1中继vlan S1(config)#interface FastEthernet 0/1
S1(config-if)#switchport mode trunk
S1(config-if)#switchport trunk native vlan 99
9..设置交换机默认网关
S1(config)#
S1(config)#exit
10..配置快速以太网接口的端口速率和双工设置。

S1#configure terminal
S1(config)#interface fastethernet 0/18
S1(config-if)#speed 100
S1(config-if)#duplex full
S1(config-if)#end
11.清除mac地址表S1#clear mac-address-table dynamic
12.设置静态MAC 地址。

S1(config)#
13.在接入端口上配置端口安全性。

配置交换机端口FastEthernet 0/18 仅接受两台设备,动态学习这些设备的MAC 地址,并在发生安全违规事件时关闭端口。

S1(config-if)#switchport mode access
S1(config-if)#switchport port-security
S1(config-if)#switchport port-security maximum 2
S1(config-if)#switchport port-security mac-address sticky
S1(config-if)#switchport port-security violation shutdown
S1(config-if)#exit
14.配置并测试MOTD 标语。

配置当天消息(MOTD),文本使用?Authorized Access Only(仅限授权访问)。

标语文本区分大小写。

请勿在标语文本前后添加空格。

在标语文本前后使用定界符指示文本从何处开始,到何处结束。

下例中使用的定界符为?&,但是您可以使用标语文本中未使用的任何字符。

配置完MOTD 后,从交换机注销,然后再次登录,检查是否显示了上述标语。

S1(config)#banner motd &Authorized Access Only&
S1(config)#end [or exit]
S1#exit
15.首先必须启用端口安全性,方能在接口上使用其它端口安全性命令。

启用18号端口安全性
S1(config-if)#interface fa0/18
S1(config-if)#switchport port-security
Show
1.Show vlan 看默认vlan 配置
2.发出?show running-config?命令,检查当前的运行配置
3.发出?show startup-config?命令,检查当前NVRAM 的内容
4.发出?show interface vlan1?命令,检查虚拟接口VLAN1 的特征
5.现在使用?show ip interface vlan1?命令查看该接口的IP 属性
6.使用?show version?命令显示Cisco IOS 信息
7.使用?show interface fastethernet 0/18?命令检查PC1 所用快速以太网接口的默认属性。

8.在特权执行模式下使用?show mac-address-table?命令显示MAC 地址
9.创建VLAN 后,返回特权执行模式并发出?show vlan brief?命令,检查新VLAN 是否创建成功。

其他命令
删除vlan数据库信息Switch#delete flash:vlan.dat
从NVRAM中删除交换机启动配置文件Switch#erase startup-config
在特权执行模式提示符下,输入?reload?命令开始这一过程。

Switch#reload
要把运行配置文件的内容保存到非易失性RAM (NVRAM),请发出命令?copy
running-config startup-config。

Switch#copy running-config startup-config
第四章
1.vtp默认配置: show vtp status
2.S1 将成为VTP 服务器。

将S1 设置为服务器模式。

S1(config)#vtp mode server
Device mode already VTP SERVER.
3. 将S1 的VTP 域名配置为CCNA。

请记住,VTP 域名区分大小写。

S1(config)#vtp domain CCNA
Changing VTP domain name from NULL to CCNA
4. 将S1 的VTP 域口令配置为cisco。

请记住,VTP 域口令区分大小写。

S1(config)#vtp password cisco
Setting device VLAN database password to cisco
S1(config)#
5.配置主辅银桥
S1 (config): spanning-tree vlan 1 root primary
S1(config): spanning-tree vlan 1 root secondary
6.配置桥的优先级
S1 (config):spanning-tree vlan 1 priority 4096
7.检验网桥优先级
Show spanning-tree
8.
使用802.1Q 封装配置子接口。

在R1 上创建两个子接口:Fa0/1.10 和Fa0/1.30。

将这两个子接口分配到不同的VLAN。

要创建第一个子接口,请发出interface fa0/1.10 命令进入Fa0/1.10 的子接口配置模式。

请留意,路由器的命令提示符会更改。

在子接口配置模式下发出encapsulation dot1Q 10 命令,将封装类型设置为802.1Q 并将VLAN 10 分配给该虚拟接口。

为端口分配正确的IP 地址。

Fa0/1.10 的IP 地址应为,子网掩码为。

使用正确的IP 地址和VLAN ID 对Fa0/1.30 接口重复上述步骤。

R1(config)#interface fa0/1.10
R1(config-subif)#encapsulation dot1Q 10
R1(config-subif)#interface fa0/1.30
R1(config-subif)#encapsulation dot1Q 30
任务2:将PPP 配置为封装方法。

步骤1. 将R1 配置为与R2 之间使用PPP 封装。

R1(config)#interface serial0/0/0
R1(config-if)#encapsulation ppp
步骤1. 将ISP 配置为与R2 之间使用HDLC 封装。

ISP(config)#interface serial0/0/0
ISP(config-if)#encapsulation hdlc
ISP(config-if)#no shutdown
步骤1. 将ANSI 配置为R1、R2 和R3 上的LMI 类型。

对每台路由器的串行接口输入下列命令。

R1(config-if)#interface s0/0/0
R1(config-if)#frame-relay lmi-type ansi。

相关文档
最新文档