当前位置:首页>微思动态 > >详情
全国热线电话 400-881-4699

在线留言

【干货】思科、华为常用命令对决,看看哪款适合你

发布作者:微思网络   发布时间:2017-06-09   浏览量:0


思科和华为交换机应该是网络项目中大家接触比较多的了,这两种交换机的常用命令各有不同,本文结合网络项目中两种交换机的常用命令从对比的角度帮助大家来学习。




思科:

Switch#show  run        显示所有配置命令

Switch#show ip inter brief  显示所有接口状态

Switch#show vlan  brief   显示所有VLAN的信

Switch#show   version    显示版本信息


华为:

[Quidway]dis cur   显示所有配置命令

[Quidway]display interfaces  显示所有接口状态

[Quidway]display vlan all   显示所有VLAN的信息

[Quidway]display version   显示版本信息  



思科:
Switch(config)#interface f0/8  进入接口视图
Switch(config-if)#no shut  此命令开启接口
Switch(config-if)#description to server01 端口描述

Switch(config-if)#ip add 192.168.1.100 255.255.255.0 设置接口IP 


华为:
[Quidway]interface e0/1  进入接口视图
[Quidway]undo  shutdown  此命令开启接口
[Quidway]description  to server02   端口描述
[Quidway]ip add 192.168.1.102 255.255.255.0   设置接口IP


思科:
建立和删除VLAN
Switch# vlan database
Switch(vlan)# vlan 20 name test20
Switch(vlan)# no vlan 20
Switch(vlan)# exit
将端口分配给一个VLAN
Switch(config)# interface f0/1 
Switch(config-if)# switchport mode access 
Switch(config-if)# switchport access vlan 20
设置VLAN TRUNK
Switch(config)# interface f0/24 
Switch(config-if)# switchport mode trunk 
Switch(config-if)#switchport trunk allow vlan {ID|All} 
Switch(config-if)# switchport trunk encapsulation dot1q


华为:
建立和删除VLAN
[Quidway]vlan 30
[Quidway]undo  vlan 30 
将端口分配给一个VLAN
[Quidway]int ethernet0/1
[Quidway-Ethernet0/1]port access vlan 30( port default vlan 30)
或[Quidway]vlan 30              
[Quidway-vlan3]port ethernet 0/1  在VLAN中增加端口
[Quidway-vlan3]port ethernet 0/1 to ethernet 0/4   在VLAN中增加多个连续端口
设置VLAN TRUNK
[Quidway]int e0/24 
[Quidway-Ethernet0/24] port link-type trunk
[Quidway-Ethernet0/24]port trunk permit vlan {ID|All} 




思科:
配置镜像源端口
Switch(config)#monitor session 1 source interface gigabitEthernet 0/2 - 5 rx
上面命令最后一个参数:
both  监听双向数据,默认为both
rx    接收
tx    发送
 
配置镜像目的端口
Switch(config)#monitor session 1 destination interface gigabitEthernet 0/6

删除镜像端口
Switch(config)#no monitor session 1



华为

将端口E0/2配置为监控端口

[Quidway]monitor-port Ethernet 0/2

端口E0/1配置为镜像端口

[Quidway]port mirror Ethernet 0/1

或者直接配置监控端口和镜像端口


[Quidway]port mirror Ethernet 0/1 observing-port Ethernet 0/2
   删除镜像[Quidway]undo    monitor-port




思科HSRP:

Switch# interface Vlan20

ip address 172.29.197.33  255.255.255.248

standby 20 ip 172.29.197.53

standby 20 priority 105   优先级

standby 20 preempt       抢占

standby 20 track GigabitEthernet0/25  decrement 10   跟踪端口如果DOWN了优先级减10


华为VRRP

[Quidway]interface Vlanif30

ip address 172.29.197.9   255.255.255.248

vrrp vrid 30 virtual-ip 172.29.141.11

vrrp vrid 30 priority 150  优先级

vrrp vrid 30 preempt-mode   抢占

vrrp vrid 30 track interface GigabitEthernet0/0/18 reduced 60  跟踪端口如果DOWN了优先级减60



思科设置vty安全访问: 
R1(config)# access-list 1 permit 192.168.2.5 
R1(config)# line vty 0 4 
R1(config)# access-class 1 in 


华为设置vty安全访问:
[Quidway]acl number 2000
        rule 1 permit source 172.29.181.150  0
        rule 2 deny 
[Quidway]user-interface vty 0 4
         acl 2000 inbound




  思科:
Cisco6509#show clock    显示时间
Cisco6509#clock set 14:00:00 30 Sep 2011 设置时间
Cisco6509(config)#ntp server 202.198.0.102 设置与其他时间服务器同步
Cisco6509(config)#clock timezone beijing +8  设置时区


华为:
[Quidway]dis clock  显示时间
[Quidway]clock datetime 23:30:00 2011/11/16  设置时间
[Quidway]ntp-service unicast-server 202.198.0.102  设置与其他时间服务器同步
[Quidway]clock timezone  E8  add  08:00:00  设置时区





思科:
ip route <目的网段> <目的网段掩码><下一跳> 
Cisco6509# ip   route     0.0.0.0  0.0.0.0   10.65.1.2      静态路由
Cisco6509#ip route  0.0.0.0  0.0.0.0  192.168.3.1 150  浮动静态路由管理距离为150

  华为:
[Quidway] ip  route-static   0.0.0.0  0.0.0.0   10.65.1.2
[Quidway]ip route-static 0.0.0.0  0.0.0.0 192.168.3.1   preference  150


思科:
Switch(config)#snmp-server community sunion ro 配置本交换机的只读字串为sunion
Switch(config)#snmp-server community sunion rw 配置本交换机的读写字串为sunion
Switch(config)#snmp-server enable traps 允许交换机将所有类型SNMP Trap发送出去
Switch(config)#snmp-server host 192.168.190.1  traps sunion 指定交换机SNMP Trap的接收者为192.168.190.1,发送Trap时采用sunion作为字串


华为:
[Quidway]snmp-agent community read  datanms 配置本交换机的只读字串为datanms
[Quidway]snmp-agent community write  datanms 配置本交换机的读写字串为datanms
[Quidway]snmp-agent sys-info location BeiJing China 设置交换机的位置信息
[Quidway]snmp-agent sys-info version all  设置交换机支持所有的SNMP协议版本

[Quidway]snmp-agent target-host trap  address udp-domain 192.168.190.121 params securityname datanms  指定交换机SNMP Trap的接收者为192.168.190.121 ,发送Trap时采用datanms作为字串


好了,通过以上九点的举例就是我在厦门计算机培训机构时学的,相信大家对项目中两种交换机的常用命令应该比较清晰了,当然更多的命令使用和技巧需要我们不断的积累。





返回顶部