一、华三交换机配置命令

华三交换机配置命令如下:

system-view

[H3C]super password H3C:设置用户分级密码

[H3C]undo super password:删除用户分级密码

[H3C]localuser bigheap 123456 1:Web网管用户设置,1(缺省)为管理级用户,缺admin,admin

[H3C]undo localuser bigheap:删除Web网管用户

[H3C]user-interface aux 0:只支持0

[H3C-Aux]idle-timeout 2 50:设置超时为2分50秒,若为0则表示不超时,默认为5分钟

[H3C-Aux]undo idle-timeout:恢复默认值

[H3C]user-interface vty 0:只支持0和1

[H3C-vty]idle-timeout 2 50:设置超时为2分50秒,若为0则表示不超时,默认为5分钟

[H3C-vty]undo idle-timeout:恢复默认值

[H3C-vty]set authentication password 123456:设置telnet密码,必须设置

[H3C-vty]undo set authentication password:取消密码

[H3C]display users:显示用户

[H3C]display user-interface:显示用户界面状态

扩展资料:

H3C Switch命令:

一、模式命令:

1、用户模式:Switch>

2、特权模式:Switch>enable

Switch#

3、全局配置模式:Switch#config terminal

Switch(config)#

4、接口配置模式:Switch(config)#interface fastethernet0/1

Switch(config-if)#

5、Line模式:Switch(config)#line console 0

Switch(config-line)#

二、特权模式下的命令:

1、查看机MAC地址:Switch#show mac-address-table

2、发现(CDP):

Switch#show cdp

Switch#show cdp interface fastethernet0/1

Switch#show cdp neighbors

Switch#show cdp neighbors detail

Switch#show cdp entry

工作原理:

交换机工作于OSI参考模型的第二层,即数据链路层交换机内部的CPU会在每个端口成功连接时,通过将MAC地址和端口对应,形成一张MAC表。

在今后的通讯中,发往该MAC地址的数据包将仅送往其对应的端口,而不是所有的端口。因此,交换机可用于划分数据链路层广播,即冲突域;但它不能划分网络层广播,即广播域。

参考资料:百度百科—交换机

参考资料:百度百科—交换机命令

二、交换机基本配置命令

一、单交换机VLAN划分

命令 命令解释

system 进入系统视图

system-view 进入系统视图

quit 退到系统视图

undo vlan 20 删除vlan 20

sysname 交换机命名

disp vlan 显示vlan

vlan 20 创建vlan(也可进入vlan 20)

port e1/0/1 to e1/0/5 把端口1-5放入VLAN 20 中

disp vlan 20 显示vlan里的端口20

int e1/0/24 进入端口24

port access vlan 20 把当前端口放入vlan 20

undo port e1/0/10 表示删除当前VLAN端口10

disp curr 显示当前配置

二、配置交换机支持TELNET

system 进入系统视图

sysname 交换机命名

int vlan 1 进入VLAN 1

ip 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 10

int e1/0/5 进入端口5

port access vlan 10 把端口5加入vlan 10

vlan 20 建立VLAN 20

int e1/0/15 进入端口15

port access vlan 20 把端口15加入VLAN 20

int e1/0/24 进入端口24

port link-type trunk 把24端口设为TRUNK端口

port trunk permit vlan all 同上

在SW2上:

vlan 10 建立VLAN 10

int e1/0/20 进入端口20

port access vlan 10 把端口20放入VLAN 10

int e1/0/24 进入端口24

port 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是否为TRUNK

undo port trunk permit vlan all 删除该句

四、路由的配置命令

system 进入系统模式

sysname 命名

int e1/0 进入端口

ip address 192.168.3.100 255.255.255.0 设置IP

undo 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/4

ip 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-18

E1/0(lan1-lan4)

E2/0(wan0)

E3/0(WAN1)

路由器连接使用直通线。wan0接wan0或wan1接wan1

计算机的网关应设为路由器的接口地址。

五、三层交换机配置VLAN-VLAN通讯

sw1(三层交换机):

system 进入视图

sysname 命名

vlan 10 建立VLAN 10

vlan 20 建立VLAN 20

int e1/0/20 进入端口20

port access vlan 10 把端口20放入VLAN 10

int e1/0/24 进入24端口

port link-type trunk 把24端口设为TRUNK端口

port trunk permit vlan all (port trunk permit vlan 10 只能为vlan

10使用)24端口为所有VLAN使用

