반응형

 

 

 

 

 

Port-Security 란?

특정 포트에 Port-Security 기능을 사용하여 포트에 학습할 수 있는 MAC주소의 수를 제한하거나 포트에 MAC 주소를 설정하여 허가된 MAC 주소만 접속 가능하도록 설정하는 것입니다. 

 

 

 

 

사용 목적
  • 스위치는 하나의 포트에 여러 개의 MAC주소를 학습할 수 있도록 되어있고 제한이 없다.
  • 이러한 점을 이용하여 여러 개의 MAC주소를 학습하게 하여 스위치의 MAC Address table을 가득차게 만들고 더이상 MAC주소를 학습하지 못하게 된 스위치는 그 이후에 들어오는 모든 Frame을 Flooding 시켜 허브처럼 동작하게 만든다. 이러한 공격하는 기법을 MAC Flooding Attack이라고 한다.
  • 내부 네트워크까지 침입한 공격자는 Sniffing 환경을 구성하여 중간에서 패킷을 훔쳐볼 수 있다. 이런 공격으로 대표적인 것은 MAC주소를 변경하여 네트워크 시스템에 들어갈 수 있는 ARP Spoofing이 있다.

 

 

이제 실습을 해보겠습니다.

 

 

GNS3를 이용하여 구성하였습니다.

SW1 가지고 있는 MAC 주소

SW1#show mac address-table 
          Mac Address Table
-------------------------------------------
Vlan    Mac Address       Type        Ports
----    -----------       --------    -----
 100    0050.7966.6802    DYNAMIC     Et1/0
 100    0050.7966.6804    DYNAMIC     Et1/1
 100    0050.7966.6805    DYNAMIC     Et1/2
Total Mac Addresses for this criterion: 3

 

 

 

SW2 가지고 있는 MAC 주소

SW2#show mac address-table 
          Mac Address Table
-------------------------------------------

Vlan    Mac Address       Type        Ports
----    -----------       --------    -----
 100    0050.7966.6806    DYNAMIC     Et1/2
 100    0050.7966.6807    DYNAMIC     Et1/1
 100    0050.7966.6808    DYNAMIC     Et1/0
Total Mac Addresses for this criterion: 3

 

 

 

 

Port-Security 활성화
SW1(config)#interface ethernet 1/0
SW1(config-if)#switchport port-security

 

 

 

 

Port-Security 학습 가능한 최대 MAC주소 개수 설정
SW1(config)#interface ethernet 0/0 
SW1(config-if)#switchport port-security
SW1(config-if)#switchport port-security maximum 5 (기본은 1개 장비마다 다르지만 최대 4097개까지 가능)

 

 

SW2에 MAC주소는 총 3개 입니다. 하지만 Maximum을 2개로 테스트 했을 경우 Log 입니다.

SW1(config-if)#switchport port-security maximum 2

*Mar 26 14:14:01.841: %PM-4-ERR_DISABLE: psecure-violation error detected on Et0/0, putting Et0/0 in err-disable state 
*Mar 26 14:14:01.842: %PORT_SECURITY-2-PSECURE_VIOLATION: Security violation occurred, caused by MAC address 0050.7966.6806 on port Ethernet0/0. 
*Mar 26 14:14:01.842: %IP-4-DUPADDR: Duplicate address 192.168.100.1 on Vlan100, sourced by aabb.cc80.0200 
*Mar 26 14:14:02.847: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to down. 
*Mar 26 14:14:03.843: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to down

 

Port-Security의 학습 3가지 방식

 

Static Port-Security MAC Address

특정 포트에 사용할 사용자의 MAC주소를 직접 입력하여 설정하고 NVRAM에 저장할 수 있다.

SW1(config)#int ethernet 1/0
SW1(config-if)#switchport port-security
SW1(config-if)#switchport port-security mac-address 0050.7966.6804

 

해당 포트에 다른 MAC주소를 설정해놨을때 차단되었다는 Log 입니다.

*Mar 26 14:38:44.398: %PM-4-ERR_DISABLE: psecure-violation error detected on Et1/0, putting Et1/0 in err-disable state
*Mar 26 14:38:44.398: %PORT_SECURITY-2-PSECURE_VIOLATION: Security violation occurred, caused by MAC address 0050.7966.6802 on port Ethernet1/0.
*Mar 26 14:38:45.403: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet1/0, changed state to down
*Mar 26 14:38:46.399: %LINK-3-UPDOWN: Interface Ethernet1/0, changed state to down

 

 

Dynamic Port-Security MAC Address

특정 포트에 사용할 사용자의 MAC주소를 동적으로 학습하지만 학습한 MAC주소는 NVRAM에 저장할 수 없다

스위치가 Reboot이 되면 Port-Security에 학습했던 MAC주소는 삭제된다.

