先来一张思科和华为命令的对照表:
史上最全华为路由器交换机配置命令大合集,熟练掌握下面的华为路由器交换机配置知识点,你只需花几分钟的时间就能明白华为路由器交换机配置。交换机的配置命令等等。
PCAlogin:root;使用root用户 password:linux;口令是linux #shutdown-hnow;关机 #init0;关机 #logout;用户注销 #login;用户登录 #ifconfig;显示IP地址 #ifconfigeth0netmask;设置IP地址 #ifconfigeht0netmaskdown;禁用IP地址 #routeadd0.0.0.0gw;设置网关 #routedel0.0.0.0gw;删除网关 #routeadddefaultgw;设置网关 #routedeldefaultgw;删除网关 #route;显示网关 #ping;发ECHO包 #telnet;远程登录
[Quidway]discur;显示当前配置 [Quidway]displaycurrent-configuration;显示当前配置 [Quidway]displayinterfaces;显示接口信息 [Quidway]displayvlanall;显示路由信息 [Quidway]displayversion;显示版本信息 [Quidway]superpassword;修改特权用户密码 [Quidway]sysname;交换机命名 [Quidway]interfaceethernet0/1;进入接口视图 [Quidway]interfacevlanx;进入接口视图 [Quidway-Vlan-interfacex]ipaddress10.65.1.1255.255.0.0;配置VLAN的IP地址 [Quidway]iproute-static0.0.0.00.0.0.010.65.1.2;静态路由=网关 [Quidway]rip;三层交换支持 [Quidway]local-userftp [Quidway]user-interfacevty04;进入虚拟终端 [S3026-ui-vty0-4]authentication-modepassword;设置口令模式 [S3026-ui-vty0-4]setauthentication-modepasswordsimple222;设置口令 [S3026-ui-vty0-4]userprivilegelevel3;用户级别 [Quidway]interfaceethernet0/1;进入端口模式 [Quidway]inte0/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]portlink-type{trunk|access|hybrid};设置端口工作模式 [Quidway-Ethernet0/1]portaccessvlan3;当前端口加入到VLAN [Quidway-Ethernet0/2]porttrunkpermitvlan{ID|All};设trunk允许的VLAN [Quidway-Ethernet0/3]porttrunkpvidvlan3;设置trunk端口的PVID [Quidway-Ethernet0/1]undoshutdown;激活端口 [Quidway-Ethernet0/1]shutdown;关闭端口 [Quidway-Ethernet0/1]quit;返回 [Quidway]vlan3;创建VLAN [Quidway-vlan3]portethernet0/1;在VLAN中增加端口 [Quidway-vlan3]porte0/1;简写方式 [Quidway-vlan3]portethernet0/1toethernet0/4;在VLAN中增加端口 [Quidway-vlan3]porte0/1toe0/4;简写方式 [Quidway]monitor-port;指定镜像端口 [Quidway]portmirror;指定被镜像端口 [Quidway]portmirrorint_listobserving-portint_typeint_num;指定镜像和被镜像 [Quidway]descriptionstring;指定VLAN描述字符 [Quidway]description;删除VLAN描述字符 [Quidway]displayvlan[vlan_id];查看VLAN设置 [Quidway]stp{enable|disable};设置生成树,默认关闭 [Quidway]stppriority4096;设置交换机的优先级 [Quidway]stproot{primary|secondary};设置为根或根的备份 [Quidway-Ethernet0/1]stpcost200;设置交换机端口的花费 [Quidway]link-aggregatione0/1toe0/4ingress|both;端口的聚合 [Quidway]undolink-aggregatione0/1|all;始端口为通道号 [SwitchA-vlanx]isolate-user-vlanenable;设置主vlan [SwitchA]isolate-user-vlansecondary;设置主vlan包括的子vlan [Quidway-Ethernet0/2]porthybridpvidvlan;设置vlan的pvid [Quidway-Ethernet0/2]porthybridpvid;删除vlan的pvid [Quidway-Ethernet0/2]porthybridvlanvlan_id_listuntagged;设置无标识的vlan 如果包的vlanid与PVId一致,则去掉vlan信息.默认PVID=1。 所以设置PVID为所属vlanid,设置可以互通的vlan为untagged.
[Quidway]displayversion;显示版本信息 [Quidway]displaycurrent-configuration;显示当前配置 [Quidway]displayinterfaces;显示接口信息 [Quidway]displayiproute;显示路由信息 [Quidway]sysnameaabbcc;更改主机名 [Quidway]superpasswrod123456;设置口令 [Quidway]interfaceserial0;进入接口 [Quidway-serial0]ipaddress;配置端口IP地址 [Quidway-serial0]undoshutdown;激活端口 [Quidway]link-protocolhdlc;绑定hdlc协议 [Quidway]user-interfacevty04 [Quidway-ui-vty0-4]authentication-modepassword [Quidway-ui-vty0-4]setauthentication-modepasswordsimple222 [Quidway-ui-vty0-4]userprivilegelevel3 [Quidway-ui-vty0-4]quit [Quidway]debugginghdlcallserial0;显示所有信息 [Quidway]debugginghdlceventserial0;调试事件信息 [Quidway]debugginghdlcpacketserial0;显示包的信息
[Quidway]iproute-static{interfacenumber|nexthop}[value][reject|blackhole] 例如:[Quidway]iproute-static129.1.0.01610.0.0.2 [Quidway]iproute-static129.1.0.0255.255.0.010.0.0.2 [Quidway]iproute-static129.1.0.016Serial2 [Quidway]iproute-static0.0.0.00.0.0.010.0.0.2
[Quidway]rip;设置动态路由 [Quidway]ripwork;设置工作允许 [Quidway]ripinput;设置入口允许 [Quidway]ripoutput;设置出口允许 [Quidway-rip]network1.0.0.0;设置交换路由网络 [Quidway-rip]networkall;设置与所有网络交换 [Quidway-rip]peerip-address; [Quidway-rip]summary;路由聚合 [Quidway]ripversion1;设置工作在版本1 [Quidway]ripversion2multicast;设版本2,多播方式 [Quidway-Ethernet0]ripsplit-horizon;水平分隔 [Quidway]routeridA.B.C.D;配置路由器的ID [Quidway]ospfenable;启动OSPF协议 [Quidway-ospf]import-routedirect;引入直联路由 [Quidway-Serial0]ospfenablearea;配置OSPF区域
acl[match-orderconfig|auto];默认前者顺序匹配。 rule[normal|special]{permit|deny}[sourcesource-addrsource-wildcard|any] 例:[Quidway]acl10 [Quidway-acl-10]rulenormalpermitsource10.0.0.00.0.0.255 [Quidway-acl-10]rulenormaldenysourceany
配置TCP/UDP协议的扩展访问列表: rule{normal|special}{permit|deny}{tcp|udp}source{|any}destination|any} [operate] 配置ICMP协议的扩展访问列表: rule{normal|special}{permit|deny}icmpsource{|any]destination{|any] [icmp-code][logging]
equalportnumber;等于 greater-thanportnumber;大于 less-thanportnumber;小于 not-equalportnumber;不等 rangeportnumber1portnumber2;区间
[Quidway]acl101 [Quidway-acl-101]ruledenysouceanydestinationany [Quidway-acl-101]rulepermiticmpsourceanydestinationanyicmp-typeecho [Quidway-acl-101]rulepermiticmpsourceanydestinationanyicmp-typeecho-reply [Quidway]acl102 [Quidway-acl-102]rulepermitipsource10.0.0.10.0.0.0destination202.0.0.10.0.0.0 [Quidway-acl-102]ruledenyipsourceanydestinationany [Quidway]acl103 [Quidway-acl-103]rulepermittcpsourceanydestination10.0.0.10.0.0.0destination-portequalftp [Quidway-acl-103]rulepermittcpsourceanydestination10.0.0.20.0.0.0destination-portequalwww [Quidway]firewallenable [Quidway]firewalldefaultpermit|deny [Quidway]inte0 [Quidway-Ethernet0]firewallpacket-filter101inbound|outbound
[Quidway]firewallenable [Quidway]firewalldefaultpermit [Quidway]acl101;内部指定主机可以进入e0 [Quidway-acl-101]ruledenyipsourceanydestinationany [Quidway-acl-101]rulepermitipsource129.38.1.10destinationany [Quidway-acl-101]rulepermitipsource129.38.1.20destinationany [Quidway-acl-101]rulepermitipsource129.38.1.30destinationany [Quidway-acl-101]rulepermitipsource129.38.1.40destinationany [Quidway-acl-101]quit [Quidway]inte0 [Quidway-Ethernet0]firewallpacket-filter101inbound [Quidway]acl102;外部特定主机和大于1024端口的数据包允许进入S0 [Quidway-acl-102]ruledenyipsourceanydestinationany [Quidway-acl-102]rulepermittcpsource202.39.2.30destination202.38.160.10 [Quidway-acl-102]rulepermittcpsourceanydestination202.38.160.10destination-portgreat-than 1024 [Quidway-acl-102]quit [Quidway]ints0 [Quidway-Serial0]firewallpacket-filter102inbound;设202.38.160.1是路由器出口IP。 [Quidway-Serial0]natoutbound101interface;是Easyip,将acl101允许的IP从本接口出时变换源地址。
natserverglobal[port]insideport[protocol];global_port不写时使用inside_port [Quidway-Serial0]natserverglobal202.38.160.1inside129.38.1.1ftptcp [Quidway-Serial0]natserverglobal202.38.160.1inside129.38.1.2telnettcp [Quidway-Serial0]natserverglobal202.38.160.1inside129.38.1.3wwwtcp 设有公网IP:202.38.160.101~202.38.160.103可以使用。;对外访问(原例题) [Quidway]nataddress-group202.38.160.101202.38.160.103pool1;建立地址池 [Quidway]acl1 [Quidway-acl-1]rulepermitsource10.110.10.00.0.0.255;指定允许的内部网络 [Quidway-acl-1]ruledenysourceany [Quidway-acl-1]intserial0 [Quidway-Serial0]natoutbound1address-grouppool1;在s0口从地址池取出IP对外访问 [Quidway-Serial0]natserverglobal202.38.160.101inside10.110.10.1ftptcp [Quidway-Serial0]natserverglobal202.38.160.102inside10.110.10.2wwwtcp [Quidway-Serial0]natserverglobal202.38.160.1028080inside10.110.10.3wwwtcp [Quidway-Serial0]natserverglobal202.38.160.103inside10.110.10.4smtpudp 华为路由器交换机配置命令:PPP设置:[Quidway-s0]link-protocolppp;默认的协议
主验方:pap|chap [Quidway]local-userq2password{simple|cipher}hello;路由器1 [Quidway]interfaceserial0 [Quidway-serial0]pppauthentication-mode{pap|chap} [Quidway-serial0]pppchapuserq1;pap时,没有此句
[Quidway]interfaceserial0;路由器2 [Quidway-serial0]ppppaplocal-userq2password{simple|cipher}hello
[Quidway]interfaceserial0;路由器2 [Quidway-serial0]pppchapuserq2;自己路由器名 [Quidway-serial0]local-userq1password{simple|cipher}hello;对方路由器名 帧中继frame-relay(二分册6-61) [q1]frswitching [q1]ints1 [q1-Serial1]ipaddress192.168.34.51255.255.255.0 [q1-Serial1]link-protocolfr;封装帧中继协议 [q1-Serial1]frinterface-typedce [q1-Serial1]frdlci100 [q1-Serial1]frinarp [q1-Serial1]frmapip192.168.34.52dlci100 [q2]ints1 [q2-Serial1]ipaddress192.168.34.52255.255.255.0 [q2-Serial1]link-protocolfr [q2-Serial1]frinterface-typedte [q2-Serial1]frdlci100 [q2-Serial1]frinarp [q2-Serial1]frmapip192.168.34.51dlci100
[q1]displayfrlmi-info[]interfacetypenumber] [q1]displayfrmap [q1]displayfrpvc-info[serialinterface-number][dlcidlci-number] [q1]displayfrdlci-switch [q1]displayfrinterface [q1]resetfrinarp-info [q1]debuggingfrall[interfacetypenumber] [q1]debuggingfrarp[interfacetypenumber] [q1]debuggingfrevent[interfacetypenumber] [q1]debuggingfrlmi[interfacetypenumber]
[Quidway]local-userftppassword{simple|cipher}aaaservice-typeftp [Quidway]ftpserverenable
转载至https://cloud.tencent.com/developer/article/1391558