b、选择串口 一般选用COM口,常选用COM1
c、设置终端具体参数(此处点击“默认值”即可)
d、打开路由器的电源,路由器进行启动
e、当路由器启动完毕后,回车几下,当出现<H3C>时即可配置路由器。
1.2路由器基本调试命令1.2.1使用本地用户进行telnet登录的认证<H3C>system-view 进入系统视图[H3C]telnetserver enable 打开路由器的telnet功能[H3C]configure-usercount 5 设置允许同时配置路由器的用户数[H3C]local-usertelnet 添加本地用户(此处为telnet用户登陆时使用的用户名)[H3C-luser-telnet]passwordsimple h3c 设置telnet用户登陆时所使用的密码[H3C-luser-telnet]service-typetelnet 设置本地用户的服务类型(此处为telnet)[H3C-luser-telnet]level3 设置本地用户的服务级别[H3C-luser-telnet]quit 退出本地用户视图[H3C][H3C]user-interfacevty 0 4 进入用户视图[H3C-ui-vty0-4]authentication-modescheme 选择“scheme”认证方式备注:红色部分可以由客户自行设置,此处仅做举例时使用!1.2.2路由器接口的配置为接口配置ip地址<H3C>system-view 进入系统视图[H3C]interface serial 3/0 进入某个端口[H3C-Serial3/0]ip address 200.1.1.1 255.255.255.0 为该端口设置ip地址[H3C-Serial3/0]undo shutdown 对该端口进行复位[H3C-Serial3/0]quit 退回到系统视图[H3C]备注:红色部分可以由客户自行设置,此处仅做举例时使用!1.2.3静态路由或默认路由的配置<H3C>system-view 进入系统视图[H3C]iproute-static 192.168.1.0 255.255.255.0 192.168.0.1 添加一条静态路由[H3C]iproute-static 0.0.0.0 0.0.0.0 192.168.0.1 添加一条默认路由备注:红色部分可以由客户自行设置,此处仅做举例时使用!1.2.3配置文件的管理displaycurrent-configuration 显示当前的配置文件<H3C>save 保存配置文件displayinterface GigabitEthernet 0/0 查看某端口的状态备注:display命令可以在任何视图下进行红色部分可以由客户自行设置,此处仅做举例时使用!交换机的配置文件管理与路由器相同,故交换机的配置幻灯片中不再做举例。1.3 交换机的基本调试命令1.3.1 创建VLAN并将端口加入到vlan中<H3C>system-view 进入系统视图[H3C]vlan10 创建vlan 10[H3C-vlan100]port ethernet 0/1 将某个端口加入到vlan中[H3C-vlan100]quit 退出到系统[H3C]备注:红色部分可以由客户自行设置,此处仅做举例时使用!1.3.2创建vlan虚接口并为接口配置ip地址<H3C>system-view 进入系统视图[H3C]interfacevlan-interface 1 创建vlan虚接口[H3C-Vlan-interface100]ip address 192.168.1.1 255.255.255.0 配置ip地址备注:红色部分可以由客户自行设置,此处仅做举例时使用!1.3.3 配置默认路由[H3C]interface vlan-interface 1[H3C-Vlan-interface10]ip address 192.168.1.1 255.255.255.0[H3C-Vlan-interface10]quit[H3C]ip route-static 0.0.0.0 0.0.0.0 192.168.1.2 配置缺省路由备注:红色部分可以由客户自行设置,此处仅做举例时使用!1.3.4设置端口类型<H3C>system-view 进入系统视图[H3C]interfaceethernet 0/1[H3C]portlink-type trunk 将端口类型设置为trunk[H3C]porttrunk permit vlan all trunk端口允许所有vlan通过[H3C]saveTrunk可以收发多个vlan的报文,用于交换机与交换机之间的互连1.3.5交换机设置telnet登录的认证配置命令<H3C>system-view 进入系统视图[H3C]local-usertelnet 添加本地用户(此处为telnet用户登陆时使用的用户名)[H3C-luser-telnet]passwordsimple h3c 设置telnet用户登陆时所使用的密码[H3C-luser-telnet]service-typetelnet 设置本地用户的服务类型(此处为telnet)[H3C-luser-telnet]level3 设置本地用户的服务级别[H3C-luser-telnet]quit 退出本地用户视图[H3C][H3C]user-interfacevty 0 4 进入用户视图[H3C-ui-vty0-4]authentication-modescheme 选择“scheme”认证方式典型案例:案例1:如下图,LAB (router)通过配置路由器适当的两台终端电脑能够相互通信,请写出相关配置语句。这里使用的H3C交换机是H126A,仅仅只做了最基本的配置以满足使用。
配置中可以通过display current-configura命令来显示当前使用的配置内容。
# 配置VLAN 1
<Sysname>system-view
System View: return to User View with Ctrl+Z.
[Sysname]vlan 1
[Sysname-vlan1] quit
[Sysname]management-vlan 1
[Sysname]interface Vlan-interface 1
[Sysname-Vlan-interface1] ip address 10.0.1.201 255.255.255.0
# 显示VLAN 接口1 的相关信息。
<Sysname> display ip interface Vlan-interface 1
# 创建VLAN(H3C不支持cisco的VTP,所以只能添加静态VLAN)
<H3C_TEST>system-view
System View: return to User View with Ctrl+Z.
[H3C_TEST]vlan 99
[H3C_TEST-vlan99]name seicoffice
[H3C_TEST-vlan99]quit
# 把交换机的端端口划分到相应的Vlan中
[H3C_TEST]interface ethernet1/0/2 //进入端口模式
[H3C_TEST-Ethernet1/0/2]port link-type access //设置端口的类型为access
[H3C_TEST-Ethernet1/0/2]port access vlan 99 //把当前端口划到vlan 99
[H3C_TEST]vlan 99
[H3C_TEST-vlan99]port ethernet1/0/1 to ethernet1/0/24 //把以及网端口1/0/1到1/0/24划到vlan99
[H3C_TEST-vlan99]quit
[H3C_TEST-GigabitEthernet1/2/1]port trunk permit vlan 1 99 // {ID|All} 设置trunk端口允许通过的VLAN
-------------------------------------------------------------------------------------------------------
# 配置本地用户
<Sysname>system-view
System View: return to User View with Ctrl+Z.
[Sysname]local-user h3c
New local user added.
[Sysname-luser-h3c]service-type telnet level 3
[Sysname-luser-h3c]password simple h3c
# 配置欢迎信息
[H3C_TEST]header login %Welcome to login h3c!%
# 配置用户认证方式telnet(vty 0-4)
[H3C_TEST]user-interface vty 0 4
[H3C_TEST-ui-vty0-4]authentication-mode scheme
[H3C_TEST-ui-vty0-4]protocol inbound telnet
[H3C_TEST-ui-vty0-4]super authentication-mode super-password
[H3C_TEST-ui-vty0-4]quit
[H3C_TEST]super password level 3 simple h3c //用户登陆后提升权限的密码
# 配置Radius策略
[H3C_TEST]radius scheme radius1
New Radius scheme
[H3C_TEST-radius-radius1]primary authentication 10.0.1.253 1645
[H3C_TEST-radius-radius1]primary accounting 10.0.1.253 1646
[H3C_TEST-radius-radius1]secondary authentication 127.0.0.1 1645
[H3C_TEST-radius-radius1]secondary accounting 127.0.0.1 1646
[H3C_TEST-radius-radius1]timer 5
[H3C_TEST-radius-radius1]key authentication h3c
[H3C_TEST-radius-radius1]key accounting h3c
[H3C_TEST-radius-radius1]server-type extended
[H3C_TEST-radius-radius1]user-name-format without-domain
# 配置域
[H3C_TEST]domain h3c
[H3C_TEST-isp-h3c]authentication radius-scheme radius1 local
[H3C_TEST-isp-h3c]scheme radius-scheme radius1 local
[H3C_TEST]domain default enable h3c
# 配置在远程认证失败时,本地认证的key
[H3C_TEST]local-server nas-ip 127.0.0.1 key h3c
级别说明
Level 名称
命令
0
参观
ping、tracert、telnet
1
监控
display、debugging
2
配置
所有配置命令(管理级的命令除外)
3
管理
文件系统命令、FTP命令、TFTP命令、XMODEM命令
telnet仅用密码登录,管理员权限
[Router]user-interface vty 0 4[Router-ui-vty0-4]user privilege level 3[Router-ui-vty0-4]set authentication password simple abc
telnet仅用密码登录,非管理员权限
[Router]super password level 3 simple super
[Router]user-interface vty 0 4[Router-ui-vty0-4]user privilege level 1[Router-ui-vty0-4]set authentication password simple abc
telnet使用路由器上配置的用户名密码登录,管理员权限
[Router]local-user admin password simple admin[Router]local-user admin service-type telnet[Router]local-user admin level 3
[Router]user-interface vty 0 4[Router-ui-vty0-4]authentication-mode local
telnet使用路由器上配置的用户名密码登录,非管理员权限
[Router]super password level 3 simple super
[Router]local-user manage password simple manage[Router]local-user manage service-type telnet[Router]local-user manage level 2
[Router]user-interface vty 0 4[Router-ui-vty0-4]authentication-mode local
对console口设置密码,登录后使用管理员权限
[Router]user-interface con 0[Router-ui-console0]user privilege level 3[Router-ui-console0]set authentication password simple abc
对console口设置密码,登录后使用非管理员权限
[Router]super password level 3 simple super
[Router]user-interface con 0[Router-ui-console0]user privilege level 1[Router-ui-console0]set authentication password simple abc
对console口设置用户名和密码,登录后使用管理员权限
[Router]local-user admin password simple admin[Router]local-user admin service-type terminal[Router]local-user admin level 3
[Router]user-interface con 0[Router-ui-console0]authentication-mode local
对console口设置用户名和密码,登录后使用非管理员权限
[Router]super password level 3 simple super
[Router]local-user manage password simple manage[Router]local-user manage service-type terminal[Router]local-user manage level 2
[Router]user-interface con 0[Router-ui-console0]authentication-mode local
simple 是明文显示,cipher 是加密显示
路由器不设置telnet登录配置时,用户无法通过telnet登录到路由器上
[Router-ui-vty0-4]acl 2000 inbound可以通过acl的规则只允许符合条件的用户远程登录路由器
路由器命令
~~~~~~~~~~
[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><mask>
[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 <ip><mask>{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 <area_id> 配置OSPF区域
标准访问列表命令格式如下:
acl <acl-number> [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 {<ip wild>|any}destination <ip wild>|any}
[operate]
配置ICMP协议的扩展访问列表:
rule {normal|special}{permit|deny}icmp source {<ip wild>|any]destination {<ip wild>|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
H3C路由器配置方案注解#
version 5.20, Release 1719 //版本信息,自动显示
#
sysname H3C //给设备命名为H3C
#
super password level 3 cipher 7WC1<3E`[Y)./a!1$H@GYA!! //设置super密码
#
domain default enable system
#
telnet server enable
#
vlan 1
#
domain system
access-limit disable
state active
idle-cut disable
self-service-url disable
#
user-group system //从此以上未标注的为默认配置,不用去理解
#
local-user admin //添加用户名为admin的用户
password cipher .]@USE=B,53Q=^Q`MAF4<1!! //设置密码(密文)
authorization-attribute level 3 //设置用户权限为3级(最高)
service-type telnet //设置用户的模式为telnet用户
local-user share //从此往下四行同上
password cipher [HM$GH8P1GSQ=^Q`MAF4<1!!
authorization-attribute level 1
service-type telnet
#
controller E1 0/0 //进入E1物理端口(两兆口)
using e1 //设置端口模式为E1(设置后下面会出现interface Serial0/0:0)
#
interface Aux0 //从此以下三行为主控板aux口默认配置
async mode flow
link-protocol ppp
#
interface Ethernet0/0 //进入E0/0接口(以太网口)
port link-mode route //配置该接口为路由模式
#
interface Serial0/0:0 //进入Serial0/0:0端口(前面用using e1命令后产生,对应E1端口)
link-protocol ppp //配置链路协议为ppp(默认)
ip address 74.1.63.170 255.255.255.252 //配置该接口IP地址
#
interface NULL0
#
interface Vlan-interface1 //lan口vlan地址(lan口地址)
ip address 192.168.1.1 255.255.255.0
#
interface Ethernet0/1
port link-mode bridge
#
interface Ethernet0/2
port link-mode bridge
#
interface Ethernet0/3
port link-mode bridge
#
interface Ethernet0/4
port link-mode bridge
#
ip route-static 74.1.8.0 255.255.255.0 74.1.63.169 //配置静态路由
#
user-interface aux 0
user-interface vty 0 4 //进入vty接口(远程登陆接口)0-4通道
authentication-mode scheme //配置登陆验证类型为scheme(用户验证型)
user privilege level 1 //设置当验证模式不是scheme类型时的登录级别(废配置)
#
return
H3C路由器基本配置命令[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><mask>
[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 <ip><mask>{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 <area_id> 配置OSPF区域
标准访问列表命令格式如下:
acl <acl-number> [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 {<ip wild>|any}destination <ip wild>|any}
[operate]
配置ICMP协议的扩展访问列表:
rule {normal|special}{permit|deny}icmp source {<ip wild>|any]destination {<ip wild>|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
本文由梁桂钊于2022-02-14发表在梁桂钊的博客,如有疑问,请联系我们。
本文链接:https://720ui.com/3981.html