Follow me on GitHub









1. 核心交换机查询

[~C05_35U_6881_MGBU01]dis ip int br
*down: administratively down
!down: FIB overload down
^down: standby
(l): loopback
(s): spoofing
(d): Dampening Suppressed
The number of interface that is UP in Physical is 20
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 20
The number of interface that is DOWN in Protocol is 1
Interface                   IP Address/Mask    Physical Protocol VPN           
MEth0/0/0                   unassigned         down     down     --            
NULL0                       unassigned         up       up(s)    --            
Vlanif3              up       up       --            
Vlanif4               up       up       --            
Vlanif5              up       up       --            
Vlanif8              up       up       --            
Vlanif9              up       up       --            
Vlanif10              up       up       --            
Vlanif12             up       up       --            
Vlanif13              up       up       --            
Vlanif14             up       up       --            
Vlanif15              up       up       --    
[~C05_35U_6881_MGBU01]dis ip routing-table 
Proto: Protocol        Pre: Preference
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
Routing Table : _public_
         Destinations : 66       Routes : 70        

Destination/Mask    Proto   Pre  Cost        Flags NextHop         Interface   Static  60   0             RD     Vlanif44  Static  60   0             RD   Vlanif14
                    Static  60   0             RD   Vlanif14  Static  60   0             RD   Vlanif14
                    Static  60   0             RD   Vlanif14  Static  60   0             RD   Vlanif14
                    Static  60   0             RD   Vlanif14  Direct  0    0             D   Vlanif3  Direct  0    0             D       Vlanif3  Direct  0    0             D       Vlanif3  Direct  0    0             D   Vlanif8  Direct  0    0             D       Vlanif8  Direct  0    0             D       Vlanif8  Direct  0    0             D    Vlanif4  Direct  0    0             D       Vlanif4

可见,该主机所属网段是 VLAN 3 的接口。由于该接口的特殊性,需要做进一步的检查。

[~C05_35U_6881_MGBU01]display vlan 3
U: Up;         D: Down;         TG: Tagged;         UT: Untagged;
MP: Vlan-mapping;               ST: Vlan-stacking;
#: ProtocolTransparent-vlan;    *: Management-vlan;
MAC-LRN: MAC-address learning;  STAT: Statistic;
BC: Broadcast; MC: Multicast;   UC: Unknown-unicast;
FWD: Forward;  DSD: Discard;

VID          Ports                                                          
   3         TG:Eth-Trunk3(U)   Eth-Trunk4(U)   10GE1/0/38(D)                   
VID  Type     Status  Property  MAC-LRN STAT    BC  MC  UC  Description
   3 common   enable  default   enable  disable FWD FWD FWD VLAN 0003  

可见,接口为 TG:Eth-Trunk3(U) Eth-Trunk4(U) 10GE1/0/38(D)

<C05_35U_6881_MGBU01>dis arp
ARP Entry Types: D - Dynamic, S - Static, I - Interface, O - OpenFlow, RD - Redirect
EXP: Expire-time VLAN:VLAN or Bridge Domain

----------------------------------------------------------------------------------------   1418-7763-3173   11   D/3             Eth-Trunk4       

除去 10GE1/0/38(D) 本身只是单接口,另外 Trunk 都有汇聚可能。

[~C05_35U_6881_MGBU01]dis interface Eth-Trunk 4
Eth-Trunk3 current state : UP (ifindex: 141)
Line protocol current state : UP 
Last line protocol up time : 2020-03-27 10:31:51
Switch Port, PVID :    1, TPID : 8100(Hex), Hash Arithmetic : profile default, Maximal BW : 20Gbps, Current BW : 20Gbps, The Maximum Frame Length is 9216
Internet protocol processing : disabled
IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is acb3-b535-f411
Current system time: 2021-02-24 14:43:32
Physical is ETH_TRUNK
    Last 300 seconds input rate 961 bits/sec, 0 packets/sec
    Last 300 seconds output rate 957 bits/sec, 0 packets/sec
    Input: 59177804 packets,28146780073 bytes
           39604781 unicast,2299 broadcast,19570724 multicast
           0 errors,0 drops
    Output:40692923 packets,8376191683 bytes
           27765438 unicast,8061080 broadcast,4866405 multicast
           0 errors,0 drops
    Last 300 seconds input utility rate:  0.01%
    Last 300 seconds output utility rate: 0.01%
PortName                      Status              Weight   
10GE1/0/33                    UP                  1        
10GE2/0/33                    UP                  1        
The Number of Ports in Trunk : 2
The Number of Up Ports in Trunk : 2

结论:本地 10GE1/0/33 与下层设备互联

2. 下层设备


