IMG_0384

Cisco Switch 常用指令

1. 常用指令

# 進入管理模式
enable

# 進入組態設定模式
configure terminal

# 設定 hostname
hostname [hostname]

# 查看生成樹狀態
show spanning-tree

# 查看Port的狀態
show interfaces status TenGigabitEthernet 1/0/12

# 查看Port詳細狀態(FCS錯誤、CRC錯誤等)
show interfaces counters TenGigabitEthernet 1/0/12

# 查看Vlan
show vlan

# 查看Mac Address Table
show mac address-table

# 查看ARP Table
show arp

# 透過ARP Table查詢IP對應的MAC
show arp ip-address 10.100.130.1

# 透過ARP Table查詢MAC對應的IP
show arp mac-address 00:0c:29:0a:88:2f

# 尋找Mac Address在哪個Port上
show mac address-table dynamic address 00:0c:29:0a:88:25

# 查看PoE裝置電源(功率)使用率
show power inline

# 開啟 Port
no shutdown

# 關閉 Port
shutdown

2. 查看生成樹狀態

SG350XG-Stack#show spanning-tree


Spanning tree enabled mode: RSTP
Default port cost method:   long
Loopback guard:             Disabled



  Root ID    Priority:   32768
             Address:    cc:8e:71:c9:ae:33
             This switch is the root
             Hello Time: 2 sec Max Age: 20 sec Forward Delay: 15 sec

  Number of topology changes: 63 last change occurred: 47:06:01 ago
  Times:  hold: 1, topology change: 35, notification: 2
          hello: 2, max age: 20, forward delay: 15

Interfaces
  Name     State   Prio.Nbr    Cost    Sts   Role PortFast       Type
--------- -------- --------- -------- ------ ---- -------- -----------------
 te1/0/1  enabled    128.1     2000    Frw   Desg   Yes       P2P (RSTP)
 te1/0/2  enabled    128.2     2000    Frw   Desg   Yes       P2P (RSTP)
 te1/0/3  enabled    128.3   2000000   Dsbl  Dsbl    No            -
 te1/0/4  enabled    128.4   2000000   Dsbl  Dsbl    No            -
 te1/0/6  enabled    128.6   2000000   Dsbl  Dsbl    No            -
 te1/0/7  enabled    128.7   2000000   Dsbl  Dsbl    No            -
 te1/0/8  enabled    128.8    200000   Frw   Desg    No       P2P (RSTP)
 te2/0/1  enabled   128.53     2000    Frw   Desg   Yes       P2P (RSTP)
 te2/0/2  enabled   128.54     2000    Frw   Desg   Yes       P2P (RSTP)
 te2/0/6  enabled   128.58   2000000   Dsbl  Dsbl    No            -
 te2/0/7  enabled   128.59   2000000   Dsbl  Dsbl    No            -
 te2/0/8  enabled   128.60    20000    Frw   Desg   Yes       P2P (RSTP)
   Po1    enabled  128.1000    1000    Frw   Desg    No        P2P (STP)
   Po2    enabled  128.1001   20000    Dsbl  Dsbl    No            -
   Po3    enabled  128.1002    1000    Frw   Desg   Yes       P2P (RSTP)
   Po4    enabled  128.1003    1000    Frw   Desg   Yes       P2P (RSTP)
   Po5    enabled  128.1004    1000    Frw   Desg   Yes       P2P (RSTP)
   Po6    enabled  128.1005   20000    Dsbl  Dsbl    No            -
   Po7    enabled  128.1006   20000    Dsbl  Dsbl    No            -
   Po8    enabled  128.1007   20000    Dsbl  Dsbl    No            -

3. 查看Port的狀態

SG350XG-Stack#show interfaces status TenGigabitEthernet 1/0/12
                                             Flow Link          Back   Mdix
Port     Type         Duplex  Speed Neg      ctrl State       Pressure Mode
-------- ------------ ------  ----- -------- ---- ----------- -------- -------
te1/0/12 10G-Fiber    Full    10000 Disabled Off  Up          Disabled Off

4. 查看Port詳細狀態(FCS錯誤、CRC錯誤等)

SG350XG-Stack#show interfaces counters TenGigabitEthernet 1/0/12

      Port       InUcastPkts  InMcastPkts  InBcastPkts    InOctets
