EdgeRouter - 방화벽 룰 생성하기 ===================================== download at 2017-10-04T08:55:33Z `origin `_ 방화벽 룰을 생성하기 위해서는 \ **set** or **edit** 명령어를 사용합니다. (두 방법 모두 아래에 서술합니다.) 추가적으로 \ **compare**, \ **discard**, \ **up**, \ **top**, \ **copy**, \ **rename** 명령어도 사용합니다. 방화벽 룰은 엄격한 문법을 사용하여 생성합니다: :: 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#