[~C05_35U_6881_MGBU01]dis lldp neighbor brief  
Local Interface         Exptime(s) Neighbor Interface      Neighbor Device     
100GE1/0/1                    109  100GE2/0/1              C05_35U_6881_MGBU01
100GE1/0/2                    109  100GE2/0/2              C05_35U_6881_MGBU01
100GE2/0/1                     95  100GE1/0/1              C05_35U_6881_MGBU01
100GE2/0/2                     95  100GE1/0/2              C05_35U_6881_MGBU01
10GE1/0/32                    112  10GE1/0/2               C07_33U_5855_BMC01
10GE1/0/33                    101  10GE1/0/2               c07_35U_5855_BMC02
10GE1/0/47                    112  Ten-GigabitEthernet2/0/40H3C
10GE2/0/32                    112  10GE1/0/1               C07_33U_5855_BMC01
10GE2/0/33                    101  10GE1/0/1               c07_35U_5855_BMC02
10GE2/0/47                     91  Ten-GigabitEthernet1/0/40H3C

我们看到 10GE1/0/1 与我互联,再查询单个接口的 IP 地址

[~C05_35U_6881_MGBU01]dis lldp neighbor interface 10GE2/0/33 
10GE2/0/32 has 1 neighbor(s):

Neighbor index                     :1
Chassis type                       :MAC Address
Chassis ID                         :acb3-b53e-b3b1
Port ID subtype                    :Interface Name
Port ID                            :10GE1/0/1
Port description                   :--
System name                        :C07_33U_5855_BMC01            
System description                 :Huawei Versatile Routing Platform Software
VRP (R) software, Version 8.180 (CE5855EI V200R005C10SPC800)
Copyright (C) 2012-2018 Huawei Technologies Co., Ltd.

System capabilities supported      :bridge router
System capabilities enabled        :bridge router
Management address type            :IPv4
Management address                 :
Expired time                       :116s

Port VLAN ID(PVID)                 :1
Port and Protocol VLAN ID(PPVID)   :unsupported         
VLAN name of VLAN 1                :VLAN1
Protocol identity                  :--
Auto-negotiation supported         :No
Auto-negotiation enabled           :No
OperMau                            :speed (10000) /duplex (Full)
Link aggregation supported         :Yes
Link aggregation enabled           :Yes
Aggregation port ID                :1
Maximum frame Size                 :9216
Port Identity                      :--
Discovered time                    :2020-04-17 10:26:45

EEE support                        :No
Transmit Tw                        :65535
Receive Tw                         :65535
Fallback Receive Tw                :0
Echo Transmit Tw                   :0
Echo Receive Tw                    :0

Network Card ID                    :--

对端 ip 地址为

Trying ...
Press CTRL+K to abort
Connected to ...
Warning: Telnet is not a secure protocol, and it is recommended to use Stelnet.

Warning: The initial password poses security risks.
The password needs to be changed. Change now? [Y/N]:n
Info: The max number of VTY users is 5, the number of current VTY users online is 1, and total number of terminal users online is 1.
      The current login time is 2021-02-24 15:24:36.
      The last login time is 2021-02-24 13:16:59 from through Telnet.

访问一下对端主机,获取 arp 地址。

  PING 56  data bytes, press CTRL_C to break
    Reply from bytes=56 Sequence=1 ttl=64 time=9 ms
    Reply from bytes=56 Sequence=2 ttl=64 time=2 ms
    Reply from bytes=56 Sequence=3 ttl=64 time=4 ms
    Reply from bytes=56 Sequence=4 ttl=64 time=4 ms
    Reply from bytes=56 Sequence=5 ttl=64 time=4 ms

  --- ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 2/4/9 ms
<c07_35U_5855_BMC02>dis arp
ARP Entry Types: D - Dynamic, S - Static, I - Interface, O - OpenFlow
EXP: Expire-time

------------------------------------------------------------------------------   acb3-b53e-b365        I         Vlanif3     b405-5d07-94ec   15   D/3       GE1/0/1     b405-5d05-e9b6    9   D/3       GE1/0/2     b405-5d07-937e    9   D/3       GE1/0/3    acb3-b535-f430   16   D/3       Eth-Trunk1   acb3-b53e-b3b5    4   D/3       Eth-Trunk1   74ea-c82f-21c8    8   D/3       GE1/0/20   943b-b0b0-5df6    5   D/3       GE1/0/18   542b-de51-b36c   12   D/3       GE1/0/22   c400-ada2-18fc   20   D/3       GE1/0/17   1418-7763-3173   20   D/3       GE1/0/13   acb3-b535-f415   20   D/3       Eth-Trunk1       
Total:12         Dynamic:11       Static:0    Interface:1    OpenFlow:0

得知 GE1/0/13 接口进来的流量,再次判断看是否还有其他网络设备以确定是否是主机。

Local Interface         Exptime(s) Neighbor Interface      Neighbor Device     
10GE1/0/1                     101  10GE2/0/33              C05_35U_6881_MGBU01
10GE1/0/2                     116  10GE1/0/33              C05_35U_6881_MGBU01
GE1/0/18                      101  943b-b0b0-5df6          
GE1/0/20                      109  GigabitEthernet1/0/0    H3C
GE1/0/21                      114  80e4-559d-427f          
GE1/0/22                      111  542b-de51-b36c     






  1. 感谢戴老板的 lldp 命令
  2. 感谢余星星的 arp 思路
  3. 感谢共事的其他人
posted @ 2021-02-24 15:10  季文康  阅读(127)  评论(0编辑  收藏  举报