---------------- ------------ ------------ ------------ ------------
    te1/0/12      390096070     3457156      4645549    96111592544

      Port       OutUcastPkts OutMcastPkts OutBcastPkts  OutOctets
---------------- ------------ ------------ ------------ ------------
    te1/0/12      977468331     2629566      20558971   104985704324
                                                        5

FCS Errors: 0
Single Collision Frames: 0
Multiple Collision Frames: 0
SQE Test Errors: 0
Deferred Transmissions: 0
Late Collisions: 0
Excessive Collisions: 0
Carrier Sense Errors: 0
Oversize Packets: 0
Internal MAC Rx Errors: 0
Symbol Errors: 0
Received Pause Frames: 0

5. 查看Vlan

SG350XG-Stack#show vlan
Created by: D-Default, S-Static, G-GVRP, R-Radius Assigned VLAN, V-Voice VLAN

Vlan       Name           Tagged Ports      UnTagged Ports      Created by
---- ----------------- ------------------ ------------------ ----------------
 1      Vlan1-MGMT                        te1/0/1-4,                D
                                          te1/0/6-7,
                                          te1/0/9-11,
                                          te1/0/13-52,
                                          te2/0/1-2,
                                          te2/0/6-11,
                                          te2/0/13-52,
                                          te3/0/1-52,
                                          te4/0/1-52,Po1,
                                          Po3-8
 2     Vlan2-vMotion   te1/0/1-4,                                   S
                       te2/0/1-2,te2/0/8,
                       Po1,Po3-5
 3      Vlan3-WiFi     te1/0/1-4,                                   S
                       te2/0/1-2,te2/0/8,
                       Po1,Po3-5
 4       Vlan4-4F      te1/0/1-4,                                   S
                       te2/0/1-2,te2/0/8,
                       Po1,Po3-5
 5       Vlan5-5F      te1/0/1-4,                                   S
                       te2/0/1-2,te2/0/8,
                       Po1,Po3-5
100    Vlan100-Hinet   te1/0/1-4,              te1/0/8              S
                       te2/0/1-2,te2/0/8,
                       Po1,Po3-5

6. 查看Mac Address Table

SG350XG-Stack#show mac address-table
Flags: I - Internal usage VLAN
Aging time is 300 sec

    Vlan          Mac Address         Port       Type
------------ --------------------- ---------- ----------
     1         00:0c:29:0a:88:25    te1/0/1    dynamic
     1         00:0c:29:0a:88:2f    te1/0/1    dynamic
     1         00:0c:29:2a:af:d8    te2/0/2    dynamic
     1         00:0c:29:59:a7:31    te1/0/1    dynamic

7. 尋找Mac Address在哪個Port上

SG350XG-Stack#show mac address-table dynamic address 00:0c:29:0a:88:25
Flags: I - Internal usage VLAN
Aging time is 300 sec

    Vlan          Mac Address         Port       Type
------------ --------------------- ---------- ----------
     1         00:0c:29:0a:88:25    te1/0/1    dynamic

8. 查看ARP Table

SG350XG-Stack#show arp

Total number of entries: 85


  VLAN    Interface     IP address        HW address          status
--------------------- --------------- ------------------- ---------------
vlan 1     te1/0/1    10.100.100.1    00:0c:29:0a:88:25   dynamic
vlan 1     te2/0/8    10.100.100.2    e4:8d:8c:2a:cb:b6   dynamic

9. 透過ARP Table查詢IP對應的MAC

SG350XG-Stack#show arp ip-address 10.100.130.1

  VLAN    Interface     IP address        HW address          status
--------------------- --------------- ------------------- ---------------
vlan 3     te1/0/1    10.100.130.1    00:0c:29:0a:88:2f   dynamic

10. 透過ARP Table查詢MAC對應的IP

SG350XG-Stack#show arp mac-address 00:0c:29:0a:88:2f

  VLAN    Interface     IP address        HW address          status
--------------------- --------------- ------------------- ---------------
vlan 3     te1/0/1    10.100.130.1    00:0c:29:0a:88:2f   dynamic
vlan 4     te1/0/1    10.100.140.1    00:0c:29:0a:88:2f   dynamic
vlan 5     te1/0/1    10.100.150.1    00:0c:29:0a:88:2f   dynamic

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *