华为网络常用配置

1、基本系统配置 进入系统视图:进入配置模式,类似Cisco的configure terminal system-view 修改设备名称:设置设备主机名,便于识别 sysname Router1 设置时钟和时区:确保

1、基本系统配置

  • 进入系统视图:进入配置模式,类似Cisco的configure terminal

system-view
  • 修改设备名称:设置设备主机名,便于识别

sysname Router1
  • 设置时钟和时区:确保设备时间准确,方便日志和调试。

clock timezone UTC add 08:00:00  # 设置UTC+8时区
clock datetime 15:45:10 2025-07-13  # 设置当前时间
  • 配置登录提示信息:

header login information "Welcome to Router1!"
header shell information "Be Careful!"
  • 查看接口状态:检查接口的IP和运行状态。

display ip interface brief
display ip interface GigabitEthernet0/0/0

2、接口配置

  • 配置接口IP地址:为接口分配IP地址并激活

interface GigabitEthernet0/0/0
 ip address 192.168.1.1 255.255.255.0
 undo shutdown

3、远程访问配置

  • 启用Telnet:配置远程访问,设置最大会话数和权限。

user-interface vty 0 14
 authentication-mode password
 set authentication password cipher YourPassword
 user privilege level 15
 idle-timeout 10 0  # 设置超时时间为10分钟
 screen-length 0  # 显示所有输出
  • 启用SSH:更安全的远程访问方式,需先生成密钥。

rsa local-key-pair create
ssh user admin authentication-type password
user-interface vty 0 14
 authentication-mode aaa
 protocol inbound ssh

4、Vlan配置(交换机)

  • 创建VLAN并分配接口:

system-view
vlan 10
 description SALES
interface GigabitEthernet0/0/13
 port link-type access
 port default vlan 10
  • 配置Trunk端口:允许多个VLAN流量通过。

interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 10 20

5、路由配置

  • 静态路由:配置简单的静态路由。

ip route-static 0.0.0.0 0.0.0.0 192.168.1.254
  • 动态路由(以OSPF为例)

ospf 1
 area 0
  network 192.168.1.0 0.0.0.255

6、访问控制列表(ACL)

  • 配置基本ACL:限制特定IP访问。

acl number 2000
 rule 5 permit source 192.168.1.0 0.0.0.255
 rule 10 deny source 192.168.2.0 0.0.0.255
interface GigabitEthernet0/0/0
 traffic-filter inbound acl 2000

7、常用检查命令

  • 查看当前配置

display current-configuration
display current-configuration | include user
  • 查看接口配置

display interface brief
display interface GigabitEthernet0/0/0
  • 查看路由表

display ip routing-table
  • 诊断信息:收集设备状态信息,便于故障排查。\

display diagnostic-information



LICENSED UNDER CC BY-NC-SA 4.0
评论
访问统计
总访问量: 👀| 访客数: 🚶‍♂️