Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3385907
  • 博文数量: 631
  • 博客积分: 10716
  • 博客等级: 上将
  • 技术积分: 8397
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-01 22:35
文章分类

全部博文(631)

文章存档

2020年(2)

2019年(22)

2018年(4)

2017年(37)

2016年(22)

2015年(1)

2013年(12)

2012年(20)

2011年(19)

2010年(20)

2009年(282)

2008年(190)

分类: 系统运维

2009-05-31 11:46:46

个人总结的一些华为命令



删除设备配置

reset saved-configuration



重启

reboot



看当前配置文件

display current-configuration



改设备名

sysname



保存配置

save



进入特权模式

sysview

华为只有2层模式 不像cisco enale之后还要conf t



定义acl

acl nubmere XXXX(3000以上)进入以后

rule permit/deny IP/TCP/UDP等 source XXX.XXX.XXX.XXX XXX.XXX.XXX.XXX(反向)

destination XXX.XXX.XXX.XXX XXX.XXX.XXX.XXX(反向) eq

注意 华为默认没有deny any any



防火墙上端口加载ACL

[Quidway-Ethernet0/0]firewall packet-filter 3000 inbound



防火墙上新增加用户

local-user XXX(用户名) password simple XXX(密码)

local-user XXX service-type ppp




删除某条命令

undo(类似与cisco的no)



静态路由

ip route-static 0.0.0.0 0.0.0.0 XXX.XXX.XXX.XXX



对vpdn用户设置acl的接口

inte***ce Virtual-Template1



查看路由表

display ip routing-table



设定telnet密码

user-inte***ce vty 0 4

user privilege level 3

set authentication password simple XXX




启动/关闭

启动 un shut

关闭 shut



动态nat设置

acl number 3000

rule 0 permit ip source XXX.XXX.XXX.XXX

rule 1 permit ip source XXX.XXX.XXX.XXX

rule 2 permit ip source XXX.XXX.XXX.XXX

inte***ce Ethernet1/0

description ====To-Internet(WAN)====

ip address XXX.XXX.XXX.XXX XXX.XXX.XXX.XXX

nat outbound 3000

ipsec policy policy1

利用acl来做 符合acl的IP地址可以出去(注意 此处的ACL隐含了deny any any)不符合的IP地址不可以出去



创建vlan

[shzb-crsw-s6506-1]vlan 100

华为vlan不支持name

将port放入vlan

创建了vlan后 进入vlan模式

[shzb-crsw-s6506-1-vlan100]port GigabitEthernet 1/0/1 to GigabitEthernet 1/0/8

表示从G1/0/1 到1/0/8放入VLAN 100



创建trunk

inte***ce GigabitEthernet1/0/1

duplex full

speed 1000

* port link-type trunk

* port trunk permit vlan all

port link-aggregation group 1

带*号的是创建trunk链路的语句



vlan地址指定

inte***ce Vlan-inte***ce2

description server

ip address XXX.XXX.XXX.XXX XXX.XXX.XXX.XXX

vrrp vrid 2 virtual-ip XXX.XXX.XXX.XXX

vrrp vrid 2 priority 120

vrrp vrid 2 preempt-mode timer delay 10

其中vrrp语句指定vrrp 类似与hsrp

使用vrrp要注意的是华为不支持pvst

只能一台完全是主,一台完全是备份

在主vrrp设备上要指定

stp instance 0 root primary

stp TC-protection enable

stp enable

在从vrrp设备上要指定

stp instance 0 root secondary

stp TC-protection enable

stp enable



交换机下面绑acl

首先进入接口模式,输入qos命令

[shzb-crsw-s6506-1-GigabitEthernet1/0/1]qos

在输入如下命令

[shzb-crsw-s6506-1-qoss-GigabitEthernet1/0/1]packet-filter inbound ip-group 3000

华为交换机只能指定inbound方向



启用ospf

[shzb-crsw-s6506-1]ospf 100

[shzb-crsw-s6506-1-ospf-100]area 0

[shzb-crsw-s6506-1-ospf-100-area-0.0.0.0]network XXX.XXX.XXX.XXX XXX.XXX.XXX.XXX

配置ospf重发布

[shzb-crsw-s6506-1-ospf-100-area-0.0.0.0]quit

[shzb-crsw-s6506-1-ospf-100]import-route static



建立link-group(类似与cisco的channel-group)



link-aggregation group 1 mode manual

然后进入接口

port link-aggregation group 1



启用VRRP之前必须输入

vrrp ping-enable

使得客户能ping网关


