EdgeRouter - 장애가 발생한 EdgeOS 장치에서 마지막 설정으로 복구하기 =========================================================== download at 2017-10-27T03:33:39Z `origin `_  Overview -------------- 이 문서는 EdgeRouter에서 EdgeOS 플랫폼을 완전 재설치 하는 방법에 대하여 서술합니다. EdgeRouter가 응답 불능 상태에 빠지면, 이 방법을 사용하여 재설치를 진행할 수 있습니다. |warning_25x25.png| .. Note:: 이 튜토리얼 정보는 사용 유저가 작성하였습니다. (원 포스트는 `here `__ ) Ubiquiti에서 지원하는 내용이 아니며, 설정중에 발생하는 문제는 본인의 귀책사유입니다. ER-Lite와 ER-PoE에서 동작합니다. Table of Contents -------------- #. `Intro <#intro>`__ #. `Steps <#steps>`__ #. `관련 문서 <#related%20articles>`__ -------------- Intro -------------- `맨위로 가기 <#top>`__ 기술적으로 말해서 EdgeOS 커널은 재컴파일하고 사이즈를 줄여서 임베디드 initramfs를 복구 도구로 사용하고 있습니다. 라우터를 시리얼로 연결하고, TFTP로 부팅하여 최소 복구 시스템으로 진입할 수 있습니다. 다음 스크립트는 자동 복구 과정을 자동화한 스크립트 내용입니다: #. emrk-factory-reset — config.boot를 삭제하고 선택적으로 백업본을 생성하고 config 디렉토리에 복사하여 리부팅 이후 확인할 수 있도록합니다. #. emrk-remove-user-data — 수정 가능한 디렉토리 데이터를 삭제합니다. EdgeOS 시스템을 클린한 상태로 되돌립니다. (모든 설정 데이터, 설치한 패키지 등등 모두 삭제합니다) 리셋 후에는 사용자 데이터도 삭제하며 리셋 버튼은 실제로 데이터를 삭제하지 않고 이전 수정 가능 디렉토리의 이름을 변경하고 새로운 디렉토리에 새로운 이름을 부여합니다. ERL을 신뢰하지 못하는 서드파티에 부여하고자 할때 유용합니다. #. emrk-reinstall — tarball 릴리즈 파일을 URL에서 다운 받고, 처음부터 EdgeOS를 재설치합니다. 스크립트를 다운로드 하기위한 링크: \ http://packages.vyos.net/tools/emrk/ |warning_25x25.png| .. Note:: emrk-remove-user-data 와 emrk-reinstall 명령어는 파급력이 매우 큰 명령어 입니다. 이전 명령어는 모든 EdgeOS 이미지도 삭제하며, 뒤의 명령어는 모든 파일을 삭제하고 모든 파티션을 재설치하므로 모든 데이터를 삭제합니다. .. Note:: `basic reset methods `__ 문서의 내용을 수행하고 난 이후라면 이 복구 방법이 유일한 방법일 수 있습니다.   -------------- Steps -------------- `맨위로 가기 <#top>`__ 1. 이미지를 다운받습니다: \ http://packages.vyos.net/tools/emrk/0.9c/ (MD5 sum: 3545d69a8912fd967c7301031c47960e) 2. TFTP 서버를 설치합니다. UNIX 시스템은 포트/리포지토리를 항상 사용 가능하지만, 윈도우 서버는 다음 링크를 사용하십시오. http://tftpd32.jounin.net/ 이미지를 TFTP 디렉토리에 복사합니다. DHCP 서버를 설정하는 것이 더 나을 것입니다. ISC DHCPD에서 다음을 수행합니다: :: option tftp-server-name "x.x.x.x"; # Your TFTP server address next-server x.x.x.x; # Your TFTP server address option bootfile-name "emrk-0.9c.bin"; filename "emrk-0.9c.bin 3. 시리얼 포트를 사용하여 라우터에 연결합니다. 전원을 켜거나 리부팅하여 EdgeOS 커널이 로딩되기 이전에 아무키나 입력합니다. 이렇게 하면 라우터를 직접 수동으로 부팅 할 수 있는 부트로더 콘솔을 실행합니다. 4. 라우터 eth0을 네트워크에 연결합니다. 5. DHCP 서버를 사용한다면, 다음 명령어를 U-Boot CLI에 수행합니다: :: dhcp;tftpboot;bootoctlinux $loadaddr  DHCP서버를 사용하지 않는다면, 다음으로 네트워크를 수동으로 설정할 수 있습니다: :: set ipaddr x.x.x.x (where x.x.x.x is desired router IP address) set netmask 255.255.255.0 (or whatever mask you want) set serverip y.y.y.y (where y.y.y.y is your TFTP server address) set bootfile emrk-0.9c.bin ##Optionally set gatewayip z.z.z.z (where z.z.z.z is your default gateway) tftpboot bootoctlinux $loadaddr 6. 모든 내용이 정상 동작한다면 bootoctlinux 명령어가 커널 부팅을 출력하고, 계속할 것인지 물어볼 것입니다. "yes" (대소문자 유의), "no" 를 입력하여 DHCP가 직접 주소를 설정하거나 직접 네트워크를 설정하십시오. 7. EdgeOS를 재설치하려면 tarball 파일을 다운받아 HTTP/FTP/SSH 서버를 통해서 복사합니다. 8. 아래는 재인스톨의 세션 예제입니다. (커널 부팅 메시지는 제외하였습니다.) :: Loading EMRK 0.9a Mounting filesystems Bringing up eth0 Checking boot partition Boot partition looks intact Attempting to mount boot partition Boot partition successfully mounted Looking for kernel file Found a kernel Checking kernel MD5 sum file Found kernel MD5 sum file Checking kernel MD5 sum Kernel MD5 sum is correct Checking root partition Root partition looks intact Attempting to mount root partition kjournald starting. Commit interval 5 seconds EXT3 FS on sda2, internal journal EXT3-fs: mounted filesystem with writeback data mode. Root partition successfully mounted Looking for system image file Found a system image file Checking system image MD5 sum file Found system image MD5 sum file Checking system image MD5 sum System image MD5 sum is correct ********************************************** Welcome to EdgeMAX Rescue Kit! This tool is distributed under the terms of GNU General Public License and other licenses Brought to you by SO3 Group WARNING: This tool is not developed, officially supported or endorsed by Ubiquiti Networks! Using it may lead to destroying your router configuration or operating system Ubiquiti Networks support will not help you with using it or fixing consequences of using it. This tool itself is distributed without any warranty and authors are not liable for any damage it may cause By using this tool you agree you are doing it at your own risk and understand what you are doing ********************************************* Enter 'Yes' to proceed, 'No' to reboot yes or no: yes Do you want to configure network via DHCP? yes or no: yes udhcpc (v1.17.1) started Sending discover... Sending select for 10.91.19.175... Lease of 10.91.19.175 obtained, lease time 86400 /usr/share/udhcpc/default.script: Resetting default routes route: SIOCDELRT: No such process /usr/share/udhcpc/default.script: Adding DNS 10.91.19.1 EMRK provides some scripts for automated recovery procedures: emrk-factory-reset -- reset config to factory default emrk-remove-user-data -- remove all the user data including config and everything emrk-reinstall -- reinstall EdgeOS from scratch (wipes any user data too) Enter 'reboot' to reboot your router BusyBox v1.17.1 (Debian 1:1.17.1-8) built-in shell (ash) Enter 'help' for a list of built-in commands. /bin/ash: can't access tty; job control turned off EMRK> EMRK>emrk-reinstall WARNING: This script will reinstall EdgeOS from scratch If you have any usable data on your router storage, it will be irrecoverably destroyed! Do you want to continue? yes or no: yes Unmounting boot partition Unmounting root partition Re-creating partition table Creating boot partition Formatting boot partition mkfs.vfat 3.0.9 (31 Jan 2010) Creating root partition Formatting root partition Mounting boot parition Mounting root partition kjournald starting. Commit interval 5 seconds EXT3 FS on sda2, internal journal EXT3-fs: mounted filesystem with writeback data mode. Enter EdgeOS image url: http://dl.ubnt.com/firmwares/edgemax/v1.6.0/ER-e100.v1.6.0.4716006.tar % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 68.3M 100 68.3M 0 0 8319k 0 0:00:08 0:00:08 --:--:-- 6318k Unpacking EdgeOS release image Verifying EdgeOS kernel Copying EdgeOS kernel to boot partition Verifying EdgeOS system image Copying EdgeOS system image to root partition Creating EdgeOS writable data directory Cleaning up Installation finished Please reboot your router 이 작업을 수동으로 진행하려면 심볼릭 링크를 applets에 적용하여 (cat/grep/rm/cp/mv/tar 등과 ping,traceroute,nc 등) busybox를 사용합니다. ERL을 사용할 때에는 8GB USB를 사용하였습니다. 이 문서가 유용하길 바라며, 버그나 제안사항은 언제든지 환영합니다. 사용한 스크립트는 다음에 있습니다: \ http://packages.vyos.net/tools/emrk  -------------- 관련 문서 -------------- `맨위로 가기 <#top>`__ `SSH를 사용하여 커넥션 생성하기 `__    .. |warning_25x25.png| image:: /hc/article_attachments/115010695227/warning_25x25.png