sw2:

vlan 10

int e1/0/5

port access vlan 10

int e1/0/24

port link-type trunk 把24端口设为TRUNK端口

port trunk permit vlan all (port trunk permit vlan 10 只能为vlan

10使用)24端口为所有VLAN使用

sw1(三层交换机):

int vlan 10 创建虚拟接口VLAN 10

ip address 192.168.10.254 255.255.255.0 设置虚拟接口VLAN 10的地址

int vlan 20 创建虚拟接口VLAN 20

ip address 192.168.20.254 255.255.255.0 设置虚拟接口IP VLAN 20的地址

注意:vlan 10里的计算机的网关设为 192.168.10.254

vlan 20里的计算机的网关设为 192.168.20.254

六、动态路由RIP

R1:

int e1/0 进入e1/0端口

ip address 192.168.3.1 255.255.255.0 设置IP

int e2/0 进入e2/0端口

ip adress 192.168.5.1 255.255.255.0 设置IP

rip 设置动态路由

network 192.168.5.0 定义IP

network 192.168.3.0 定义IP

disp ip rout 查看路由接口

R2:

int e1/0 进入e1/0端口

ip address 192.168.4.1 255.255.255.0 设置IP

int e2/0 进入e2/0端口

ip adress 192.168.5.2 255.255.255.0 设置IP

rip 设置动态路由

network 192.168.5.0 定义IP

network 192.168.4.0 定义IP

disp ip rout 查看路由接口

(注意:两台PC机的网关设置PC1 IP:192.168.3.1 PC2 IP:192.168.4.1)

七、IP访问列表

int e1/0

ip address 192.168.3.1 255.255.255.0

int e2/0

ip address 192.168.1.1 255.255.255.0

int e3/0

ip address 192.168.2.1 255.255.255.0

acl number 2001 (2001-2999属于基本的访问列表)

rule 1 deny source 192.168.1.0 0.0.0.255 (拒绝地址192.168.1.0网段的数据通过)

rule 2 permit source 192.168.3.0 0.0.0.255(允许地址192.168.3.0网段的数据通过)

以下是把访问控制列表在接口下应用:

firewall enable

firewall default permit

int e3/0

firewall packet-filter 2001 outbound

disp acl 2001 显示信息

undo acl number 2001 删除2001控制列表

扩展访问控制列表

acl number 3001

rule deny tcp source 192.168.3.0 0.0.0.255 destination 192.168.2.0 0.0.0.255

destination-port eq ftp

必须在r-acl-adv-3001下才能执行

rule permit ip source an destination any (rule permit ip)

int e3/0

firewall enable 开启防火墙

firewall packet-filter 3001 inbound

必须在端口E3/0下才能执行

八、命令的标准访问IP列表(三层交换机):

允许A组机器访问服务器内资料,不允许访问B组机器(服务器没有限制)

sys

vlan 10

name server

vlan 20

name teacher

vlan 30

name student

int e1/0/5

port access vlan 10

int e1/0/10

port access vlan 20

int e1/0/15

port access vlan 30

int vlan 10

ip address 192.168.10.1 255.255.255.0

undo sh

int vlan 20

ip address 192.168.20.1 255.255.255.0

int vlan 30

ip address 192.168.30.1 255.255.255.0

acl number 2001

rule 1 deny source 192.168.30.0 0.0.0.255

rule 2 permit source any

disp acl 2001 查看2001列表

int e1/0/10

port access vlan 20

packet-filter outbound ip-group 2001 rule 1

出口

九、允许A机器访问B机器的FTP但不允许访问WWW,C机器没有任何限制。

vlan 10

vlan 20

vlan 30

int e1/0/5

port access vlan 10

int e1/0/10

port access vlan 20

int e1/0/15

port access vlan 30

int vlan 10

ip address 192.168.10.1 255.255.255.0

undo sh

int vlan 20

ip address 192.168.20.1 255.255.255.0

int vlan 30

ip address 192.168.30.1 255.255.255.0

acl number 3001

rule 1 deny tcp source 192.168.30.0 0.0.0.255 destination 192.168.10.0

0.0.0.255 destination-port eq www

int e1/0/15

packet-filter inbound ip-group 3001 rule 1

进口

十、NAT地址转换(单一静态一对一地址转换)

R1:

sys

sysname R1

int e1/0

ip address 192.168.3.1 255.255.255.0

int e2/0

