Net Eng

MAC 보안 본문

Network/실습

MAC 보안

欲心 2024. 6. 24. 17:12

■ MAC 보안

- L2, L3 스위치에서 MAC주소를 기반으로 포트를 이용한 보안 설정

- WAN Filtering이 아닌 LAN Filtering을 목적으로 사용

- 지정된 MAC주소를 White list로 간주하며 정적 MAC등록이 되어야 함.

- 설정 위반시 포트 상태는 Shutdown, Protect, Restric의 3가지 가운데 1개로 지정 가능(Default값은 Shutdown)

- 스위치끼리 연결된 포트의 경우 상대방 스위치의 포트에서 사용하는 MAC주소에 대한 부분을 감안해서 설정

→ STP에서 학습한 MAC주소는 상대방 스위치의 Vlan이 가지는 MAC주소임.

- 스위치는 일반적으로 Dynamic방식으로 MAC주소를 학습하며, 해당 정보는 300초(5분)간 유지된다.

- Port Security는 포트의 운용 상태가 Access또는 Trunk로 지정되어 있는 경우 가능하다.

 

 

SW1

conf t
int fa0/1
switchport port-security
Command rejected: FastEthernet0/1 is a dynamic port.

→ 명령어가 거부됨.

sh int fa0/1 switchport

 

- 스위치포트 모드는 모두 3가지(Dynamic(Auto/Desirable), Access, Trunk)가 존재하며, 기본값은 Dynamic Auto이다.

→ Trunk : Vlan Tagging을 위해서 사용

→ Access : 스위치의 BPDU와 CDP정보를 제외할 경우

 

int fa0/1
sw mode access
sw port-security
do sh int fa0/1 sw

 

SW1 Mac 테이블
Port Security address

 

→ Static으로 학습된 MAC주소는 다른 PC가 연결될 경우 해당 장비의 MAC주소로 대체되기 때문에 가급적 포트보안의 정적 Mac주소로 등록해 주는 것이 필요.

 

SW1

conf t
int fa0/1
sw port ?

Switch(config-if)#sw port ?
  aging        Port-security aging commands
  mac-address  Secure mac address
  maximum      Max secure addresses
  violation    Security violation mode
  <cr>

 

sw port max 1
sw port mac- 00D0.58EA.380B
do sh port int fa0/1

설정 후 다른 PC를 연결하여 서버와 Ping test를 진행하면 

 

Switch(config-if)#do sh port int fa0/1
Port Security              : Enabled
Port Status                : Secure-up
Violation Mode             : Shutdown
Aging Time                 : 0 mins
Aging Type                 : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses      : 1
Total MAC Addresses        : 1
Configured MAC Addresses   : 1
Sticky MAC Addresses       : 0
Last Source Address:Vlan   : 0000.0000.0000:0
Security Violation Count   : 0

→ 차단 상태의 포트는 관리자가 직접 설정을 해제해 줘야 함.

 

SW1

conf t
sp portfast default

 

do clear mac-
do sh mac-

int fa0/1
sw mode access
sw port-security
sw port-security max 2
sw port-security mac- 000D.BD6E.4ABB
sw port-security mac- 0030.F2EA.7498

 

Port 셧다운

 

→ Mac 주소를 등록하지 않은 PC3번에서 Ping Test를 하자마자 포트가 셧다운 된다.

 

sw port-security violation ?


Switch(config-if)#sw port-security violation ?
  protect   Security violation protect mode
  restrict  Security violation restrict mode
  shutdown  Security violation shutdown mode
  
sw port-security violation protect
do sh port int fa0/1

→ Protect 모드로 변경해서 계속해서 포워딩 할 수 있도록 한다.

 

Protect Mode

 

sw port-security violation restric

Restrict Mode

 

■ Violation 모드

  protect : 위반시 포트 열림, Count log 없음
  restrict : 위반시 포트 열림, Count log 있음
  shutdown : 위반시 포트 차단. Count log 없음

 

Sticky 토폴로지

 

SW2

conf t
spanning-tree portfast default
int fa0/24
sw mode trunk
sw port
sw port max 3
sw port mac- sticky

 

■ Sticky : 설정 후 최초 접근 장비 우선 등록 

 

SW1

en
conf t
int fa0/1
sw acc vlan 50
int fa0/2
sw acc vlan 50
int fa0/23
sw mode trunk

 

SW2

en
conf t
int fa0/1
sw acc vlan 10
int fa0/2
sw acc vlan 10
int fa0/3
sw acc vlan 40
int fa0/23
sw mode trunk
int fa0/24
sw mode trunk

 

SW3

en
conf t
int fa0/1
sw acc vlan 20
int fa0/2
sw acc vlan 20
int fa0/3
sw acc vlan 40
int fa0/23
sw mode trunk
int fa0/24
sw mode trunk

 

SW4

en
conf t
int fa0/1
sw acc vlan 30
int fa0/2
sw acc vlan 30
int fa0/3
sw acc vlan 40
int fa0/23
sw mode trunk
int fa0/24
sw mode trunk

 

SW1 ~ 4

vtp domain cisco
vtp pass 1234

 

R1

en
conf t
int fa0/0
no sh
int fa0/0.10
encap dot1q 10
ip addr 192.168.10.254 255.255.255.0
int fa0/0.20
encap dot1q 20
ip addr 192.168.20.254 255.255.255.0
int fa0/0.30
encap dot1q 30
ip addr 192.168.30.254 255.255.255.0
int fa0/0.40
encap dot1q 40
ip addr 192.168.40.254 255.255.255.0
int fa0/0.50
encap dot1q 50
ip addr 192.168.50.254 255.255.255.0

 

SW 1~ 4

int fa0/1
sw mode access
int fa0/2
sw mode access
int fa0/3
sw mode access

 

do clear mac-
int fa0/23
sw port-security
sw port-security max 11
sw port mac- sticky
sw port-security violation restrict


sw port-security mac- 0004.9A1C.880D
sw port-security mac- 0001.9660.DB15
sw port-security mac- 0050.0FB4.D327
sw port-security mac- 0009.7C5C.EEAC
sw port-security mac- 000C.850A.A57B
sw port-security mac- 0090.0CE8.D8AE

 

int fa0/23
sw trunk allowd vlan except 40
do sh int trunk

 

■ 실습파일

mac-security-1.pkt
0.06MB
vlan_mac.pkt
0.08MB

 

'Network > 실습' 카테고리의 다른 글

HSRP  (0) 2024.06.25
Etherchannel  (0) 2024.06.25
장비 실습  (0) 2024.06.22
NAT  (0) 2024.06.18
Time-range ACL  (0) 2024.06.18