Cong Minh Vuong

Vương Công Minh

SysAdmin - Freelancer
  • Emailemail@congminh.ovh
  • Phone+84.90.6700.543
  • Birthday30 April, 1996
  • LocationHo Chi Minh city, VietNam

Các Lệnh cơ bản khi học CCNA - Phần 8 - Port Security

 



- Mục đích: chống các thiết bị lạ cắm vào switch access của công ty

Cách 1: Ngăn không cho user mang laptop cá nhân cắm vào switch công ty bằng cách lock MAC.
Giả sử port e0/0 đang cắm vào 1 máy PC của cty.

interface e0/0
switchport port-security # Mặc định sẽ kích hoạt chế độ chỉ cho phép 1 MAC
switchport port-security maximum <số thiết bị cho phép> #Set số mac tối đa

-> Kết quả: khi cắm máy lạ vào, port sẽ bị down (err-disabled, show int <port> ra để xem )
-> Admin cần shutdown rồi no shutdown port. 
-> Sau đó port sẽ chấp nhận MAC của máy lạ đó => chưa tối ưu.=> xem Cách 2:


Cách 2: Ngăn không cho user mang laptop cá nhân cắm vào switch công ty. 
Kể cả khi đã shutdown/no shutdown
interface e0/0
switchport port-security
switchport port-security mac-address sticky
switchport port-security mac-address sticky [MAC-Address]

Để xóa mac và thêm mac mới
no switchport port-security mac-address sticky [Old-MAC-Address]
switchport port-security mac-address sticky [New-MAC-Address]

-> Kết quả: khi cắm máy lạ vào, port sẽ bị down. Kể cả khi shut/no shut. 
Lí do là switch chỉ ghi nhận MAC lần đầu cắm vào.


Cách 3: Khi các máy đặt ở nơi cố định, ta fix port chỉ chấp nhận MAC của máy này
interface e0/0
switchport port-security
switchport port-security mac-address aabb.cc00.1001

-> Kết quả: khi cắm máy lạ vào, port sẽ bị down. 

KHI MUỐN PORT TỰ UP LẠI SAU KHI BỊ ERR-DISABLED
errdisable recovery cause psecure-violation
errdisable recovery interval 30 : tự up lại sau 30s

KHI KHÔNG MUỐN PORT BỊ ERR-DISABLED
Khi không muốn port bị err-disabled thì ta có các lựa chọn protect và restrict:
switchport port-security violation ?
  protect   : drop gói tin từ PC lạ nhưng không có warning.
  restrict  : drop gói tin từ PC lạ, nhưng có log warning.
  shutdown  : port shutdown và vào trạng thái err-disabled (đã nghiên cứu ở trên)

MỘT SỐ LỆNH SHOW
show port-security interface e0/2
show port-security

VÔ HIỆU PORT SECURITY
interface e0/0
no switchport port-security