ip address 192.1.1.1 255.255.255.0

R2:

sys

sysname R2

int e2/0

ip address 192.1.1.2 255.255.255.0

int e1/0

ip address 10.80.1.1 255.255.255.0

回到R1:

nat static 192.168.3.1 192.1.1.1

int e2/0

nat outbound static

ip route 0.0.0.0 0.0.0.0 192.1.1.2

十一、NAT内部整网段地址转换

R1:

sys

sysname R1

int e1/0

ip address 192.168.3.1 255.255.255.0

int e2/0

ip address 192.1.1.1 255.255.255.0

acl number 2008

rule 0 permit source 192.168.3.0 0.0.0.255

rule 1 deny

quit

int e2/0

nat outbound 2008

quit

ip route-static 0.0.0.0 0.0.0.0 192.1.1.2 preference 60

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

为了让大家更加清楚,每行代码都有解释。

一、华为交换机基础配置命令

1、创建vlan:

//用户视图,也就是在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、将端口加入到vlan中:

[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] quit

3、将多个端口加入到VLAN中

system-view

[Quidway]vlan 10

[Quidway-vlan10]port GigabitEthernet 1/0/0 to 1/0/29 //将0到29号口加入到vlan10中

[Quidway-vlan10]quit

4、交换机配置IP地址

[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] quit

5、配置默认网关:

[Quidway]ip route-static 0.0.0.0 0.0.0.0 119.167.200.89 //配置默认网关。

6、 交换机保存设置和重置命令

save //保存配置信息

reset saved-configuration //重置交换机的配置

reboot //重新启动交换机

7、交换机常用的显示命令

用户视图模式下:

display current-configuration //显示现在交换机正在运行的配置明细

display device //显示各设备状态

display interface ? //显示个端口状态,用?可以查看后边跟的选项

display version //查看交换机固件版本信息

display vlan ? // 查看vlan的配置信息

8、恢复交换机出厂设置

reset saved-configuration //重置交换机的配置

二、H3C交换机的基本配置

我们先来了解下h3c的配置命令与功能,都是常用的,基本上大部分网络配置都少不了这些命令。

1、基本配置

//用户直行模式提示符,用户视图

system-view // 进入配置视图

[H3C] sysname xxx //设置主机名成为xxx这里使用修改特权用户密码

2、用户配置

system-view

[H3C]super password H3C //设置用户分级密码

[H3C]undo superpassword //删除用户分级密码

[H3C]localuser bigheap 1234561 //Web网管用户设置,1为管理级用户

[H3C]undo localuser bigheap //删除Web网管用户

[H3C]user-interface aux 0 //只支持0

[H3C-Aux]idle-timeout 250 //设置超时为2分50秒,若为0则表示不超时,默认为5分钟

[H3C-Aux]undoidle-timeout //恢复默认值

[H3C]user-interface vty 0 //只支持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 //用户界面状态

3、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-isolate enable //打开VLAN内端口隔离特性,不能二层转发, 默认不启用该功能

[H3C-Ethernet0/4]port-isolate uplink-portvlan 2 //设置4为VLAN2的 隔离上行端口 ,用于转发二层数据,只能配置一个上行端口,若为trunk,则建议允许所有VLAN通过,隔离不能与汇聚同时配置

[H3C]display vlan all // 显示所有VLAN的详细信息

[H3C]user-group 20 //创建user-group 20,默认只存在user-group 1

[H3C-UserGroup20]port Ethernet 0/4 toEthernet 0/7 // 将4到7号端口加入到VLAN20中, 初始时都属于user-group 1中

[H3C]display user-group 20 //显示user-group 20的相关信息

四、交换机ip配置

[H3C]vlan 20 // 创建vlan

[H3C]management-vlan 20 //管理vlan

[H3C]interface vlan-interface 20 // 进入并管理vlan20

[H3C]undo interface vlan-interface 20 //删除管理VLAN端口

[H3C-Vlan-interface20]ip address192.168.1.2 255.255.255.0 // 配置管理VLAN接口静态IP地址

[H3C-Vlan-interface20]undo ipaddress //删除IP地址

[H3C-Vlan-interface20]ip gateway 192.168.1.1 //指定缺省网关(默认无网关地址)

[H3C-Vlan-interface20]undo ip gateway

[H3C-Vlan-interface20]shutdown // 关闭接口

[H3C-Vlan-interface20]undo shutdown //开启

