EdgeRouter - 환경설정 파일을 관리하기 ============================================ download at 2017-06-28T15:54:16Z `origin `_ Overview -------- -------------- 이 문서는 활성화된 환경설정파일에 어떻게 변경 사항을 저장 할 수 있는지 서술합니다. Steps ----- -------------- 일반적으로 \ *save* 명령어를 사용하여 (‘*config/config.boot*\ ’) 활성 환경 설정을 디스크에 저장할 수 있습니다. 이외에도 다른 파일이나 원격 서버에도 활서 환경 설정을 저장할 수 있습니다. \ **save** 를 입력하고 \ **?** 키를 눌러보십시요. :: ubnt@RTR# save Possible completions: Save to system config file Save to file on local machine scp://:@/ Save to file on remote machine ftp://:@/ Save to file on remote machine tftp:/// Save to file on remote machine [edit] ubnt@RTR# save tftp://10.1.0.15/rtr-config.boot Saving configuration to ‘tftp://10.1.0.15rtr-config.boot’... ############################################### 100.0% Done [edit] 시나리오: 관리자가 IPsec 터널을 OpenVPN 터널로 교체하고 있는 와중에, 관리자가 EdgeRouter의 설정을 이전 IPsec 터널 설정으로 되돌리고 싶다고 가정합니다. - 설정을 이전으로 되돌리기전에, IPsec 터널의 환경 설정의 백업본을 저장합니다: :: ubnt@RTR# save config.boot-ipsec Saving configuration to ‘/config/config.boot-ipsec’... Done [edit] *Note: 이 내용은 백업 내용입니다. EdgeRouter가 재부팅되면, 기본 환경설정 파일인 ‘*/config/config.boot*’ 에서 부팅이 시작될 것입니다. - IPsec 환경설정을 관리자가 삭제하고 난 이후에는 OpenVPN 터널을 적용하던 중이었을 것입니다. 그 와중에 IPsec 터널이 다시 필요하게 된 것입니다. 결론적으로 관리자는 EdgeRouter의 환경 설정을 다시 IPsec 터널의 설정을 다시 롤백을 해야합니다. :: ubnt@RTR# load config.boot-ipsec Loading configuration from ‘/config/config.boot-ipsec’... Load complete. Use ‘commit’ to make changes active. [edit] ubnt@RTR# commit [edit] ubnt@RTR# save; exit Saving configuration to ‘/config/config.boot’... Done exit ubnt@RTR:~$ 자동으로 원격지 백업을 매커밋마다 수행하기 위해서는 \ **commit-archive** 환경 설정 옵션을 입력하고, \ **location** 를 입력하고 \ **?** 키를 입력합니다. :: ubnt@RTR# set system config-management commit-archive location Possible completions: Uniform Resource Identifier Detailed information: “scp://:@/” “ftp://:@/” “tftp:///” ubnt@RTR# set system config-management commit-archive location tftp://10.1.0.15/RTR [edit] ubnt@RTR# commit Archiving config... tftp://10.1.0.15/RTR OK [edit] tftp 원격서버에서 hostname 과 날짜로 매 커밋마다 복사본이 저장됩니다. :: admin2@server://tftpboot/RTR$ ls -l total 8 -rw------- 1 nobody nogroup 908 Aug 17 17:19 config.boot-RTR.20120817_171932 -rw------- 1 nobody nogroup 874 Aug 17 17:20 config.boot-RTR.20120818_002046 로컬 디스크에 환경설정 파일을 특정 숫자의 리비전을 남길 수 있습니다. \ **commit‑revisions** 환경설정 옵션을 사용해보십시오. :: ubnt@RTR# set system config-management commit-revisions 50 [edit] ubnt@RTR# commit [edit] 아래는 \ **commit-revisions** 의 명령어 사용 예제입니다. :: ubnt@RTR# set system login user joe authentication plaintext-password secret [edit] ubnt@RTR# commit [edit] ubnt@RTR# save; exit Saving configuration to ‘/config/config.boot’... Done exit ubnt@RTR:~$ show system commit 0 2012-08-17 18:32:13 by ubnt via cli commit 1 2012-08-17 18:31:52 by ubnt via cli commit 2 2012-08-17 18:31:51 by root via init commit *Note: 다음 명령어는 \ **commit-revisions** 환경 설정을 필요로 합니다. :: show system commit diff commit-confirm show system commit file confirm show system commit rollback commit comment 리비전 0의 변경사항을 확인하기 위해서는 \ **show system commit diff** 명령을 입력하세요. :: ubnt@RTR:~$ show system commit diff 0 [edit system login] +user joe { + authentication { + encrypted-password $1$CWVzYggs$NyJXxC3S572rfm6pY8ZMO. + plaintext-password ““ + } + level admin +} 리비전 0의 모든 파일 내용을 확인하기 위해서는 \ **show system commit file 0** 명령을 입력하세요. :: ubnt@RTR:~$ show system commit file 0 커밋에 주석을 추가하기 위해서는 \ **comment** 명령어를 사용합니다. :: ubnt@RTR# set system login user joe level operator [edit] ubnt@RTR# commit comment “change joe from admin to op” [edit] ubnt@RTR# save; exit Saving configuration to ‘/config/config.boot’... Done exit 이제 \ **show system commit** 명령어를 사용하여 주석을 확인 할 수 있습니다. :: ubnt@RTR:~$ show system commit 0 2012-08-17 18:44:41 by ubnt via cli change joe from admin to op 1 2012-08-17 18:34:01 by ubnt via cli commit 2 2012-08-17 18:32:13 by ubnt via cli commit 3 2012-08-17 18:31:52 by ubnt via cli commit 4 2012-08-17 18:31:51 by root via init commit 원격지 라우터에 작업을 할 때에는 방화벽, NAT 룰과 같은 변경 이력이 의도치 않은 유저의 원격지 서버 접속을 제한하는 경우가 존재하며, 이 경우는 직접 라우터 장비를 재부팅 하지 않고서는 해당 내용을 원상태로 복구하기 어렵습니다. 이 문제를 우회하기 위하여 문제를 발생할 여지가 있는 변경에 대하여는 **commit-confirm** 명령어를 사용하세요. 이후 **confirm** 명령어를 사용하여 실제 변경 이력을 저장하는 습관을 들이십시오. :: ubnt@RTR:~$ configure [edit] ubnt@RTR# set firewall name WAN_IN rule 50 action drop [edit] ubnt@RTR# set firewall name WAN_IN rule 50 destination address 172.16.0.0/16 [edit] ubnt@RTR# commit-confirm commit confirm will be automatically reboot in 10 minutes unless confirmed Proceed? [confirm][y] [edit] 저장할 변경 이력을 점검하고 난 이후에는 **confirm ** 명령어를 통해서 저장합니다. :: ubnt@RTR# confirm [edit] 일정 시간을 기다리도록 명시할 수도 있습니다. 이 때에도 **confirm** 명령을 사용하는 것을 잊지 않아야 합니다. 그렇지 않은 경우에는 이전 환경설정으로 갑자기 EdgeRouter가 재부팅을 하며 롤백을 진행할 수도 있습니다. :: ubnt@RTR# commit-confirm 1 commit confirm will be automatically reboot in 1 minutes unless confirmed Proceed? [confirm][y] [edit] ubnt@RTR# Broadcast message from root@RTR (Mon Aug 20 14:00:06 2012): The system is going down for reboot NOW! INIT: Switching to runlevel: 6 INIT: Stopping routing services...zebra...done. Removing all Quagga Routes. [SNIP] 이전 커밋으로 롤백하기 위해서는 \ **show system commit** 명령어를 사용하여 커밋을 확인하고, **rollback** 명령을 입력합니다. :: ubnt@RTR:~$ show system commit 0 2012-08-21 14:46:41 by admin_5 via cli fix bgp policy maps 1 2012-08-21 14:45:59 by admin_5 via cli commit 2 2012-08-21 14:45:33 by admin_5 via cli fix port forwarding 3 2012-08-21 14:45:15 by admin_5 via cli fix firewall 4 2012-08-21 14:44:29 by ubnt via cli commit 5 2012-08-21 14:21:15 by ubnt via cli add port forward for port 2222 to build-server 6 2012-08-21 14:20:24 by ubnt via cli add dmz interface to eth2 7 2012-08-21 14:19:53 by ubnt via cli add ipsec tunnel to office_exchange 8 2012-08-21 14:07:18 by ubnt via cli add firewall for WAN_IN 9 2012-08-21 14:06:37 by ubnt via cli add user first_last 10 2012-08-21 14:04:47 by ubnt via cli commit 11 2012-08-21 14:04:46 by root via init commit 커밋의 히스토리를 확인한 이후에 \ *admin\_5* 가 커밋한 최근 4개의 커밋을 버리고 싶다면, 시스템 환경 설정을 commit 4로 롤백합니다: :: ubnt@RTR# rollback 4 Proceed with reboot? [confirm] [y] Broadcast message from root@RTR (ttyS0) (Mon Aug 21 15:09:12 2012): The system is going down for reboot NOW! *Note: 저장하기 이전에 커밋을 되돌린다면 명령어를 수행하게 되면서 config.boot 를 실행했던 시점부터 **저장되지 않은** 설정 내용들을 모두 잃어버릴 수 있습니다. :: ubnt@RTR# load Loading configuration from '/config/config.boot'... Load complete. Use 'commit' to make changes active. [edit] ubnt@RTR# commit [ service dhcp-server ] Starting DHCP server daemon…