EdgeRouter - 액세스 제어 목록(ACL) 추가하기

download at 2017-02-07T01:03:08Z origin

Overview


이 문서는 액세스 제어 목록 룰을 방화벽에 생성하여 네트워크 보안을 향상하는 방법에 대하여 서술합니다. ACL 룰은 사용자 접근을 제한하여 네트워크 보안을 향상에 도움이 됩니다.

Note: EdgeOS 방화벽룰 용어는 IN, OUT, LOCAL이 있습니다.

  • 방화벽 룰셋을 인터페이스 IN 방화벽에 적용하는 것은 인터페이스의 인바운드 트래픽에 영향을 줍니다. 즉, 라우터를 통해 포워딩 되는 트래픽만 영향을 받습니다.
  • OUT 트래픽은 라우팅을 통해 인터페이스 바깥으로 송출하는 트래픽을 의미합니다.
  • LOCAL 트래픽은 라우터가 목적지인 경우를 의미합니다. (예를 들어, 라우터의 web UI를 사용하려고 할 때 LOCAL의 443 포트까지 사용할 필요는 없기 때문입니다.)

IN, OUT 룰중 어느 것을 사용해야 하느냐에 관하여 일부 사람들은 IN이 더 낫다라는 주장을 합니다. 입력을 받을 때 패킷을 차단하는 것이 라우터를 벗어나기 전에 모든 패킷 처리를 한 후 패킷을 차단하거나 버리는 것보다 더 효율적이라고 생각하기 때문입니다. 또한 방화벽 룰셋을 인터페이스나 패킷 방향을 명시하지 않고 적용한다면 아무런 동작도 하지 않게 됩니다.

Steps


방화벽 룰을 생성하기 위해서는 set 이나 edit 명령어를 사용합니다. (두 명령어 모두 아래에 에제가 있습니다.) 추가로 comparediscarduptopcopyrename 명령어를 사용하십시오.

방화벽 룰은 다음과 같은 문법을 통해서 생성할 수 있습니다:

ubnt@ubnt:~$ configure
[edit]
ubnt@ubnt# set firewall name TEST default-action drop
[edit]
ubnt@ubnt# set firewall name TEST enable-default-log
[edit]
ubnt@ubnt# set firewall name TEST rule 10 description “allow icmp”
[edit]
ubnt@ubnt# set firewall name TEST rule 10 action accept
[edit]
ubnt@ubnt# set firewall name TEST rule 10 protocol icmp
[edit]

커밋하지 않은 변경 사항은 compare 명령어를 통해 확인할 수 있습니다:

ubnt@ubnt# compare
[edit firewall]
+name TEST {
+   default-action drop
+   enable-default-log
+   rule 10 {
+       action accept
+       description “allow icmp”
+       protocol icmp
+   }
+}
[edit]

커밋하지 않은 수정사항을 되돌리려면 discard 명령어를 사용합니다:

ubnt@ubnt# discard
Changes have been discarded
[edit]
ubnt@ubnt# compare
No changes between working and active configurations
[edit]

같은 방화벽 룰을 생성하려면 edit 명령어를 사용합니다:

ubnt@ubnt# edit firewall name TEST
[edit firewall name TEST]
ubnt@ubnt#set default-action drop
[edit firewall name TEST]
ubnt@ubnt# set enable-default-log
[edit firewall name TEST]
ubnt@ubnt#edit rule 10
[edit firewall name TEST rule 10]

?tab 키를 입력하여 각 상황에 맞는 옵션을 확인할 수 있습니다.

ubnt@ubnt# set
action      disable ipsec   p2p source     time
description fragment    limit   protocol   state
destination icmp    log recent  tcp
[edit firewall name TEST rule 10]
ubnt@ubnt# set description “allow icmp”
[edit firewall name TEST rule 10]
ubnt@ubnt# set action accept
[edit firewall name TEST rule 10]
ubnt@ubnt# set protocol icmp
[edit firewall name TEST rule 10]