[H3C]display ip //显示管理VLAN接口IP的相关信息

[H3C]display interface vlan-interface20 //查看管理VLAN的接口信息

debugging ip //开启IP调试功能

undo debugging ip

5、DHCP客户端配置

[H3C-Vlan-interface20]ip address dhcp-alloc // 管理VLAN接口 通过DHCP方式获取IP地址

[H3C-Vlan-interface20]undo ip address dhcp-alloc // 取消

[H3C]display dhcp //显示DHCP客户信息

debugging dhcp-alloc //开启DHCP调试功能

undo debugging dhcp-alloc

6、端口配置

[H3C]interface Ethernet0/3 //进入端口

[H3C-Ethernet0/3]shutdown //关闭端口

[H3C-Ethernet0/3]speed 100 //速率可为10,100,1000和auto(缺省)

[H3C-Ethernet0/3]duplexfull // 双工,可 为half,full和auto,光口和汇聚后不能配置

[H3C-Ethernet0/3]flow-control // 开启流控,默认为关闭

[H3C-Ethernet0/3]broadcast-suppression 20 //设置抑制广播百分比为20%,可取5,10,20,100,缺省为100,同时组播和未知单播也受此影响

[H3C-Ethernet0/3]loopback internal //内环测试

[H3C-Ethernet0/3]port link-type trunk //设置链路的 类型为trunk

[H3C-Ethernet0/3]port trunk pvid vlan 20 //设置20为该trunk的缺省VLAN,默认为1(trunk线路两端的PVID必须一致)

[H3C-Ethernet0/3]port access vlan 20 //将当前 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 Ethernet 0/1 //删除该汇聚组

[H3C]link-aggregation mode egress //配置端口汇聚模式为根据目的MAC地址进行负荷分担,可选为 ingress,egress和both,缺省为both

[H3C]monitor-port Ethernet 0/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

resetcounters // 清除所有端口的统计信息

[H3C]display link-aggregation Ethernet0/3 // 显示端口 汇聚信息

[H3C-Ethernet0/3]virtual-cable-test //诊断该端口的电路状况

7、qos优先级配置

QoS配置步骤:设置端口的优先级,设置交换机信任报文的优先级方式,队列调度,端口限速

[H3C-Ethernet0/3]priority 7 //设置端口 优先级为7 ,默认为0

[H3C]priority-trustcos //设置交换机信任报文的优先级方式为cos(802.1p优先级,缺省值),还可以设为dscp方式

[H3C]queue-scheduler hq-wrr 2 4 6 8 //设置队列调度算法为HQ-WRR(默认为WRR),权重为2,4,6,8

[H3C-Ethernet0/3]line-rate inbound 29 //将 端口进口速率限制 为2Mbps,取1-28时,速率为rate*8*1024/125,即64,128,192...1.792M;

29-127时,速率为(rate-27)*1024,即2M,3M,4M...100M。

[H3C]displayqueue-scheduler //显示队列调度模式及参数

[H3C]displaypriority-trust // 显示优先级信任模式

三、锐捷交换机基础命令配置

连接上交换机后,肯定是需要进行命令配置,我们来看下基础命令配置。

1、准备命令

>Enable //进入特权模式

#Exit //返回上一级操作模式

#End //返回到特权模式

#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 //配置特权密码为star

Level 1为普通用户级别,可选为1~15,15为最高权限级别;0表示密码不加密

(config)#enable services web-server //开启交换机WEB管理功能

Services 可选以下:web-server(WEB管理)、telnet-server(远程登陆)等

2、查看信息

#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 //查看某一端口模式(如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的列表的配置信息

3、端口的基本配置

