l
白菜一颗
发布于 2025-03-21 / 2 阅读
0
0

H3C 路由器基础开局配置

一、设备初始化

1. 连接路由器

  • Console 串口连接

    • 使用 SecureCRT、PuTTY 或 Xshell 连接串口

    • 串口参数:

      复制编辑

      波特率:9600 数据位:8 停止位:1 校验位:无

  • SSH 远程登录(如果已配置 IP)

    shell

    复制编辑

    ssh 用户名@路由器IP

  • 进入系统视图

    shell

    复制编辑

    system-view

    说明:H3C 设备默认在 > 用户模式,执行 system-view 进入 # 系统模式


二、基础配置

1. 设置设备名称

shell

复制编辑

system-view sysname H3C-Router

解释

  • sysname H3C-Router:设置路由器名称。

2. 配置管理 IP

shell

复制编辑

interface GigabitEthernet 0/0/0 ip address 192.168.1.1 255.255.255.0 undo shutdown quit

解释

  • interface GigabitEthernet 0/0/0:进入 GE0/0/0 端口(根据实际情况修改)。

  • ip address 192.168.1.1 255.255.255.0:配置 IP 地址。

  • undo shutdown:开启接口(H3C 默认接口关闭)。

3. 配置默认路由

shell

复制编辑

ip route-static 0.0.0.0 0.0.0.0 192.168.1.254

解释

  • ip route-static:配置静态路由。

  • 0.0.0.0 0.0.0.0 192.168.1.254:默认流量走 192.168.1.254(网关)。


三、远程管理配置

1. 启用 Telnet

shell

复制编辑

user-interface vty 0 4 set authentication password simple H3C@123 protocol inbound telnet quit

解释

  • user-interface vty 0 4:进入远程管理会话(支持 5 个会话)。

  • set authentication password simple H3C@123:设置 Telnet 密码。

  • protocol inbound telnet:允许 Telnet 连接。

2. 启用 SSH

shell

复制编辑

sysname H3C public-key local create rsa user-interface vty 0 4 authentication-mode scheme protocol inbound ssh quit aaa local-user admin class manage local-user admin password simple H3C@123 local-user admin service-type ssh quit

解释

  • public-key local create rsa:生成 SSH 密钥。

  • authentication-mode scheme:使用 AAA 认证。

  • local-user admin:创建 SSH 用户 admin

  • local-user admin class manage:设置管理权限。


四、WAN 口配置(PPPoE 拨号)

shell

复制编辑

interface GigabitEthernet 0/0/0 pppoe-client enable pppoe-client dial-bundle 1 quit dialer bundle 1 ppp chap user h3c ppp chap password simple H3C@123 dialer number *99# quit

解释

  • pppoe-client enable:启用 PPPoE。

  • ppp chap user h3c:设置认证用户名。

  • ppp chap password simple H3C@123:设置认证密码。


五、NAT 配置(用于上网)

1. 配置 NAT

shell

复制编辑

interface GigabitEthernet 0/0/0 nat outbound 3000 quit acl number 3000 rule 5 permit source 192.168.1.0 0.0.0.255 quit

解释

  • nat outbound 3000:在外网口上启用 NAT 规则。

  • acl number 3000:创建 ACL 3000。

  • rule 5 permit source 192.168.1.0 0.0.0.255:允许 192.168.1.0/24 源地址出网。


六、VLAN & 路由配置

1. 配置 VLAN

shell

复制编辑

vlan 10 name Staff vlan 20 name Guest interface GigabitEthernet 0/0/1 port access vlan 10 quit

解释

  • vlan 10 name Staff:创建 VLAN 10,并命名为 Staff。

  • vlan 20 name Guest:创建 VLAN 20,并命名为 Guest。

  • port access vlan 10:将端口加入 VLAN 10。

2. 配置 VLAN 之间的三层路由

shell

复制编辑

interface Vlan-interface10 ip address 192.168.10.1 255.255.255.0 quit interface Vlan-interface20 ip address 192.168.20.1 255.255.255.0 quit

解释

  • Vlan-interface10 / Vlan-interface20:在路由器上启用 VLAN 10 和 VLAN 20 的三层路由。


七、ACL 访问控制

1. 阻止特定 IP 访问外网

shell

复制编辑

acl number 3001 rule 10 deny ip source 192.168.1.100 0 rule 20 permit ip quit interface GigabitEthernet 0/0/0 packet-filter outbound acl 3001 quit

解释

  • rule 10 deny ip source 192.168.1.100 0:禁止 192.168.1.100 访问外网。

  • rule 20 permit ip:其他流量允许。

  • packet-filter outbound acl 3001:应用 ACL 3001。


八、时间同步(NTP)

shell

复制编辑

ntp-service enable ntp-service unicast-server 192.168.1.100 clock timezone Beijing add 08:00:00

解释

  • ntp-service enable:开启 NTP 服务。

  • ntp-service unicast-server:指定 NTP 服务器。

  • clock timezone:设置北京时间。


九、保存配置

shell

复制编辑

save

解释:保存当前配置,防止重启丢失。


总结

H3C 路由器的基础配置包括:

  1. 设备初始化

  2. 接口 & IP 配置

  3. 远程管理(Telnet / SSH)

  4. WAN 口 & NAT

  5. VLAN 配置

  6. ACL 访问控制

  7. NTP 时间同步

  8. 配置保存


评论