해당 변경 상태에서 변경 내역을 확인하고 싶다면 compare 를 입력하십시오:

ubnt@ubnt# compare
[edit firewall name TEST rule 10]
+action accept
+description “allow icmp”
+ protocol icmp
[edit firewall name TEST rule 10]

다음 수정 단계로 이동하려면 up 명령어를 사용하세요:

ubnt@ubnt#up
[edit firewall name TEST]
ubnt@ubnt# compare
[edit firewall name TEST]
+default-action drop
+enable-default-log
+rule 10 {
+   action accept
+   description “allow icmp”
+   protocol icmp
+}
[edit firewall name TEST]
ubnt@ubnt# up
[edit firewall]
ubnt@ubnt# compare
[edit firewall]
+name TEST {
+   default-action drop
+   enable-default-log
+   rule 10 {
+       action accept
+       description “allow icmp”
+       protocol icmp
+   }
+}
[edit firewall]

처음 수정단계로 돌아가려면 top 을 입력합니다:

ubnt@ubnt# top
[edit]
ubnt@ubnt# compare
[edit firewall]
+name TEST{
+   default-action drop
+   enable-default-log
+   rule 10 {
+       action accept
+       description “allow icmp”
+       protocol icmp
+   }
+}
[edit]

현재 방화벽 룰을 확인하기 위해서는 show firewall 명령어를 수행합니다:

ubnt@ubnt# show firewall
 name WAN1_LOCAL {
    default-action drop
    rule 10 {
        action accept
        state {
            established enable
            related enable
        }
    }
    rule 20 {
        action drop
        state {
            invalid enable
        }
    }
    rule 30 {
        action accept
        destination {
            port 22
        }
        protocol tcp
    }
 }
[edit]

새로운 방화벽 룰을 기존 룰에서 생성하려면 copy 명령어를 사용하세요.

ubnt@ubnt# edit firewall
[edit firewall]
ubnt@ubnt# copy name WAN1_LOCAL to name WAN2_LOCAL
[edit firewall]
ubnt@ubnt# commit
[edit firewall]
ubnt@ubnt#top
[edit]
ubnt@ubnt#show firewall
 name WAN1_LOCAL {
        default-action drop
        rule 10 {
        action accept
        state {
            established enable
            related enable
               }
        }
        rule 20 {
        action drop
        state {
            invalid enable
        }
        }
        rule 30 {
        action accept
        destination {
            port 22
        }
        protocol tcp
        }
 }
 name WAN2_LOCAL {
        default-action drop
        rule 10 {
               action accept
               state {
                       established enable
                       related enable
               }
        }
        rule 20 {
        action drop
        state {
            invalid enable
        }
        }
        rule 30 {
        action accept
        destination {
            port 22
        }
        protocol tcp
        }
 }
[edit]

새로운 방화벽 룰의 이름을 변경하려면 rename 명령어를 사용하십시오.

ubnt@ubnt# edit firewall
[edit firewall]
ubnt@ubnt# rename name W[TAB]
WAN1_LOCAL  WAN2_LOCAL
[edit firewall]
ubnt@ubnt# rename name WAN2_LOCAL to name WAN2_IN
[edit firewall]
ubnt@ubnt# commit
[edit firewall]
ubnt@ubnt#top
[edit]
ubnt@ubnt# show firewall name
 name WAN1_LOCAL {
        default-action drop
        rule 10 {
        action accept
        state {
            established enable
            related enable
               }
        }
        rule 20 {
        action drop
        state {
                       invalid enable
               }
        }
        rule 30 {
               action accept
        destination {
            port 22
        }
        protocol tcp
        }
 }
 name WAN2_IN {
        default-action drop
        rule 10 {
        action accept
        state {
            established enable
            related enable
        }
    }
        rule 20 {
               action drop
               state {
                       invalid enable
               }
    }
        rule 30 {
               action accept
               destination {
                       port 22
               }
               protocol tcp
    }
 }
[edit]
ubnt@ubnt#

 UBNT-Matt /  UBNT-Jamie