กลับไป Net Tools

Cisco Command Reference

คำสั่งที่ใช้บ่อยใน Cisco IOS — รวม 53 คำสั่ง show, configure, troubleshoot, security พร้อมคำอธิบายภาษาไทย กดเพื่อ copy ไปใช้

Show / Verify

15
#
show version
ดูเวอร์ชัน IOS, model, serial, uptime
#
show running-config
ดู config ปัจจุบันที่ใช้อยู่
#
show startup-config
ดู config ที่จะใช้ตอน boot
#
show interfaces status
สถานะทุก interface แบบสรุป
#
show interface gi1/0/1
รายละเอียด interface เฉพาะ
#
show vlan brief
list VLANs ทั้งหมด + ports สมาชิก
#
show ip route
routing table
#
show ip interface brief
IP ของทุก interface แบบสรุป
#
show mac address-table
MAC table ของ switch
#
show cdp neighbors
ดู Cisco device ที่เชื่อมต่ออยู่
#
show lldp neighbors
ดู LLDP neighbors (cross-vendor)
#
show spanning-tree
STP topology + root bridge
#
show etherchannel summary
EtherChannel/LAG status
#
show ip arp
ARP table
#
show logging
log buffer ของ device

Configuration

15
#
configure terminal
เข้า global config mode
(config)#
hostname SW01
ตั้งชื่อ device
(config)#
enable secret cisco123
ตั้ง enable password (encrypted)
(config)#
service password-encryption
encrypt passwords ใน config
(config)#
interface gi1/0/1
เข้า interface mode
(config-if)#
switchport mode access
ตั้ง port เป็น access (single VLAN)
(config-if)#
switchport access vlan 10
กำหนด VLAN ให้ access port
(config-if)#
switchport mode trunk
ตั้ง port เป็น trunk (multi-VLAN)
(config-if)#
switchport trunk allowed vlan 10,20,30
ระบุ VLAN ที่ผ่าน trunk ได้
(config-if)#
no shutdown
เปิด interface up
(config)#
vlan 10
สร้าง VLAN 10
(config-vlan)#
name SALES
ตั้งชื่อ VLAN
(config-if)#
ip address 192.168.1.1 255.255.255.0
ตั้ง IP ให้ interface
(config)#
ip route 0.0.0.0 0.0.0.0 1.1.1.1
default route
#
copy running-config startup-config
save config

Troubleshoot

12
#
ping 8.8.8.8
ping external IP
#
ping 10.0.0.1 source gi1/0/1
ping จาก source interface เฉพาะ
#
traceroute 8.8.8.8
traceroute path
#
show interface gi1/0/1 stats
packet statistics + errors
#
clear counters
ล้าง interface counters
#
debug ip packet detail
debug IP packets (ใช้ระวัง)
#
undebug all
ปิด debug ทั้งหมด
#
show processes cpu sorted
process ใช้ CPU อันดับสูงสุด
#
show processes memory sorted
process ใช้ memory อันดับสูงสุด
#
show tech-support
รวมทุก show command (สำหรับ TAC)
#
show errdisable recovery
ดู ports ที่โดน err-disable
(config-if)#
shutdown / no shutdown
reset interface (toggle)

Security / ACL

11
(config)#
access-list 10 permit 192.168.1.0 0.0.0.255
Standard ACL — anyone in subnet
(config)#
access-list 100 permit tcp any any eq 80
Extended ACL — allow HTTP
(config-if)#
ip access-group 100 in
apply ACL กับ interface (inbound)
(config-if)#
switchport port-security
เปิด port-security (จำกัด MAC ต่อ port)
(config-if)#
switchport port-security maximum 2
จำกัด MAC ได้สูงสุด 2 ตัว
(config-if)#
switchport port-security violation shutdown
ถ้าเกิน → ปิด port
(config)#
username admin privilege 15 secret cisco
สร้าง user enable level 15
(config)#
line vty 0 15
เข้า VTY (SSH/Telnet) line config
(config)#
transport input ssh
อนุญาตแค่ SSH (ปิด Telnet)
(config)#
ip ssh version 2
บังคับใช้ SSH v2 เท่านั้น
(config)#
crypto key generate rsa modulus 2048
สร้าง RSA key 2048-bit

💡 คำสั่งทดสอบบน Cisco IOS 15+ และ IOS-XE — บาง syntax อาจต่างกันใน NX-OS, IOS-XR