(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模式,可选模式为access , trunk

(config-if)#port-group 1 //将该端口划入聚合端口AG1中,用于聚合端口

4、聚合端口的创建

(config)# interface aggregateport 1 //创建聚合接口AG1

(config-if)# switchport mode trunk //配置并保证AG1为 trunk 模式

(config)#int f0/23-24

(config-if-range)#port-group 1 //将端口(端口组)划入聚合端口AG1中

5、生成树

配置多生成树协议:

switch(config)#spanning-tree //开启生成树协议

switch(config)#spanning-tree mst configuration //建立多生成树协议

switch(config-mst)#name ruijie //命名为ruijie

switch(config-mst)#revision 1 //设定校订本为1

switch(config-mst)#instance 0 vlan 10,20 //建立实例0

switch(config-mst)#instance 1 vlan 30,40 //建立实例1

switch(config)#spanning-tree mst 0 priority 4096 //设置优先级为4096

switch(config)#spanning-tree mst 1 priority 8192 //设置优先级为8192

switch(config)#interface vlan 10

switch(config-if)#vrrp 1 ip 192.168.10.1 //此为vlan 10的IP地址

switch(config)#interface vlan 20

switch(config-if)#vrrp 1 ip 192.168.20.1 //此为vlan 20的IP地址

switch(config)#interface vlan 30

switch(config-if)#vrrp 2 ip 192.168.30.1 //此为vlan 30的IP地址(另一三层交换机)

switch(config)#interface vlan 40

switch(config-if)#vrrp 2 ip 192.168.40.1 //此为vlan 40的IP地址(另一三层交换机)

6、VLAN的基本配置

(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 //启用该端口

7、端口安全

(config)# interface fastethernet 0/1 //进入一个端口

(config-if)# switchport port-security //开启该端口的安全功能

a、配置最大连接数限制

(config-if)# switchport port-secruity maxmum 1 //配置端口的最大连接数为1,最大连接数为128

(config-if)# switchport port-secruity violation shutdown

//配置安全违例的处理方式为shutdown,可选为protect (当安全地址数满后,将未知名地址丢弃)、restrict(当违例时,发送一个Trap通知)、shutdown(当违例时将端口关闭,并发送Trap通知,可在全局模式下用errdisable recovery来恢复)

b、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地址注意用小写)

8、三层路由功能(针对三层交换机)

(config)# ip routing //开启三层交换机的路由功能

(config)# interface fastethernet 0/1

(config-if)# no switchport //开启端口的三层路由功能(这样就可以为某一端口配置IP)

(config-if)# ip address 192.168.1.1 255.255.255.0

(config-if)# no shutdown

9、三层交换机路由协议

(config)# ip route 172.16.1.0 255.255.255.0 172.16.2.1 //配置静态路由

注:172.16.1.0 255.255.255.0 //为目标网络的网络号及子网掩码

172.16.2.1 为下一跳的地址,也可用接口表示,如ip route 172.16.1.0 255.255.255.0 serial 1/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为骨干区域)

可以明显看出,三家命令大同小异,其实华为与H3C更加类似。

四、普通交换机常用配置命令是什么?

CISCO交换机基本配置:Console端口连接 \x0d\x0a用户模式hostname# ;\x0d\x0a特权模式hostname(config)# ;\x0d\x0a全局配置模式hostname(config-if)# ;\x0d\x0a\x0d\x0a交换机口令设置: \x0d\x0aswitch>enable ;进入特权模式\x0d\x0aswitch#config terminal ;进入全局配置模式\x0d\x0aswitch(config)#hostname csico ;设置交换机的主机名\x0d\x0aswitch(config)#enable secret csico1 ;设置特权加密口令\x0d\x0aswitch(config)#enable password csico8 ;设置特权非密口令\x0d\x0aswitch(config)#line console 0 ;进入控制台口\x0d\x0aswitch(config-line)#line vty 0 4 ;进入虚拟终端\x0d\x0aswitch(config-line)#login ;虚拟终端允许登录\x0d\x0aswitch(config-line)#password csico6 ;设置虚拟终端登录口令csico6\x0d\x0aswitch#exit ;返回命令\x0d\x0a交换机VLAN创建,删除,端口属性的设置,配置trunk端口,将某端口加入vlan中,配置VTP:\x0d\x0aswitch#vlan database ;进入VLAN设置\x0d\x0aswitch(vlan)#vlan 2 ;建VLAN 2\x0d\x0aswitch(vlan)#vlan 3 name vlan3 ;建VLAN 3并命名为vlan3\x0d\x0aswitch(vlan)#no vlan 2 ;删vlan 2\x0d\x0aswitch(config)#int f0/1 ;进入端口1\x0d\x0aswitch(config)#speed ? 查看speed命令的子命令\x0d\x0aswitch(config)#speed 100 设置该端口速率为100mb/s (10/auto)\x0d\x0aswitch(config)#duplex ? 查看duplex的子命令\x0d\x0aswitch(config)#duplex full 设置该端口为全双工(auto/half)\x0d\x0aswitch(config)#description TO_PC1 这是该端口描述为TO_PC1\x0d\x0aswitch(config-if)#switchport access vlan 2 ;当前端口加入vlan 2\x0d\x0aswitch(config-if)#switchport mode trunk ;设置为trunk模式(access模式)\x0d\x0aswitch(config-if)#switchport trunk allowed vlan 1,2 ;设置允许的vlan\x0d\x0aswitch(config-if)#switchport trunk encap dot1q ;设置vlan 中继\x0d\x0aswitch(config)#vtp domain vtpserver ;设置vtp域名相同\x0d\x0aswitch(config)#vtp password ;设置发vtp密码\x0d\x0aswitch(config)#vtp server ;设置vtp服务器模式\x0d\x0aswitch(config)#vtp client ;设置vtp客户机模式\x0d\x0a\x0d\x0a交换机设置IP地址,默认网关,域名,域名服务器,配置和查看MAC地址表:\x0d\x0aswitch(config)#interface vlan 1 ;进入vlan 1\x0d\x0aswitch(config-if)#ip address 192.168.1.1 255.255.255.0 ;设置IP地址\x0d\x0aswitch(config)#ip default-gateway 192.168.1.6 ;设置默认网关\x0d\x0aswitch(config)#ip domain-name cisco.com 设置域名\x0d\x0aswitch(config)#ip name-server 192.168.1.18 设置域名服务器\x0d\x0aswitch(config)#mac-address-table? 查看mac-address-table的子命令\x0d\x0aswitch(config)#mac-address-table aging-time 100 设置超时时间为100ms\x0d\x0aswitch(config)#mac-address-table permanent 0000.0c01.bbcc f0/3 加入永久地址在f0/3端口\x0d\x0aswitch(config)#mac-address-table restricted static 0000.0c02.bbcc f0/6 f0/7 加入静态地址目标端口f0/6源端口f0/7\x0d\x0aswitch(config)#end\x0d\x0aswitch#show mac-address-table 查看整个MAC地址表\x0d\x0aswitch#clear mac-address-table restricted static 清除限制性静态地址\x0d\x0a交换机显示命令:\x0d\x0aswitch#write ;保存配置信息\x0d\x0aswitch#show vtp ;查看vtp配置信息\x0d\x0aswitch#show run ;查看当前配置信息\x0d\x0aswitch#show vlan ;查看vlan配置信息\x0d\x0aswitch#show interface ;查看端口信息\x0d\x0aswitch#show int f0/0 ;查看指定端口信息\x0d\x0aswitch#show int f0/0 status;查看指定端口状态\x0d\x0aswitch#dir flash: ;查看闪存

五、H3C交换机基本命令配置

H3C交换机基本命令配置大全

H3C CAS云计算管理平台是为企业数据中心量身定做的虚拟化和云计算管理软件。以下是关于H3C交换机基本命令配置大全,希望大家认真阅读!

h3c-switch/' target='_blank'>H3C交换机配置命令大全H3C交换机

1、system-view 进入系统视图模式

2、sysname 为设备命名

3、display current-configuration 当前配置情况

4、 language-mode Chinese|English 中英文切换

5、interface Ethernet 1/0/1 进入以太网端口视图

6、 port link-type Access|Trunk|Hybrid 设置端口访问模式 7、 undo shutdown 打开以太网端口

8、 shutdown 关闭以太网端口

9、 quit 退出当前视图模式

10、 vlan 10 创建VLAN 10并进入VLAN 10的视图模式

11、 port access vlan 10 在端口模式下将当前端口加入到vlan 10中

12、port E1/0/2 to E1/0/5 在VLAN模式下将指定端口加入到当前vlan中

13、port trunk permit vlan all 允许所有的vlan通过

H3C路由器

1、system-view 进入系统视图模式

2、sysname R1 为设备命名为R1

3、display ip routing-table 显示当前路由表

4、 language-mode Chinese|English 中英文切换

5、interface Ethernet 0/0 进入以太网端口视图

6、 ip address 192.168.1.1 255.255.255.0 配置IP地址和子网掩码

7、 undo shutdown 打开以太网端口

8、 shutdown 关闭以太网端口

9、 quit 退出当前视图模式

10、 ip route-static 192.168.2.0 255.255.255.0 192.168.12.2 description To.R2 配置静态路由

11、 ip route-static 0.0.0.0 0.0.0.0 192.168.12.2 description To.R2 配置默认的路由

H3C S3100 Switch H3C S3600 Switch H3C MSR 20-20 Router

1、调整超级终端的显示字号;

2、捕获超级终端操作命令行,以备日后查对;

3、 language-mode Chinese|English 中英文切换;

4、复制命令到超级终端命令行, 粘贴到主机;

5、交换机清除配置 : reset save ; reboot ;

6、路由器、交换机配置时不能掉电,连通测试前一定要 检查网络的连通性,不要犯最低级的错误。

7、192.168.1.1/24 等同 192.168.1.1 255.255.255.0;在配置交换机和路由器时, 192.168.1.1 255.255.255.0 可以写成: 192.168.1.1 24

8、设备命名规则:地名-设备名-系列号例:PingGu-R-S3600

H3C华为交换机端口绑定基本配置

1.端口 MAC

a)AM命令

使用特殊的AM User-bind命令,来完成MAC地址与端口之间的绑定。例如:

[SwitchA]am user-bind mac-address 00e0-fc22-f8d3 interface Ethernet 0/1

配置说明:由于使用了端口参数,则会以端口为参照物,即此时端口E0/1只允许PC1上网,而使用其他未绑定的MAC地址的PC机则无法上网。但是PC1使用该MAC地址可以在其他端口上网。

b)mac-address命令

使用mac-address static命令,来完成MAC地址与端口之间的绑定。例如:

[SwitchA]mac-address static 00e0-fc22-f8d3 interface Ethernet 0/1 vlan 1

[SwitchA]mac-address max-mac-count 0

配置说明:由于使用了端口学习功能,故静态绑定mac后,需再设置该端口mac学习数为0,使其他PC接入此端口后其mac地址无法被学习。

2.IP MAC

a)AM命令

使用特殊的AM User-bind命令,来完成IP地址与MAC地址之间的绑定。例如:

[SwitchA]am user-bind ip-address 10.1.1.2 mac-address 00e0-fc22-f8d3

配置说明:以上配置完成对PC机的IP地址和MAC地址的全局绑定,即与绑定的IP地址或者MAC地址不同的PC机,在任何端口都无法上网。

支持型号:S3026E/EF/C/G/T、S3026C-PWR、E026/E026T、S3050C、E050、S3526E/C/EF、S5012T/G、S5024G

b)arp命令

使用特殊的arp static命令,来完成IP地址与MAC地址之间的绑定。例如:

[SwitchA]arp static 10.1.1.2 00e0-fc22-f8d3

配置说明:以上配置完成对PC机的IP地址和MAC地址的全局绑定。

3.端口 IP MAC

使用特殊的AM User-bind命令,来完成IP、MAC地址与端口之间的绑定。例如:

[SwitchA]am user-bind ip-address 10.1.1.2 mac-address 00e0-fc22-f8d3 interface Ethernet 0/1

配置说明:可以完成将PC1的IP地址、MAC地址与端口E0/1之间的绑定功能。由于使用了端口参数,则会以端口为参照物,即此时端口E0/1只允许 PC1上网,而使用其他未绑定的IP地址、MAC地址的PC机则无法上网。但是PC1使用该IP地址和MAC地址可以在其他端口上网。

[S2016-E1-Ethernet0/1]mac-address max-mac-count 0;

进入到端口,用命令mac max-mac-count 0(端口mac学习数设为0)

[S2016-E1]mac static 0000-9999-8888 int e0/1 vlan 10;

将0000-9999-8888绑定到e0/1端口上,此时只有绑定mac的pc可以通过此口上网,同时E0/1属于vlan 10

就这样,ok了,不过上面两个命令顺序不能弄反,除非端口下没有接pc

dis vlan 显示vlan

name text 指定当前vlan的.名称

undo name 取消

[h3c] vlan 2

[h3c-vlan2]name test vlan

dis users 显示用户

dis startup 显示启动配置文件的信息

dis user-interface 显示用户界面的相关信息

dis web users 显示web用户的相关信息。

header login 配置登陆验证是显示信息

header shell

undo header

lock 锁住当前用户界面

acl 访问控制列表 acl number inbound/outbound

[h3c]user-interface vty 0 4

[h3c-vty0-4] acl 2000 inbound

shutdown:关闭vlan接口

undo shutdown 打开vlan接口

关闭vlan1 接口

[h3c] interface vlan-interface 1

[h3c-vlan-interface] shutdown

vlan vlan-id 定义vlan

undo valn vlan-id

display ip routing-table