(명령어 X)

 

 

 

Sticky Port-Security MAC Address

특정 포트에 사용할 사용자의 MAC주소를 동적으로 학습하고, 학습한 MAC주소는 NVRAM에 저장할 수 있다.

스위치가 Reboot이 되어도 Port-Security에 학습했던 MAC주소는 NVRAM에 저장된다.

SW1(config)#interface ethernet 0/0
SW1(config-if)#switchport port-security
SW1(config-if)#switchport port-security mac-address sticky

 

 

 

 

 

Port-Security Violation Mode 3가지

 

Violation shutdown

Port-Security가 동작하는 포트에서 위반했을 경우 해당 포트는 Shutdown이 되며 err-disabled 상태로 넘어간다.

Port-Security Default Violation 이다.

SW1(config)#interface ethernet 0/0
SW1(config-if)#switchport port-security
SW1(config-if)#switchport port-security mac-address 0050.7966.6804
SW1(config-if)#switchport port-security violation shutdown

 

 

 

Violation restrict

Port-Security가 동작하는 포트에서 위반한 MAC주소를 가진 장비의 모든 Frame을 Drop시킨다.

Drop과 동시에 위반한 MAC주소에 대해서 Log가 발생한다.

SW1(config)#interface ethernet 0/0
SW1(config-if)#switchport port-security
SW1(config-if)#switchport port-security maximum 2
SW1(config-if)#switchport port-security violation restrict

 

최대 2개까지 가능하게 했을때 0050.7966.6806의 MAC주소가 제한 되었다는 Log 입니다.

*Mar 26 15:15:47.206: %PORT_SECURITY-2-PSECURE_VIOLATION: Security violation occurred, caused by MAC address 0050.7966.6806 on port Ethernet0/0.

 

 

 

Violation protect

Port-Security가 동작하는 포트에서 위반한 MAC주소를 가진 장비의 모든 Frame을 Drop시킨다.

restrict와 동일하게 동작하지만, protect는 Log를 발생시키지 않는다.

SW1(config)#interface ethernet 0/0
SW1(config-if)#switchport port-security
SW1(config-if)#switchport port-security maximum 2
SW1(config-if)#switchport port-security violation
SW1(config-if)#switchport port-security violation protect

 

 

 

 

 

 

Port-Security Aging Time 2가지

특정 포트에 Port-Security가 동작하면 해당 포트의 연결된 장비의 MAC주소에 대한 유지 시간을 설정할 수 있다.

포트의 MAC주소 개수를 제한하면서 기존의 MAC주소를 수동으로 삭제하지 않고 aging time을 설정하여 관리할 수 있다. 기본 aging time 은 0분이고 최대 1440분이다.

 

Absolute

특정 포트 Port-Security에 등록된 MAC주소가 설정한 aging time이 만료되어야 Port-Security에 등록된 MAC주소가 삭제된다. 

SW1(config)#interface ethernet 0/0
SW1(config-if)#switchport port-security 
SW1(config-if)#switchport port-security aging time 10
SW1(config-if)#switchport port-security aging type absolute 

  

 

 

Inactivity

특정 포트 Port-Security에 등록된 MAC주소로 설정한 aging time동안 Data Traffic이 없는 경우에 해당 Port-Security에 등록된 MAC주소가 삭제된다.

SW1(config)#interface ethernet 0/0 
SW1(config-if)#switchport port-security  
SW1(config-if)#switchport port-security aging time 10
SW1(config-if)#switchport port-security aging type inactivity

 

 

 

 

 

 

해당 포트에 Port-Security 설정 확인입니다.

SW1#show port-security interface ethernet 0/0
Port Security              : Enabled
Port Status                : Secure-up
Violation Mode             : Restrict
Aging Time                 : 0 mins
Aging Type                 : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses      : 2
Total MAC Addresses        : 2
Configured MAC Addresses   : 0
Sticky MAC Addresses       : 0
Last Source Address:Vlan   : 0050.7966.6806:100 - 가장 마지막에 연결된 MAC주소
Security Violation Count   : 20 - 위반된 MAC주소 횟수

 

 

 

 

저는 스탠다드로 이렇게 사용합니다.

SW1(config)#interface ethernet 0/0 
SW1(config-if)#switchport port-security  
SW1(config-if)#switchport port-security aging time 1
SW1(config-if)#switchport port-security aging type inactivity
SW1(config-if)#switchport port-security maximum 5
SW1(config-if)#switchport port-security violation restrict

 

 

 

 

 

감사합니다 !!

부족한 부분이나 빠진 부분이 있으면 댓글로 남겨주세요.

 

 

자세한 내용은 CISCO 홈페이지에서 확인 가능합니다.

https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst4500/12-2/25ew/configuration/guide/conf/port_sec.html#wp1054687

 

반응형

+ Recent posts