交换机命令
~~~~~~~~~~
[Quidway]dis cur                                        ;显示当前配置
[Quidway]display current-configuration                  ;显示当前配置
[Quidway]display interfaces                             ;显示接口信息
[Quidway]display vlan all                               ;显示路由信息
[Quidway]display version                                ;显示版本信息
[Quidway]super password                                       ;修改特权用户密码
[Quidway]sysname                                       ;交换机命名
[Quidway]interface ethernet 0/1                               ;进入接口视图
[Quidway]interface vlan x                               ;进入接口视图
[Quidway-Vlan-interfacex]ip address 10.65.1.1 255.255.0.0     ;配置VLAN的IP地址
[Quidway]ip route-static 0.0.0.0 0.0.0.0 10.65.1.2            ;静态路由=网关
[Quidway]rip                                                  ;三层交换支持
[Quidway]local-user ftp
[Quidway]user-interface vty 0 4                               ;进入虚拟终端
[S3026-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]interface ethernet 0/1                               ;进入端口模式
[Quidway]int e0/1                                             ;进入端口模式
[Quidway-Ethernet0/1]duplex {half|full|auto}                  ;配置端口工作状态
[Quidway-Ethernet0/1]speed {10|100|auto}                  ;配置端口工作速率
[Quidway-Ethernet0/1]flow-control                        ;配置端口流控
[Quidway-Ethernet0/1]mdi {across|auto|normal}                 ;配置端口平接扭接
[Quidway-Ethernet0/1]port link-type {trunk|access|hybrid}     ;设置端口工作模式
[Quidway-Ethernet0/1]port access vlan 3                  ;当前端口加入到VLAN
[Quidway-Ethernet0/2]port trunk permit vlan {ID|All}        ;设trunk允许的VLAN
[Quidway-Ethernet0/3]port trunk pvid vlan 3          ;设置trunk端口的PVID
[Quidway-Ethernet0/1]undo shutdown                       ;激活端口
[Quidway-Ethernet0/1]shutdown                               ;关闭端口
[Quidway-Ethernet0/1]quit                               ;返回
[Quidway]vlan 3                                         ;创建VLAN
[Quidway-vlan3]port ethernet 0/1                 ;在VLAN中增加端口
[Quidway-vlan3]port e0/1                                 ;简写方式
[Quidway-vlan3]port ethernet 0/1 to ethernet 0/4         ;在VLAN中增加端口
[Quidway-vlan3]port e0/1 to e0/4                         ;简写方式
[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 200                        ;设置交换机端口的花费
[Quidway]link-aggregation e0/1 to e0/4 ingress|both           ; 端口的聚合
[Quidway]undo link-aggregation e0/1|all                       ;  始端口为通道号
[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         ;配置端口IP地址
[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                             ;设置交换路由网络
[Quidway-rip]network all                                      ;设置与所有网络交换
[Quidway-rip]peer ip-address                                  ;
[Quidway-rip]summary                                          ;路由聚合
[Quidway]rip version 1                                        ;设置工作在版本1
[Quidway]rip version 2 multicast                              ;设版本2,多播方式
[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                             ;内部指定主机可以进入e0
[Quidway-acl-101]rule deny ip source any 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-101]rule permit ip source 129.38.1.4 0 destination any
[Quidway-acl-101]quit
[Quidway]int e0
[Quidway-Ethernet0]firewall packet-filter 101 inbound
[Quidway]acl 102                             ;外部特定主机和大于1024端口的数据包允许进入S0
[Quidway-acl-102]rule deny ip source any destination any
[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-acl-102]quit
[Quidway]int s0
[Quidway-Serial0]firewall packet-filter 102 inbound      ;设202.38.160.1是路由器出口IP。
[Quidway-Serial0]nat outbound 101 interface   ;是Easy ip,将acl 101允许的IP从本接口出时变换源地址。
内部服务器地址转换配置命令(静态nat):
nat server global [port] inside port [protocol]       ;global_port不写时使用inside_port
[Quidway-Serial0]nat server global 202.38.160.1 inside 129.38.1.1 ftp tcp
[Quidway-Serial0]nat server global 202.38.160.1 inside 129.38.1.2 telnet tcp
[Quidway-Serial0]nat server global 202.38.160.1 inside 129.38.1.3 www tcp

设有公网IP:202.38.160.101~202.38.160.103 可以使用。             ;对外访问(原例题)
[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              ;在s0口从地址池取出IP对外访问
[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设置:
[Quidway-s0]link-protocol ppp                                  ;默认的协议
PPP验证:
主验方:pap|chap
[Quidway]local-user q2 password {simple|cipher} hello          ;路由器1
[Quidway]interface serial 0
[Quidway-serial0]ppp authentication-mode {pap|chap}
[Quidway-serial0]ppp chap user q1                              ;pap时,没有此句
pap被验方:
[Quidway]interface serial 0                                    ;路由器2
[Quidway-serial0]ppp pap local-user q2 password {simple|cipher} hello
chap被验方:
[Quidway]interface serial 0                                    ;路由器2
[Quidway-serial0]ppp chap user q2                              ;自己路由器名
[Quidway-serial0]local-user q1 password {simple|cipher} hello  ;对方路由器名
帧中继frame-relay    (二分册6-61)
[q1]fr switching
[q1]int s1
[q1-Serial1]ip address 192.168.34.51 255.255.255.0
[q1-Serial1]link-protocol fr                                   ;封装帧中继协议
[q1-Serial1]fr interface-type dce
[q1-Serial1]fr dlci 100
[q1-Serial1]fr inarp
[q1-Serial1]fr map ip 192.168.34.52 dlci 100
[q2]int s1
[q2-Serial1]ip address 192.168.34.52 255.255.255.0
[q2-Serial1]link-protocol fr
[q2-Serial1]fr interface-type dte
[q2-Serial1]fr dlci 100
[q2-Serial1]fr inarp
[q2-Serial1]fr map ip 192.168.34.51 dlci 100
帧中继监测
[q1]display fr lmi-info[]interface type number]
[q1]display fr map
[q1]display fr pvc-info[serial interface-number][dlci dlci-number]
[q1]display fr dlci-switch
[q1]display fr interface
[q1]reset fr inarp-info
[q1]debugging fr all[interface type number]
[q1]debugging fr arp[interface type number]
[q1]debugging fr event[interface type number]
[q1]debugging fr lmi[interface type number]

启动ftp服务:
[Quidway]local-user ftp password {simple|cipher} aaa service-type ftp
[Quidway]ftp server enable

inte***ce M-Ethernet0/0/0是CPU板的管理口
 
 
 
 
阅读(3013) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~