配置命令备忘录

73 阅读3分钟

前言

在日常的网络管理和维护中,掌握华三(H3C)设备的配置命令是至关重要的。这些命令不仅可以帮助我们快速解决设备配置问题,还能提升网络运维的效率。鉴于此,准备了这篇文章,旨在分享一些常用且好用的华三配置命令。希望对初学者提供有价值的信息。接下来,让我们一起深入了解这些实用的命令吧

查看三层接口与IP相关的配置和统计信息

display ip interfaceinterface-type interface-number ]

# 示例
[PE1]display ip interface GigabitEthernet 0/0
GigabitEthernet0/0 current state: UP                   // 接口当前的物理状态
Line protocol current state: UP                        // 接口数据链路层协议状态
Internet address is 12.1.1.1/24 Primary                // 接口的IP地址
Broadcast address: 12.1.1.255                          // 接口所在网段的广播地址
The Maximum Transmit Unit: 1500 bytes                  // 接口的最大传输单元,单位为字节
input packets : 0, bytes : 0, multicasts : 0
output packets : 0, bytes : 0, multicasts : 0
TTL invalid packet number:         0
ICMP packet input number:          0
  Echo reply:                      0
  Unreachable:                     0
  Source quench:                   0
  Routing redirect:                0
  Echo request:                    0
  Router advert:                   0
  Router solicit:                  0
  Time exceed:                     0
  IP header bad:                   0
  Timestamp request:               0
  Timestamp reply:                 0
  Information request:             0
  Information reply:               0
  Netmask request:                 0
  Netmask reply:                   0
  Unknown type:                    0

[PE1]

显示三层接口与IP相关的简要信息

display ip interface brief

# 示例
[PE1]display ip interface brief
*down: administratively down
(s): spoofing  (l): loopback
Interface           Physical Protocol IP address/Mask    VPN instance Description
GE0/0               up       up       12.1.1.1/24        VPN1         --
GE0/1               up       up       23.1.1.2/24        --           --
GE0/2               down     down     --                 --           --
GE5/0               down     down     --                 --           --
GE5/1               down     down     --                 --           --
GE6/0               down     down     --                 --           --
GE6/1               down     down     --                 --           --
Loop0               up       up(s)    1.1.1.1/32         --           --
Ser1/0              down     down     --                 --           --
Ser2/0              down     down     --                 --           --
Ser3/0              down     down     --                 --           --
Ser4/0              down     down     --                 --           --
[PE1]

查看设备arp表项

# 显示所有的ARP表项
display arp all

# 示例
[PE1]display arp all
  Type: S-Static   D-Dynamic   O-Openflow   R-Rule   M-Multiport  I-Invalid
IP address      MAC address    VLAN/VSI name Interface/Link ID        Aging Type
12.1.1.2        30a0-34c1-0105 --            GE0/0                    12    D
23.1.1.1        30a0-3b23-0206 --            GE0/1                    12    D
[PE1]

# 根据正则表达式匹配
[PE1]display arp | include 30a0-34c1-0105
12.1.1.2        30a0-34c1-0105 --            GE0/0                    8     D
[PE1]

查看VPN实例路由表

# 查看VPN路由
display ip routing-table vpn-instance [VPN实例名称]


# 示例
[PE1]display ip routing-table vpn-instance VPN1

Destinations : 13       Routes : 13

Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
10.1.1.0/24        Static  60  0           12.1.1.2        GE0/0
12.1.1.0/24        Direct  0   0           12.1.1.1        GE0/0
12.1.1.1/32        Direct  0   0           127.0.0.1       InLoop0
12.1.1.255/32      Direct  0   0           12.1.1.1        GE0/0
56.1.1.0/24        BGP     255 0           4.4.4.4         GE0/1
60.1.1.0/24        BGP     255 0           4.4.4.4         GE0/1
127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0
255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
[PE1]

接口光电口转换命令

[RTA-GigabitEthernet0/1]display this
#
interface GigabitEthernet0/1
 port link-mode route
 combo enable copper    // 双绞线端口|电口
 ip address 192.168.1.1 255.255.255.0
#
return
[RTA-GigabitEthernet0/1]


[RTB-GigabitEthernet0/1]display this
#
interface GigabitEthernet0/1
 port link-mode route
 combo enable fiber   // 光纤端口|光口
 ip address 192.168.1.2 255.255.255.0
#
return
[RTB-GigabitEthernet0/1]

查看设备光口收发情况

dis transceiver diagnosis interface GigabitEthernet 1/0/1

图片.png

查看设备光口告警情况

dis transceiver alarm interface GigabitEthernet 1/0/1

查看设备光口厂家

display transceiver manuinfo interface GigabitEthernet 1/0/1

查看光模块信息

dis transceiver interface GigabitEthernet 1/0/1

设备开启路径回显命令

ip ttl-expires enable
ip unreachables enable