[sw]int e1/0/2
[sw-ethernet1/0/2]port link-type hybrid
[sw-ethernet1/0/2]port hybrid vlan 1 2 * untagged
刚刚看见比较好的命令介绍,与大家共享!!!
一、交换机简单管理协议增加指令----以便接入的管理中
snmp-agent
snmp-agent community read public
snmp-agent community write private
snmp-agent sys-info version v1 v3
snmp-agent trap enable
备注:每台新增的交换机均需加入上述指令集合,否则不能为管理软件所管理
二、将新增交换机的vlan1段设置ip地址
interface vlan 1
ip address 10.63.0.1 255.255.254.0
三、华为交换机指令的相关案例
[quidway]super password 修改特权用户密码
[quidway]sysname 交换机命名
[quidway]interface ethernet 0/1 进入接口视图
[quidway]interface vlan x 进入x段vlan接口视图
[quidway-vlan-interfacex]ip address 10.65.1.1 255.255.0.0 为vlan段设置地址
[quidway]ip route-static 0.0.0.0 0.0.0.0 10.65.1.2 静态路由=
[quidway]user-interface vty 0 4
[-ui-vty0-4]authentication-mode password
[s3026-ui-vty0-4]set authentication-mode password simple 222
[s3026-ui-vty0-4]user privilege level 3
[quidway-ethernet0/1]duplex {half|full|auto} 配置端口双工工作状态
[quidway-ethernet0/1]speed {10||auto} 配置端口工作速率
[quidway-ethernet0/1]flow-control 配置端口流控
[quidway-ethernet0/1]mdi {across|auto|normal} 配置端口mdi/mdix状态平接或扭接
[quidway-ethernet0/1]port link-type {trunk|access|hybrid} 设置接口工作模式
[quidway-ethernet0/1]shutdown 关闭/重起接口
[quidway-ethernet0/2]quit 退出系统视图
[quidway]vlan 3 创建/删除一个vlan/进入vlan模式
[quidway-vlan3]port ethernet 0/1 to ethernet 0/4 在当前vlan增加/删除以太网接口
[quidway-ethernet0/2]port access vlan 3 将当前接口加入到指定vlan
[quidway-ethernet0/2]port trunk permit vlan {id|all} 设trunk允许的vlan
[quidway-ethernet0/2]port trunk pvid vlan 3 设置trunk端口的pvid
[quidway]monitor-port 指定和清除镜像端口
[quidway]port mirror 指定和清除被镜像端口
[quidway]port mirror int_list observing-port int_type int_num 指定镜像和被镜像
[quidway]description string 指定vlan描述字符
[quidway]description 删除vlan描述字符
[quidway]display vlan [vlan_id] 查看vlan设置
[quidway]stp {enable|disable} 开启/关闭生成树,默认关闭
[quidway]stp priority 4096 设置交换机的优先级
[quidway]stp root {primary|secondary} 设置交换机为根或根的备份
[quidway-ethernet0/1]stp cost 设置交换机端口的花费
[switcha-vlanx]isolate-user-vlan enable 设置主vlan
[switcha]isolate-user-vlan secondary 设置主vlan包括的子vlan
[quidway-ethernet0/2]port hybrid pvid vlan 设置vlan的pvid
[quidway-ethernet0/2]port hybrid pvid 删除vlan的pvid
[quidway-ethernet0/2]port hybrid vlan vlan_id_list untagged 设置无标识的vlan
如果包的vlan id与pvid一致,则去掉vlan信息. 默认pvid=1。
所以设置pvid为所属vlan id, 设置可以互通的vlan为untagged.
----------------------------------------
命令
~~~~~~~~~~
[quidway]display version 显示版本信息
[quidway]display current-configuration 显示当前配置
[quidway]display interfaces 显示接口信息
[quidway]display ip route 显示路由信息
[quidway]sysname aabbcc 更改主机名
[quidway]super passwrod 123456 设置口令
[quidway]interface serial0 进入接口
[quidway-serial0]ip address
[quidway-serial0]undo shutdown 激活端口
[quidway]link-protocol hdlc 绑定hdlc协议
[quidway]user-interface vty 0 4
[quidway-ui-vty0-4]authentication-mode password
[quidway-ui-vty0-4]set authentication-mode password simple 222
[quidway-ui-vty0-4]user privilege level 3
[quidway-ui-vty0-4]quit
[quidway]debugging hdlc all serial0 显示所有信息
[quidway]debugging hdlc event serial0 调试事件信息
[quidway]debugging hdlc packet serial0 显示包的信息
静态路由:
[quidway]ip route-static {interface number|nexthop}[value][reject|blackhole]
例如:
[quidway]ip route-static 129.1.0.0 16 10.0.0.2
[quidway]ip route-static 129.1.0.0 255.255.0.0 10.0.0.2
[quidway]ip route-static 129.1.0.0 16 serial 2
[quidway]ip route-static 0.0.0.0 0.0.0.0 10.0.0.2
动态路由:
[quidway]rip
[quidway]rip work
[quidway]rip input
[quidway]rip output
[quidway-rip]network 1.0.0.0 ;可以all
[quidway-rip]network 2.0.0.0
[quidway-rip]peer ip-address
[quidway-rip]summary
[quidway]rip version 1
[quidway]rip version 2 multicast
[quidway-ethernet0]rip split-horizon ;水平分隔
[quidway]router id a.b.c.d 配置路由器的id
[quidway]ospf enable 启动ospf协议
[quidway-ospf]import-route direct 引入直联路由
[quidway-serial0]ospf enable area 配置ospf区域
标准访问列表命令格式如下:
acl [match-order config|auto] 默认前者顺序匹配。
rule [normal|special]{permit|deny} [source source-addr source-wildcard|any]
例:
[quidway]acl 10
[quidway-acl-10]rule normal permit source 10.0.0.0 0.0.0.255
[quidway-acl-10]rule normal deny source any
扩展访问控制列表配置命令
配置tcp/udp协议的扩展访问列表:
rule {normal|special}{permit|deny}{tcp|udp}source {|any}destination |any}
[operate]
配置icmp协议的扩展访问列表:
rule {normal|special}{permit|deny}icmp source {|any]destination {|any]
[icmp-code] [logging]
扩展访问控制列表操作符的含义
equal portnumber 等于
greater-than portnumber 大于
less-than portnumber 小于
not-equal portnumber 不等
range portnumber1 portnumber2 区间
扩展访问控制列表举例
[quidway]acl 101
[quidway-acl-101]rule deny souce any destination any
[quidway-acl-101]rule permit icmp source any destination any icmp-type echo
[quidway-acl-101]rule permit icmp source any destination any icmp-type echo-reply
[quidway]acl 102
[quidway-acl-102]rule permit ip source 10.0.0.1 0.0.0.0 destination 202.0.0.1 0.0.0.0
[quidway-acl-102]rule deny ip source any destination any
[quidway]acl 103
[quidway-acl-103]rule permit tcp source any destination 10.0.0.1 0.0.0.0 destination-port equal ftp
[quidway-acl-103]rule permit tcp source any destination 10.0.0.2 0.0.0.0 destination-port equal www
[quidway]firewall enable
[quidway]firewall default permit|deny
[quidway]int e0
[quidway-ethernet0]firewall packet-filter 101 inbound|outbound
地址转换配置举例
[quidway]firewall enable
[quidway]firewall default permit
[quidway]acl 101
[quidway-acl-101]rule deny ip source any destination any
[quidway-acl-101]rule permit ip source 129.38.1.4 0 destination any
[quidway-acl-101]rule permit ip source 129.38.1.1 0 destination any
[quidway-acl-101]rule permit ip source 129.38.1.2 0 destination any
[quidway-acl-101]rule permit ip source 129.38.1.3 0 destination any
[quidway]acl 102
[quidway-acl-102]rule permit tcp source 202.39.2.3 0 destination 202.38.160.1 0
[quidway-acl-102]rule permit tcp source any destination 202.38.160.1 0 destination-port great-than
1024
[quidway-ethernet0]firewall packet-filter 101 inbound
[quidway-serial0]firewall packet-filter 102 inbound
[quidway]nat address-group 202.38.160.101 202.38.160.103 pool1
[quidway]acl 1
[quidway-acl-1]rule permit source 10.110.10.0 0.0.0.255
[quidway-acl-1]rule deny source any
[quidway-acl-1]int serial 0
[quidway-serial0]nat outbound 1 address-group pool1
[quidway-serial0]nat server global 202.38.160.101 inside 10.110.10.1 ftp tcp
[quidway-serial0]nat server global 202.38.160.102 inside 10.110.10.2 www tcp
[quidway-serial0]nat server global 202.38.160.102 8080 inside 10.110.10.3 www tcp
[quidway-serial0]nat server global 202.38.160.103 inside 10.110.10.4 smtp udp
ppp验证:
主验方:pap|chap
[quidway]local-user u2 password {simple|cipher} aaa
[quidway]interface serial 0
[quidway-serial0]ppp authentication-mode {pap|chap}
[quidway-serial0]ppp chap user u1 //pap时,不用此句
pap被验方:
[quidway]interface serial 0
[quidway-serial0]ppp pap local-user u2 password {simple|cipher} aaa
chap被验方:
[quidway]interface serial 0
[quidway-serial0]ppp chap user u1
[quidway-serial0]local-user u2 password {simple|cipher} aaa