display ip routing-table protocol static

display ip routing-table statistics

display ip routing-table verbose 查看路由表的全部详细信息

interface vlan-interface vlan-id 进入valn

management-vlan vlan-id 定义管理vlan号

reset ip routing-table statistics protocol all 清除所有路由协议的路由信息.

display garp statistics interface GigabitEthernet 1/0/1 显示以太网端口上的garp统计信息

display voice vlan status 查看语音vlan状态

[h3c-GigabitEthernet1/0/1] broadcast-suppression 20 允许接受的最大广播流量为该端口传输能力的20%.超出部分丢弃.

[h3c-GigabitEthernet1/0/1] broadcast-suppression pps 1000 每秒允许接受的最大广播数据包为1000传输能力的20%.超出部分丢弃.

display interface GigabitEthernet1/0/1 查看端口信息

display brief interface GigabitEthernet1/0/1 查看端口简要配置信息

display loopback-detection 用来测试环路测试是否开启

display transceiver-information interface GigabitEthernet1/0/50 显示光口相关信息

duplex auto/full/half

[h3c]interface GigabitEthernet1/0/1

[h3c-GigabitEthernet1/0/1]duplux auto 设置端口双工属性为自协商

port link-type access/hybrid/trunk 默认为access

port trunk permit vlan all 将trunk扣加入所有vlan中

reset counters interface GigabitEthernet1/0/1 清楚端口的统计信息

speed auto 10/100/1000

display port-security 查看端口安全配置信息

am user-bind mac-addr 00e0-fc00-5101 ip-addr 10.153.1.2 interface GigabitEthernet1/0/1 端口ip绑定

display arp 显示arp

display am user-bind 显示端口绑定的配置信息

display mac-address 显示交换机学习到的mac地址

display stp 显示生成树状态与统计信息

[h3c-GigabitEthernet1/0/1]stp instance 0 cost 200 设置生成树实例0上路径开销为200

stp cost 设置当前端口在指定生成树实例上路径开销。instance-id 为0-16 0表cist 取值范围1-200000

display system-guard ip-record 显示防攻击记录信息.

system-guard enable 启用系统防攻击功能

display icmp statistics icmp流量统计

display ip socket

display ip statistics

display acl all

acl number acl-number match-order auto/config

acl-number (2000-2999 是基本acl 3000-3999是高级acl为管理员预留的编号)

rule deny/permit protocal

访问控制 [h3c] acl number 3000

[h3c-acl-adv-3000]rule permit tcp source 129.9.0.0 0.0.255.255 destination 202.38.160.0 0.0.255.255 destination-port eq 80 (定义高级acl 3000,允许129.0.0/16网段的主机向202.38.160/24网段主机访问端口80)

rule permit source 211.100.255.0 0.255.255.255

rule deny cos 3 souce 00de-bbef-adse ffff-ffff-fff dest 0011-4301-9912 ffff-ffff-ffff

(禁止mac地址00de-bbef-adse发送到mac地址0011-4301-9912且802.1p优先级为3的报文通过)

display qos-interface GigabitEthernet1/0/1 traffic-limit 查看端口上流量

端口速率限制

line-rate inbound/outbound target-rate

inbound:对端口接收报文进行速率限制

outbound: 对端口发送报文进行速率限制

target-rate 对报文限制速率,单位kbps 千兆口 inbound范围1-1000000 outbound范围20-1000000

undo line-rate取消限速.

[h3c]interface GigabitEthernet1/0/1

[h3c-GigabitEthernet1/0/1]line-rate outbound 128 限制出去速率为128kbps

display arp | include 77

display arp count 计算arp表的记录数

display ndp 显示交换机端口的详细配置信息。

display ntdp device-list verbose 收集设备详细信息

display lock

display users

display cpu

display memory

display fan

display device

display power

;

六、交换机怎么配置 交换机怎么配置

1、首先将一台PC和一台交换机用线缆连接起来;

2、打开PC,规范好PC的网络配置,记住PC的网关就是交换机的IP地址;

3、进入交换机的中端里面进行配置;

4、先给交换机起一个名字,命令是:

Switch#conf tEnter configuration commands, one per line. End with CNTL/Z.Switch(config)#hostname s1s1(config)#

5、在小型或中型甚至大型企业,不可能只有一台交换机连接一台电脑,这得多浪费啊,所以有多个交换机的端口;

6、交换机还可以创建wlan模式。