블로그 이미지
훅크선장

카테고리

분류 전체보기 (363)
사진이야기 (23)
펭귄컴퓨팅 (122)
컴퓨터보안 (84)
절름발이 프로그래머 (59)
하드웨어개조 (23)
멀알려줄까 (35)
잡다한것들 (15)
홈베이킹&홈쿠킹 (2)
Total
Today
Yesterday

달력

« » 2025.9
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

공지사항

태그목록

최근에 올라온 글

1. OpenWRT Firmware 설치
사전 준비사항
1) OpenWRT Firmware 10.3.1 버전 (2011년 11월 29일 현재 최신 버전)을 다운받는다. 파일명은 openwrt-ar71xx-generic-dir-825-b1-jffs2-factory.bin 이며, http://downloads.openwrt.org/backfire/10.03.1/ar71xx/ 에서 다운받을 수 있다.

firmware recovery mode를 이용하여, 웹 인터페이스로 펌웨어를 설치
2) DIR-825 공유기의 전원이 꺼진 상태에서, 후면 패널 부분의 RESET 버튼을 누른 상태로 전원을 인가한다. RESET 버튼을 계속 누른 상태로 약 10초 ~ 30초 사이를 유지하면, 전면 패널의 전원 LED 가 주황색으로 느리게 깜빡거리는 상태가 바로 firmware recovery mode이다. 

컴퓨터의 네트워크설 
3) 컴퓨터의 네트워크 설정을 IP 주소 : 192.168.0.100, 서브넷 마스크 : 255.255.255.0, 기본 게이트웨이 : 192.168.0.1 로 설정한다. 다른 항목은 설정하지 않아도 된다.

컴퓨터와 공유기의 연결
4) 컴퓨터 네트워크 카드와 공유기의 LAN 포트를 랜 케이블로 연결한다. 공유기의 LAN 포트는 후면 패널에서 파란색 영역으로 표시되어 있고, 1, 2, 3, 4 라고 번호가 붙여진 곳이다. 4개의 포트 중에 어떤 포트를 사용해도 상관없다.

펌웨어 업데이트
5) 컴퓨터에서 인터넷 익스플로러를 실행하고(반드시 Internet Explorer이어야 한다. 기타 사파리, 파이어폭스, 크롬 브라우저를 사용해서는 안된다.), 주소창에 http://192.168.0.1 를 입력한다.
6) 펌웨어 업데이트 화면이 나오면, "Browse" 버튼을 누른 다음, 미리 다운받은 openwrt-ar71xx-generic-dir-825-b1-jffs2-factory.bin 펌웨어 파일을 선택하고, "Update"  버튼을 클릭한다. 
7) 화면에서 펌웨어 업데이트 진행과정이 %로 표시된다. 100%가 되고나서도 약 10 ~ 20초 정도를 더 기다리면, 자동으로 장비가 리부팅된다. (절대 어떤 일이 있더라도, 브라우저를 닫아버리거나, 공유기를 끄면 안된다. 컴퓨터도 건드리지 않는 것이 좋다.)

펌웨어 업데이트 확인
8) 공유기가 리부팅되는 과정중에 전면 패널의 전원 LED 가 주황색으로 깜빡거린 후에, 완전히 동작하면 주황색으로 켜진 상태가 유지된다. 컴퓨터의 네트워크 설정을 “자동으로 IP 주소 받기” 와 “자동으로 DNS 서버 주소 받기”로 설정한다. 그리고 명령어 창을 열고 ipconfig 명령을 내렸을 때, 컴퓨터의 IP 주소가 자동으로 192.168.1.144와 같은 192.168.1.x 대역을 가지고 있다면 정상적으로 펌웨어가 업데이트된 상황이다.

공유기의 관리자 암호 설정
9) OpenWRT는 처음 설치하면, 무조건 관리자 암호를 설정하도록 되어 있다.
 OpenWRT 공유기의 IP 주소는 192.168.1.1이며, 먼저 telnet을 통하여 관리자 암호를 설정한다. 

telnet 192.168.1.1
한 다음,
바로 로그인되면, passwd 명령어를 이용하여, 관리자 암호를 설정한다. 관리자 암호는 두 번 넣도록 되어 있다.
(XShell과 같은 자동 로그인되는 터미널 프로그램에서는 로그인 스크립트 인식을 꺼놓아야 한다. 왜냐하면, XShell과 같은 프로그램은 접속하는 순간, 로그인 스크립트를 실행하기 때문에, 정상적인 로그인이 되는 것이 아니라, 엉뚱하게도 패스워드가 틀렸으니, 패스워드를 바꾸라는 화면이 나온다.)

exit 명령어로 telnet 접속을 종료한다.
telnet 접속이 종료되면, telnet은 더 이상 사용할 수 없다. 오직 SSH로만 접속 가능하다.

D-Link DIR-825 공유기의 OpenWRT는 웹 인터페이스가 없으므로,(나중에 설치할 수는 있으나, 공유기 내부 디스크 공간 제약이 존재한다.) 모든 것을 SSH 접속으로 설정한다.

버팔로 WZR-HP-G300NH 제품은 펌웨어에 기본적으로 Luci 웹 인터페이스가 존재한다. 두 제품의 차이는 내부 램 영역의 사용 파티션 공간 때문에 생긴다.
DIR-825는 루트 파티션 영역이 5MB로 설정되고, WZR-HP-G300NH는 30MB로 설정되므로, 후자가 훨씬 많은 추가 패키지들을 설치할 수 있다. DIR-825는 Luci 웹 인터페이스를 설치하게 되면, 다른 기능들을 거의 설치할 수가 없다.

2. OpenWRT의 기본 설정 변경
SSH 클라이언트를 이용하여, IP 주소 : 192.168.1.1 , 포트번호 : 22 , 사용자 계정 : root 로 공유기로 SSH 로그인을 한다. 앞에서 설정한 패스워드를 사용한다. 

1) 쉘 명령어 alias 추가
쉘에서 디렉토리의 파일들을 보여주는 ls -la 명령어를 ll 명령어를 줄여서 쓸 수 있도록 설정한다.
/root 디렉토리에 .profile을 생성하고, 그 안에 alias 구문으로 설정하면 된다.
또는
/etc 디렉토리에 있는 profile 파일을 수정하면 된다.

Connecting to 192.168.1.1:22...
Connection established.
Escape character is '^@]'.

sh: /usr/bin/X11/xauth: not found


BusyBox v1.19.3 (2011-12-19 15:01:26 MST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 ATTITUDE ADJUSTMENT (bleeding edge, r29570) ----------
  * 1/4 oz Vodka      Pour all ingredients into mixing
  * 1/4 oz Gin        tin with ice, strain into glass.
  * 1/4 oz Amaretto
  * 1/4 oz Triple sec
  * 1/4 oz Peach schnapps
  * 1/4 oz Sour mix
  * 1 splash Cranberry juice
 -----------------------------------------------------
root@OpenWrt:/# cd
root@OpenWrt:~# vi .profile
alias ll='ls -la'

~
root@OpenWrt:~# sync
root@OpenWrt:~# source ./.profile 

다른 방법으로 /etc 디렉토리에 있는 profile 파일 수정하기

root@OpenWrt:~# cd /etc
root@OpenWrt:/etc# vi profile
#!/bin/sh
[ -f /etc/banner ] && cat /etc/banner
...
<중략>
...
[ -x /usr/bin/arp ] || arp() { cat /proc/net/arp; }
[ -z /bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
 
# Shell Command Alias
alias ll='ls -la'
~

2) 내부 LAN 네트워크 대역 변경
내부 LAN 네트워크 대역 192.168.1.1을 나만의 네트워크 대역으로 바꾼다.
다른 공유기와 혼란이 되지 않도록, C-Class 대역이 생소한 192.168.43.1 네트워크 대역으로 변경한다.

내부 LAN 네트워크 설정을 수정한다.

root@OpenWrt:/# cd /etc
root@OpenWrt:/etc# ll
drwxr-xr-x   13 root     root             0 Jan  1  1970 .
drwxr-xr-x   17 root     root             0 Dec 27 01:47 ..
lrwxrwxrwx    1 root     root             7 Dec 20 09:43 TZ -> /tmp/TZ
-rw-r--r--    1 root     root           589 Dec 19 21:57 banner
drwxr-xr-x    2 root     root             0 Jan  1  1970 config
drwxr-xr-x    2 root     root             0 Dec 19 21:57 crontabs
drwxr-xr-x    4 root     root             0 Dec 19 21:57 defconfig
-rwxr-xr-x    1 root     root          2671 Dec 19 21:02 diag.sh
-rw-r--r--    1 root     root          1368 Dec 19 22:04 dnsmasq.conf
drwx------    2 root     root             0 Jan  1  1970 dropbear
-rw-r--r--    1 root     root             0 Jan  1  1970 ethers
-rw-r--r--    1 root     root           139 Dec 19 22:06 firewall.user
lrwxrwxrwx    1 root     root            10 Dec 20 09:43 fstab -> /tmp/fstab
lrwxrwxrwx    1 root     root            19 Dec 20 09:43 functions.sh -> ../lib/functions.sh
-rw-r--r--    1 root     root            78 Jan  1  1970 fw_env.config
-rw-r--r--    1 root     root           123 Mar 21  2011 group
-rw-r--r--    1 root     root            20 Mar 21  2011 hosts
drwxr-xr-x    8 root     root             0 Dec 20 09:43 hotplug.d
-rw-r--r--    1 root     root          1201 Nov  5 23:38 hotplug2-common.rules
-rw-r--r--    1 root     root            80 Mar 21  2011 hotplug2-init.rules
-rw-r--r--    1 root     root           242 Dec 20 09:26 hotplug2.rules
drwxr-xr-x    2 root     root             0 Nov  9 21:52 init.d
-rw-r--r--    1 root     root           104 Jan  1  1970 inittab
drwxr-xr-x    2 root     root             0 Dec 20 09:42 modules-boot.d
drwxr-xr-x    2 root     root             0 Dec 20 09:29 modules.d
lrwxrwxrwx    1 root     root            12 Dec 20 09:43 mtab -> /proc/mounts
-rw-r--r--    1 root     root           163 Dec 20 09:14 opkg.conf
-rw-r--r--    1 root     root           190 Jan  1  1970 passwd
-rw-r--r--    1 root     root           190 Nov 18 00:28 passwd-
drwxr-xr-x    4 root     root             0 Dec 20 09:43 ppp
-rwxr-xr-x    1 root     root           888 Jul 23 18:38 preinit
-rw-r--r--    1 root     root           476 Aug 19 18:08 profile
-rw-r--r--    1 root     root          2478 Mar 21  2011 protocols
-rwxr-xr-x    1 root     root          1490 Nov  9 21:52 rc.common
drwxr-xr-x    2 root     root             0 Dec 20 09:43 rc.d
-rw-r--r--    1 root     root           132 Mar 21  2011 rc.local
lrwxrwxrwx    1 root     root            16 Dec 20 09:43 resolv.conf -> /tmp/resolv.conf
-rw-r--r--    1 root     root          3001 Mar 21  2011 services
-rw-r--r--    1 root     root           149 Jan  1  1970 shadow
-rw-r--r--    1 root     root           116 Dec 19 21:57 shadow-
-rw-r--r--    1 root     root             9 Mar 21  2011 shells
-rw-r--r--    1 root     root           976 Sep 19 05:24 sysctl.conf
-rw-r--r--    1 root     root           128 Mar 21  2011 sysupgrade.conf
drwxr-xr-x    2 root     root             0 Jan  1  1970 uci-defaults
root@OpenWrt:/etc# cd config
root@OpenWrt:/etc/config# ls
dhcp      dropbear  firewall  network   system    ubootenv  wireless
root@OpenWrt:/etc/config# ll
drwxr-xr-x    2 root     root             0 Jan  1  1970 .
drwxr-xr-x   13 root     root             0 Jan  1  1970 ..
-rw-r--r--    1 root     root           885 Dec 19 22:04 dhcp
-rw-r--r--    1 root     root           134 Dec 19 22:05 dropbear
-rw-r--r--    1 root     root          3631 Dec 19 22:06 firewall
-rw-r--r--    1 root     root           564 Jan  1  1970 network
-rw-r--r--    1 root     root           411 Jan  1  1970 system
-rw-r--r--    1 root     root             0 Jan  1  1970 ubootenv
-rw-r--r--    1 root     root           874 Jan  1  1970 wireless
root@OpenWrt:/etc/config# vi network

config 'interface' 'loopback'
        option 'ifname' 'lo'
        option 'proto' 'static'
        option 'ipaddr' '127.0.0.1'
        option 'netmask' '255.0.0.0'

config 'interface' 'lan'
        option 'ifname' 'eth0.1'
        option 'type' 'bridge'
        option 'proto' 'static'
        option 'ipaddr' '192.168.43.1'
        option 'netmask' '255.255.255.0'

config 'interface' 'wan'
        option 'ifname' 'eth1'
        option 'proto' 'dhcp'

config 'switch'
        option 'name' 'rtl8366s'
        option 'reset' '1'
        option 'enable_vlan' '1'

config 'switch_vlan'
        option 'device' 'rtl8366s'
        option 'vlan' '1'
        option 'ports' '0 1 2 3 5t'

~
root@OpenWrt:/etc/config# sync
root@OpenWrt:/etc/config# reboot
root@OpenWrt:/etc/config# 

공유기를 리부팅한 다음,
SSH 클라이언트를 이용하여, IP 주소 : 192.168.43.1로 다시 로그인해서, 변경된 네트워크 대역을 확인한다.

Connecting to 192.168.43.1:22...
Connection established.
Escape character is '^@]'.

sh: /usr/bin/X11/xauth: not found


BusyBox v1.19.3 (2011-12-19 15:01:26 MST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 ATTITUDE ADJUSTMENT (bleeding edge, r29570) ----------
  * 1/4 oz Vodka      Pour all ingredients into mixing
  * 1/4 oz Gin        tin with ice, strain into glass.
  * 1/4 oz Amaretto
  * 1/4 oz Triple sec
  * 1/4 oz Peach schnapps
  * 1/4 oz Sour mix
  * 1 splash Cranberry juice
 -----------------------------------------------------
root@OpenWrt:~# ifconfig
br-lan    Link encap:Ethernet  HWaddr 00:18:E7:DB:68:1E  
          inet addr:192.168.43.1  Bcast:192.168.43.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:360 errors:0 dropped:67 overruns:0 frame:0
          TX packets:88 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:27884 (27.2 KiB)  TX bytes:13178 (12.8 KiB)

eth0      Link encap:Ethernet  HWaddr 00:18:E7:DB:68:1E  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:432 errors:0 dropped:9 overruns:12 frame:0
          TX packets:103 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:40342 (39.3 KiB)  TX bytes:15765 (15.3 KiB)
          Interrupt:4 

eth0.1    Link encap:Ethernet  HWaddr 00:18:E7:DB:68:1E  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:382 errors:0 dropped:0 overruns:0 frame:0
          TX packets:94 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:31124 (30.3 KiB)  TX bytes:13574 (13.2 KiB)

eth1      Link encap:Ethernet  HWaddr 00:18:E7:DB:68:1F  
          inet addr:121.183.236.174  Bcast:121.183.236.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1222 errors:0 dropped:0 overruns:0 frame:0
          TX packets:109 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:81262 (79.3 KiB)  TX bytes:9851 (9.6 KiB)
          Interrupt:5 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:3038 (2.9 KiB)  TX bytes:3038 (2.9 KiB)

3) 패키지 목록 업데이트
추가 패키지 설치를 위한 패키지 목록을 업데이트한다.

root@OpenWrt:~# opkg update
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/Packages.gz.
Inflating http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/snapshots.

4) USB 장치 마운트용 패키지 설치
USB 메모리스틱이나 USB 하드디스크 등을 공유기 뒷면 패널의 USB 포트에 연결하여 사용할 수 있도록 하는 패키지들을 설치한다. 홈서버로 사용되는 공유기는 내부 메모리 용량이 매우 작기 때문에, USB 메모리스틱과 같은 장치를 이용해서 저장공간을 확장할 수 있다.

root@OpenWrt:~# opkg install fdisk kmod-fs-ext4 kmod-usb2 kmod-usb-storage kmod-usb-storage-extras block-mount hotplug2
Installing fdisk (2.13.0.1-4) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/fdisk_2.13.0.1-4_ar71xx.ipk.
Installing kmod-fs-ext4 (2.6.39.4-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-fs-ext4_2.6.39.4-1_ar71xx.ipk.
Installing kmod-lib-crc16 (2.6.39.4-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-lib-crc16_2.6.39.4-1_ar71xx.ipk.
Package kmod-usb2 (2.6.39.4-1) installed in root is up to date.
Installing kmod-usb-storage (2.6.39.4-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-usb-storage_2.6.39.4-1_ar71xx.ipk.
Installing kmod-scsi-core (2.6.39.4-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-scsi-core_2.6.39.4-1_ar71xx.ipk.
Installing kmod-usb-storage-extras (2.6.39.4-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-usb-storage-extras_2.6.39.4-1_ar71xx.ipk.
Installing block-mount (0.2.0-7) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/block-mount_0.2.0-7_ar71xx.ipk.
Installing blkid (1.41.12-2) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/blkid_1.41.12-2_ar71xx.ipk.
Installing libuuid (1.41.12-2) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/libuuid_1.41.12-2_ar71xx.ipk.
Installing libblkid (1.41.12-2) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/libblkid_1.41.12-2_ar71xx.ipk.
Installing libext2fs (1.41.12-2) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/libext2fs_1.41.12-2_ar71xx.ipk.
Installing libcom_err (1.41.12-2) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/libcom_err_1.41.12-2_ar71xx.ipk.
Installing libpthread (0.9.32-98) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/libpthread_0.9.32-98_ar71xx.ipk.
Installing swap-utils (2.13.0.1-4) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/swap-utils_2.13.0.1-4_ar71xx.ipk.
Package hotplug2 (1.0-beta-4) installed in root is up to date.
Configuring kmod-scsi-core.
Configuring kmod-usb-storage.
Configuring libpthread.
Configuring kmod-lib-crc16.
Configuring libcom_err.
Configuring libblkid.
Configuring libuuid.
Configuring libext2fs.
Configuring blkid.
Configuring swap-utils.
Configuring block-mount.
Configuring kmod-fs-ext4.
Configuring fdisk.
Configuring kmod-usb-storage-extras.
root@OpenWrt:~# sync

테스트로 1GB 용량의 USB 메모리스틱을 꽂고, 마운트가 정상적으로 되는지 확인한다.(USB 메모리스틱에는 Linux용의 파티션이 2개가 존재한다.)

root@OpenWrt:~# mount
rootfs on / type rootfs (rw)
/dev/root on / type jffs2 (rw,noatime)
proc on /proc type proc (rw,noatime)
sysfs on /sys type sysfs (rw,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime,size=30964k)
tmpfs on /dev type tmpfs (rw,noatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,noatime,mode=600)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
none on /proc/bus/usb type usbfs (rw,relatime)
root@OpenWrt:~# fdisk -l

Disk /dev/mtdblock0: 0 MB, 262144 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x19010010

Disk /dev/mtdblock0 doesn't contain a valid partition table
...
<중략>
...
Disk /dev/mtdblock6: 6 MB, 6356992 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x2b36ce10

Disk /dev/mtdblock6 doesn't contain a valid partition table

Disk /dev/sda: 1012 MB, 1012924416 bytes
32 heads, 61 sectors/track, 1013 cylinders
Units = cylinders of 1952 * 512 = 999424 bytes
Disk identifier: 0xb0bcd68e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         913      891057+  83  Linux
/dev/sda2             914        1013       97600   82  Linux swap / Solaris
root@OpenWrt:~# mount /dev/sda1 /mnt
root@OpenWrt:~# mount
rootfs on / type rootfs (rw)
/dev/root on / type jffs2 (rw,noatime)
proc on /proc type proc (rw,noatime)
sysfs on /sys type sysfs (rw,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime,size=30964k)
tmpfs on /dev type tmpfs (rw,noatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,noatime,mode=600)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
none on /proc/bus/usb type usbfs (rw,relatime)
/dev/sda1 on /mnt type ext2 (rw,relatime,user_xattr,barrier=1,data=ordered)

5) 홈서버의 동적 DNS 사용을 위한 설치 및 설정
동적 DNS 설정을 위해서 패키지를 설치하고, 설정한다.

root@OpenWrt:/mnt# opkg install ddns-scripts
Installing ddns-scripts (1.0.0-17) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/ddns-scripts_1.0.0-17_all.ipk.
Configuring ddns-scripts.
root@OpenWrt:/mnt# cd /etc/config
root@OpenWrt:/etc/config# mv ddns /root/
root@OpenWrt:/etc/config# vi ddns
config 'service' 'MyDDNS'
option 'force_unit' 'hours'
option 'enabled' '1'
option 'service_name' 'freedns.afraid.org'
option 'domain' '할당받은 도메인명'
option 'username' '사용자 ID'
option 'password' '도메인용 키 값'
option 'ip_source' 'network'
option 'ip_network' 'wan'
option 'check_interval' '1'
option 'check_unit' 'hours'
option 'force_interval' '72'
~
root@OpenWrt:/etc/config# sync

6) OpenVPN 설치 및 설정
OpenVPN 패키지를 설치하고, 설정한다.

root@OpenWrt:/etc/config# opkg install openvpn
Installing openvpn (2.2.1-4) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/openvpn_2.2.1-4_ar71xx.ipk.
Installing kmod-tun (2.6.39.4-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-tun_2.6.39.4-1_ar71xx.ipk.
Installing libopenssl (1.0.0e-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/libopenssl_1.0.0e-1_ar71xx.ipk.
Installing zlib (1.2.5-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/zlib_1.2.5-1_ar71xx.ipk.
Installing liblzo (2.05-1) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/liblzo_2.05-1_ar71xx.ipk.
Configuring kmod-tun.
Configuring zlib.
Configuring libopenssl.
Configuring liblzo.
Configuring openvpn.
root@OpenWrt:/etc/config# mv openvpn /root/
root@OpenWrt:/etc/config# vi openvpn
config 'openvpn' 'MyOpenVPNServer'
    option 'server' '10.100.200.0 255.255.255.0'
    option 'dev' 'tun0'
    option 'proto' 'tcp'
    option 'port' '1194'
    option 'keepalive' '10 120'
    option 'ca' '/etc/openvpn/ca.crt'
    option 'cert' '/etc/openvpn/server.crt'
    option 'key' '/etc/openvpn/server.key'
    option 'dh' '/etc/openvpn/dh1024.pem'
    option 'status' '/tmp/openvpn-status.log'
    option 'verb' '3'
    option 'enable' '1'
~
root@OpenWrt:/etc/config# sync

인증서 파일을 /etc/openvpn 디렉토리에 복사한다.

root@OpenWrt:/etc/openvpn# ll
drwxr-xr-x    2 root     root             0 Dec 27 02:13 .
drwxr-xr-x   14 root     root             0 Dec 27 02:10 ..
-rw-r-----    1 root     root          1346 Dec 27 02:13 ca.crt
-rw-r-----    1 root     root          1456 Dec 27 02:13 cert.pem
-rw-r-----    1 root     root           424 Dec 27 02:13 dh.pem
-rw-r-----    1 root     root           887 Dec 27 02:13 key.pem
root@OpenWrt:/etc/openvpn# sync

인증서 파일과 디렉토리는 접근권한을 잘 설정해준다.

root@OpenWrt:/etc/openvpn# chmod 600 *
root@OpenWrt:/etc/openvpn# ll
drwxr-xr-x    2 root     root             0 Dec 27 02:13 .
drwxr-xr-x   14 root     root             0 Dec 27 02:10 ..
-rw-------    1 root     root          1346 Dec 27 02:13 ca.crt
-rw-------    1 root     root          1456 Dec 27 02:13 cert.pem
-rw-------    1 root     root           424 Dec 27 02:13 dh.pem
-rw-------    1 root     root           887 Dec 27 02:13 key.pem
root@OpenWrt:/etc/openvpn# cd ..
root@OpenWrt:/etc# chmod 700 openvpn

7) OpenVPN을 위한 방화벽 설정 및 기본 방화벽 추가 설정
OpenVPN 방화벽 룰, 외부 인터넷망에서 SSH 접근 방화벽 룰과 외부 FTP 접근, PPTP 방화벽룰까지 포함한다.
그리고, VPN 접속시에 공유기 웹 인터페이스 접근도 추가(DIR-825는 웹 인터페이스가 없으므로, 필요없다.)

root@OpenWrt:/etc# vi firewall.user 
# This file is interpreted as shell script.
# Put your custom iptables rules here, they will
# be executed with each firewall (re-)start.
                                      
# OpenVPN Remote Access & Routing Rule           
iptables -I INPUT 1 -p udp --dport 1194 -j ACCEPT
iptables -I INPUT 1 -p tcp --dport 1194 -j ACCEPT       
iptables -I FORWARD 1 --source 10.100.200.0/24 -j ACCEPT  
iptables -I FORWARD -i eth0 -o tun0 -j ACCEPT
iptables -I FORWARD -i tun0 -o eth0 -j ACCEPT                          
iptables -t nat -A POSTROUTING -s 10.100.200.0/24 -o eth0 -j MASQUERADE   
                                                                          
# Allow SSH Remote Access                                 
iptables -A input_rule -i eth1 -p tcp --dport 22 -j ACCEPT
                                                          
# Allow FTP Remote Access                                 
#iptables -A input_rule -i eth1 -p tcp --dport 21 -j ACCEPT 
                                                          
# Allow VPN client's Web Interface Access              
iptables -I INPUT 1 -i tun0 -p tcp --dport 80 -j ACCEPT
                                                       
# PPTP Server Setting                            
iptables -I INPUT 1 -p tcp --dport 1723 -j ACCEPT
iptables -I INPUT 1 -p gre -j ACCEPT             
                                     
iptables -I INPUT 1 -i ppp+ -j ACCEPT
iptables -I FORWARD -i ppp+ -j ACCEPT
iptables -I FORWARD -o ppp+ -j ACCEPT 
iptables -I OUTPUT 1 -o ppp+ -j ACCEPT              
#iptables -A input_wan -p tcp --dport 1723 -j ACCEPT
#iptables -A input_wan -p gre -j ACCEPT             
                                         
#iptables -A input_rule -i ppp+ -j ACCEPT     
#iptables -A forwarding_rule -i ppp+ -j ACCEPT
#iptables -A forwarding_rule -o ppp+ -j ACCEPT
#iptables -A output_rule -o ppp+ -j ACCEPT    
~                                         
root@OpenWrt:/etc# sync

마지막으로 OpenVPN 서비스를 매 부팅때마다 자동실행되도록 설정하고, 바로 실행한다.

root@OpenWrt:/etc# sync
root@OpenWrt:/etc# /etc/init.d/openvpn enable
root@OpenWrt:/etc# /etc/init.d/openvpn start

OpenVPN 서비스의 실행여부는 ps 명령어로 확인가능하고, 동작에 따른 로그는 logread 명령어로 확인할 수 있다.

root@OpenWrt:/etc# ps elf
  PID USER       VSZ STAT COMMAND
    1 root      1480 S    init
    2 root         0 SW   [kthreadd]
    3 root         0 SW   [ksoftirqd/0]
    4 root         0 SW   [kworker/0:0]
    5 root         0 SW   [kworker/u:0]
    6 root         0 SW   [rcu_kthread]
    7 root         0 SW<  [khelper]
   54 root         0 SW   [sync_supers]
   56 root         0 SW   [bdi-default]
   58 root         0 SW<  [kblockd]
   88 root         0 SW   [kswapd0]
  135 root         0 SW   [fsnotify_mark]
  149 root         0 SW<  [ar71xx-spi]
  162 root         0 SW   [mtdblock0]
  167 root         0 SW   [mtdblock1]
  172 root         0 SW   [mtdblock2]
  177 root         0 SW   [mtdblock3]
  182 root         0 SW   [mtdblock4]
  187 root         0 SW   [mtdblock5]
  192 root         0 SW   [mtdblock6]
  335 root         0 SW   [kworker/0:1]
  522 root         0 SW<  [ipolldevd]
  566 root         0 SWN  [jffs2_gcd_mtd3]
  573 root      1480 S    init
  607 root         0 SW<  [cfg80211]
  619 root         0 SW   [khubd]
  690 root      1484 S    /sbin/syslogd -C16
  692 root      1464 S    /sbin/klogd
  694 root       804 S    /sbin/hotplug2 --override --persistent --set-worker
 1303 root      1132 S    /usr/sbin/dropbear -P /var/run/dropbear.1.pid -p 22
 1433 root      1484 S    /sbin/udhcpc -t 0 -i eth1 -b -p /var/run/dhcp-eth1.p
 1499 nobody     928 S    /usr/sbin/dnsmasq -K -D -y -Z -b -E -s lan -S /lan/
 1510 root      1476 S    /sbin/watchdog -t 5 /dev/watchdog
 1514 root      1480 S    /usr/sbin/ntpd -n -p 0.openwrt.pool.ntp.org -p 1.ope
 1517 root      1196 R    /usr/sbin/dropbear -P /var/run/dropbear.1.pid -p 22
 1518 root      1484 S    -ash
 1752 root         0 SW   [scsi_eh_0]
 1754 root         0 SW   [usb-storage]
 1761 root         0 SW   [kworker/u:2]
 1891 root         0 SW   [jbd2/sda1-8]
 1892 root         0 SW<  [ext4-dio-unwrit]
 2075 root         0 SW   [flush-mtd-unmap]
 2076 root         0 SW   [flush-8:0]
 2091 root      3064 S    /usr/sbin/openvpn --syslog openvpn(MyOpenVPNServer)
 2092 root       804 S    /sbin/hotplug2 --override --persistent --set-worker
 2105 root      1472 R    ps elf
root@OpenWrt:/etc# logread
...
Dec 27 02:26:22 OpenWrt daemon.notice openvpn(MyOpenVPNServer)[2091]: OpenVPN 2.2.1 mips-openwrt-linux [SSL] [LZO2] [EPOLL] built on Dec 19 2011
Dec 27 02:26:22 OpenWrt daemon.warn openvpn(MyOpenVPNServer)[2091]: NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Dec 27 02:26:23 OpenWrt daemon.notice openvpn(MyOpenVPNServer)[2091]: Diffie-Hellman initialized with 2048 bit key
Dec 27 02:26:23 OpenWrt daemon.notice openvpn(MyOpenVPNServer)[2091]: TLS-Auth MTU parms [ L:1543 D:140 EF:40 EB:0 ET:0 EL:0 ]
Dec 27 02:26:23 OpenWrt daemon.notice openvpn(MyOpenVPNServer)[2091]: Socket Buffers: R=[87380->131072] S=[16384->131072]
Dec 27 02:26:23 OpenWrt daemon.notice openvpn(MyOpenVPNServer)[2091]: TUN/TAP device tun0 opened
Dec 27 02:26:23 OpenWrt daemon.notice openvpn(MyOpenVPNServer)[2091]: TUN/TAP TX queue length set to 100
Dec 27 02:26:23 OpenWrt daemon.notice openvpn(MyOpenVPNServer)[2091]: /sbin/ifconfig tun0 10.100.200.1 pointopoint 10.100.200.2 mtu 1500
Dec 27 02:26:23 OpenWrt daemon.notice openvpn(MyOpenVPNServer)[2091]: /sbin/route add -net 10.100.200.0 netmask 255.255.255.0 gw 10.100.200.2
Dec 27 02:26:23 OpenWrt daemon.notice openvpn(MyOpenVPNServer)[2091]: Data Channel MTU parms [ L:1543 D:1450 EF:43 EB:4 ET:0 EL:0 ]
Dec 27 02:26:23 OpenWrt daemon.notice openvpn(MyOpenVPNServer)[2091]: Listening for incoming TCP connection on [undef]:1194
Dec 27 02:26:23 OpenWrt daemon.notice openvpn(MyOpenVPNServer)[2091]: TCPv4_SERVER link local (bound): [undef]:1194
Dec 27 02:26:23 OpenWrt daemon.notice openvpn(MyOpenVPNServer)[2091]: TCPv4_SERVER link remote: [undef]
Dec 27 02:26:23 OpenWrt daemon.notice openvpn(MyOpenVPNServer)[2091]: MULTI: multi_init called, r=256 v=256
Dec 27 02:26:23 OpenWrt daemon.notice openvpn(MyOpenVPNServer)[2091]: IFCONFIG POOL: base=10.100.200.4 size=62
Dec 27 02:26:23 OpenWrt daemon.notice openvpn(MyOpenVPNServer)[2091]: MULTI: TCP INIT maxclients=1024 maxevents=1028
Dec 27 02:26:23 OpenWrt daemon.notice openvpn(MyOpenVPNServer)[2091]: Initialization Sequence Completed
root@OpenWrt:/etc# 

7) lsof 패키지 설치
공유기의 프로세스 감시나 기타 설정등에 대한 정보를 자세히 알기 위해서는,
lsof 패키지를 설치하는 것이 좋다.

lsof 패키지를 설치한 다음에, 인터넷 열린 포트들에 대한 정보를 확인한다.

root@OpenWrt:/etc# opkg install lsof
Installing lsof (4.81-2) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/lsof_4.81-2_ar71xx.ipk.
Installing librpc (0.9.32-rc2-0a2179bbc0844928f2a0ec01dba93d9b5d6d41a7) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/librpc_0.9.32-rc2-0a2179bbc0844928f2a0ec01dba93d9b5d6d41a7_ar71xx.ipk.
Configuring librpc.
Configuring lsof.

root@OpenWrt:/etc# lsof -i
COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
dropbear 1303   root    3u  IPv4   1460      0t0  TCP *:ssh (LISTEN)
dnsmasq  1499 nobody    5u  IPv4   1566      0t0  UDP *:bootps 
dnsmasq  1499 nobody    6u  IPv4   1570      0t0  UDP *:domain 
dnsmasq  1499 nobody    7u  IPv4   1571      0t0  TCP *:domain (LISTEN)
dropbear 1517   root    7u  IPv4   1684      0t0  TCP localhost:6010 (LISTEN)
openvpn  2091   root    5u  IPv4   2476      0t0  TCP *:openvpn (LISTEN)

8) PPTP 서비스 설치
아이폰과 같은 스마트폰에서 VPN 사용을 위한 PPTP 서비스를 설치한다.
pptpd 패키지 뿐만 아니라, MPPE 지원도 설치해야 한다.
root@OpenWrt:/etc/config# opkg install kmod-mppe
Installing kmod-mppe (2.6.32.27-1) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/kmod-mppe_2.6.32.27-1_ar71xx.ipk.
Installing kmod-crypto-sha1 (2.6.32.27-1) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/kmod-crypto-sha1_2.6.32.27-1_ar71xx.ipk.
Configuring kmod-crypto-sha1.
Configuring kmod-mppe.
root@OpenWrt:/etc/config# opkg install pptpd    
Installing pptpd (1.3.4-2) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/pptpd_1.3.4-2_ar71xx.ipk.
Installing kmod-gre (2.6.32.27-1) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/kmod-gre_2.6.32.27-1_ar71xx.ipk.
Configuring kmod-gre.
Configuring pptpd.

PPTP와 관련된 설정파일은 사용자 ID와 패스워드 설정을 위해서 /etc/ppp/chap-secrets 파일과 서비스 dns 지정을 위한 /etc/ppp/options.pptpd 파일을 설정한다.

chap-secrets 파일에는 사용자명과 패스워드를 평문으로 입력한다.
PROVIDER는 아무 이름이나 지정하면 되고, IPADDRESS는 *를 지정한다.

root@OpenWrt:/etc/ppp# vi chap-secrets 
#USERNAME  PROVIDER  PASSWORD  IPADDRESS
pptp_user1    pptp-server     user-pw1        *
pptp_user2    pptp-server     user-pw2        *
~

options.pptpd 파일내에 있는 주석처리된 ms-dns 항목에 공유기의 IP 주소, 여기 예제에서는 192.168.43.1을 지정해서 추가한다.

root@OpenWrt:/etc/ppp# vi options.pptpd
#debug
#logfile /tmp/pptp-server.log
172.16.1.1:
auth
name "pptp-server"
lcp-echo-failure 3
lcp-echo-interval 60
default-asyncmap
mtu 1482
mru 1482
nobsdcomp
nodeflate
#noproxyarp
#nomppc
mppe required,no40,no56,stateless
require-mschap-v2
refuse-chap
refuse-mschap
refuse-eap
refuse-pap
ms-dns 192.168.43.1
#plugin radius.so
#radius-config-file /etc/radius.conf
~
root@OpenWrt:/etc/ppp# sync

PPTP 서비스를 매 부팅때마다 자동실행되도록 설정하고, 바로 실행한다.
root@OpenWrt:/etc/ppp# /etc/init.d/pptpd enable
root@OpenWrt:/etc/ppp# /etc/init.d/pptpd start

9) FTP 와 SFTP 서비스 설치
추가적으로 vsftpd 와 openssh-sftp-server 를 설치한다.
FTP 서버와 SFTP 접속을 가능하도록 한다.

root@OpenWrt:/etc# opkg install vsftpd
Installing vsftpd (2.3.4-3) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/vsftpd_2.3.4-3_ar71xx.ipk.
Configuring vsftpd.

root@OpenWrt:/etc# opkg install openssh-sftp-server
Installing openssh-sftp-server (5.9p1-4) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/openssh-sftp-server_5.9p1-4_ar71xx.ipk.
Configuring openssh-sftp-server.
root@OpenWrt:/etc# opkg files openssh-sftp-server
Package openssh-sftp-server (5.9p1-4) is installed on root and has the following files:
/usr/libexec/sftp-server
/usr/lib/sftp-server
 
FTP 설정은 /etc/vsftpd.conf 파일에서 한다.
root@MyRouter:~# cat /etc/vsftpd.conf 
background=YES
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
check_shell=NO
#chroot settings
chroot_local_user=NO
#passwd_chroot_enable=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
#dirmessage_enable=YES
ftpd_banner=FTP Server
session_support=NO
#syslog_enable=YES
#userlist_enable=YES
#userlist_deny=NO
#userlist_file=/etc/vsftpd.users
#xferlog_enable=YES
#xferlog_file=/var/log/vsftpd.log
#xferlog_std_format=YES
root@MyRouter:~# 

ftp 사용자들은 chroot로 접근제어를 걸어준다.
그 사용자들의 목록은 /etc/vsftpd/chroot_list 적는다.
ftp 사용자들이 ftp로 공유기에 있는 중요 설정파일들을 모두 볼 수 있으므로, 반드시 chroot가 필요하다.(패스워드 해킹도 가능)

root@MyRouter:~# cat /etc/vsftpd/chroot_list 
ftp
root@MyRouter:~#  

ftp 사용자들의 계정은 /etc/passwd 에 수록한다. (버팔로 제품은 /etc/passwd 파일만이 존재하지만, DIR-825는 passwd와 shadow 파일이 존재한다. DIR-825에서는 계정정보를 /etc/passwd와 /etc/shadow 파일 모두에 적어주어야 한다.)
root@MyRouter:~# cat /etc/passwd
...
ftp:$1$agmhQqLM$0CjSWAbJnK4gWIyIwC03i.:55:55:ftp:/home/ftp:/bin/false
root@MyRouter:~#   

패스워드 필드를 비워둔 상태에서 생성하고, root가 passwd 명령어로 패스워드를 넣어주면 된다.
ftp 사용자들이 shell 접속(ssh와 sftp)이 불가하도록, /bin/false를 쉘로 지정해둔다.

root@OpenWrt:~# cd /etc/
root@OpenWrt:/etc# ll
drwxr-xr-x   17 root     root          4096 Dec 29 00:35 .
drwxr-xr-x   17 root     root          4096 Dec 29 00:34 ..
lrwxrwxrwx    1 root     root             7 Dec 27 05:56 TZ -> /tmp/TZ
drwxr-xr-x    3 root     root          4096 Dec 27 07:27 apache
-rw-r--r--    1 root     root           589 Dec 19 21:57 banner
-rw-r--r--    1 root     root           232 Dec 27 08:53 blkid.tab
-rw-r--r--    1 root     root           232 Dec 27 08:46 blkid.tab.old
drwxr-xr-x    2 root     root          4096 Dec 27 05:56 config
drwxr-xr-x    2 root     root          4096 Dec 19 21:57 crontabs
drwxr-xr-x    4 root     root          4096 Dec 27 05:56 defconfig
-rwxr-xr-x    1 root     root          2671 Dec 19 21:02 diag.sh
-rw-r--r--    1 root     root          1368 Dec 19 22:04 dnsmasq.conf
drwx------    2 root     root          4096 Dec 27 05:56 dropbear
-rw-r--r--    1 root     root            38 Dec 19 21:58 e2fsck.conf
-rw-r--r--    1 root     root             0 Jan  1  1970 ethers
-rw-r--r--    1 root     root          1460 Dec 27 07:34 firewall.user
lrwxrwxrwx    1 root     root            10 Dec 27 05:56 fstab -> /tmp/fstab
lrwxrwxrwx    1 root     root            19 Dec 27 05:56 functions.sh -> ../lib/functions.sh
-rw-r--r--    1 root     root            78 Jan  1  1970 fw_env.config
-rw-r--r--    1 root     root           123 Mar 21  2011 group
-rw-r--r--    1 root     root            20 Mar 21  2011 hosts
drwx------    9 root     root          4096 Dec 27 05:56 hotplug.d
-rw-r--r--    1 root     root          1201 Nov  5 23:38 hotplug2-common.rules
-rw-r--r--    1 root     root            80 Mar 21  2011 hotplug2-init.rules
-rw-r--r--    1 root     root           242 Dec 20 09:26 hotplug2.rules
drwxr-xr-x    2 root     root          4096 Dec 28 08:11 init.d
-rw-r--r--    1 root     root           104 Jan  1  1970 inittab
drwxr-xr-x    2 root     root          4096 Dec 27 07:29 lighttpd
drwxr-xr-x    2 root     root          4096 Dec 27 05:56 modules-boot.d
drwxr-xr-x    2 root     root          4096 Dec 27 05:56 modules.d
lrwxrwxrwx    1 root     root            12 Dec 27 05:56 mtab -> /proc/mounts
drwx------    2 root     root          4096 Dec 27 05:56 openvpn
-rw-r--r--    1 root     root           163 Dec 20 09:14 opkg.conf
-rw-r--r--    1 root     root           190 Dec 29 00:35 passwd
-rw-r--r--    1 root     root           190 Jan  1  1970 passwd-
drwxr-xr-x    4 root     root          4096 Dec 27 05:56 ppp
-rw-r--r--    1 root     root           128 Dec 20 07:12 pptpd.conf
-rwxr-xr-x    1 root     root           888 Jul 23 18:38 preinit
-rw-r--r--    1 root     root           518 Dec 27 02:21 profile
-rw-r--r--    1 root     root          2478 Mar 21  2011 protocols
-rwxr-xr-x    1 root     root          1490 Nov  9 21:52 rc.common
drwxr-xr-x    2 root     root          4096 Dec 27 08:30 rc.d
-rw-r--r--    1 root     root           132 Mar 21  2011 rc.local
lrwxrwxrwx    1 root     root            16 Dec 27 05:56 resolv.conf -> /tmp/resolv.conf
-rw-r--r--    1 root     root          3001 Mar 21  2011 services
-rw-r--r--    1 root     root           186 Dec 29 00:35 shadow
-rw-r--r--    1 root     root           149 Jan  1  1970 shadow-
-rw-r--r--    1 root     root             9 Mar 21  2011 shells
-rw-r--r--    1 root     root           976 Sep 19 05:24 sysctl.conf
-rw-r--r--    1 root     root           128 Mar 21  2011 sysupgrade.conf
drwxr-xr-x    2 root     root          4096 Jan  1  1970 uci-defaults
drwxr-xr-x    2 root     root          4096 Dec 29 00:33 vsftpd
-rw-r--r--    1 root     root           488 Dec 29 00:33 vsftpd.conf
 
root@OpenWrt:/etc# cat /etc/passwd
root:x:0:0:root:/root:/bin/ash
daemon:*:1:1:daemon:/var:/bin/false
ftp:x:55:55:ftp:/home/ftp:/bin/false
network:*:101:101:network:/var:/bin/false
nobody:*:65534:65534:nobody:/var:/bin/false
 
root@OpenWrt:/etc# cat /etc/shadow
root:$1$kzAg4U0J$F27Nb/oEdcgd7lU3xffGdi/:0:0:99999:7:::
daemon:*:0:0:99999:7:::
ftp:$1$Wp92U.qZ$j9zEwEQ0q6eEt/Sl45XJz1:15337:0:99999:7:::
network:*:0:0:99999:7:::
nobody:*:0:0:99999:7:::
root@OpenWrt:/etc# 

10) ntp를 이용한 라우터의 시간 맞추기
/etc/TZ에 설정된 UTC 시간을 GMT-9 Seoul 시간으로  변경한다.

root@OpenWrt:~# cat /etc/TZ
UTC
root@OpenWrt:~# date
Thu Dec 29 05:25:50 UTC 2011
root@OpenWrt:~# echo GMT-09 > /etc/TZ
root@OpenWrt:~# cat /etc/TZ
GMT-09 
root@OpenWrt:~# date
Thu Dec 29 14:26:15 GMT 2011

영구적인 변경을 위해서는, /etc/config/system 설정파일을 다음과 같이 변경한다.
time server들을 아래와 같이 설정하면 된다.
 
root@OpenWrt:~# cd /etc/
root@OpenWrt:/etc# cd config
root@OpenWrt:/etc/config# vi system

config 'system'
        option 'hostname' 'OpenWrt'
        option 'timezone' 'GMT-9' 

config 'timeserver' 'ntp'
        list 'server' 'time.kriss.re.kr'
        list 'server' '3.kr.pool.ntp.org'
        list 'server' '3.asia.pool.ntp.org'
        list 'server' '0.asia.pool.ntp.org'
        list 'server' '0.openwrt.pool.ntp.org'
        list 'server' '1.openwrt.pool.ntp.org'
        list 'server' '2.openwrt.pool.ntp.org'
        list 'server' '3.openwrt.pool.ntp.org'

...
<중략>
...
------------------------------------------------------------

추가적으로 ssh 포트번호를 8080번으로 변경하고,
방화벽에서 8080번을 외부접속 가능하도록 풀어주면, 완벽할 것으로 예상.

Posted by 훅크선장
, |

###############################################
# Sample OpenVPN 2.0 uci config for             #
# multi-client server.                          #
#################################################

config openvpn sample_server

        # Set to 1 to enable this instance:
        option enable 1

        # Which local IP address should OpenVPN
        # listen on? (optional)
#       option local 0.0.0.0

        # Which TCP/UDP port should OpenVPN listen on?
        # If you want to run multiple OpenVPN instances
        # on the same machine, use a different port
        # number for each one.  You will need to
        # open up this port on your firewall.
        option port 1194

        # TCP or UDP server?
        option proto tcp

        option route_up /etc/openvpn/server.up
        
        # "dev tun" will create a routed IP tunnel,
        # "dev tap" will create an ethernet tunnel.
        # Use "dev tap0" if you are ethernet bridging
        # and have precreated a tap0 virtual interface
        # and bridged it with your ethernet interface.
        # If you want to control access policies
        # over the VPN, you must create firewall
        # rules for the the TUN/TAP interface.
        # On non-Windows systems, you can give
        # an explicit unit number, such as tun0.
        # On Windows, use "dev-node" for this.
        # On most systems, the VPN will not function
        # unless you partially or fully disable
        # the firewall for the TUN/TAP interface.
        option dev tun

        # SSL/TLS root certificate (ca), certificate
        # (cert), and private key (key).  Each client
        # and the server must have their own cert and
        # key file.  The server and all clients will
        # use the same ca file.
        #
        # See the "easy-rsa" directory for a series
        # of scripts for generating RSA certificates
        # and private keys.  Remember to use
        # a unique Common Name for the server
        # and each of the client certificates.
        #
        # Any X509 key management system can be used.
        # OpenVPN can also use a PKCS #12 formatted key file
        # (see "pkcs12" directive in man page).
        option ca /etc/easy-rsa/keys/ca.crt
        option cert /etc/easy-rsa/keys/mail.crt
        # This file should be kept secret:
        option key /etc/easy-rsa/keys/mail.key

        # Diffie hellman parameters.
        # Generate your own with:
        #   openssl dhparam -out dh1024.pem 1024
        # Substitute 2048 for 1024 if you are using
        # 2048 bit keys.
        option dh /etc/easy-rsa/keys/dh1024.pem

        # Configure server mode and supply a VPN subnet
        # for OpenVPN to draw client addresses from.
        # The server will take 10.8.0.1 for itself,
        # the rest will be made available to clients.
        # Each client will be able to reach the server
        # on 10.8.0.1. Comment this line out if you are
        # ethernet bridging. See the man page for more info.
        option server "10.8.0.0 255.255.255.0"

        # Maintain a record of client <-> virtual IP address
        # associations in this file.  If OpenVPN goes down or
        # is restarted, reconnecting clients can be assigned
        # the same virtual IP address from the pool that was
        # previously assigned.
        option ifconfig_pool_persist /etc/openvpn/ipp.txt

        # Configure server mode for ethernet bridging.
        # You must first use your OS's bridging capability
        # to bridge the TAP interface with the ethernet
        # NIC interface.  Then you must manually set the
        # IP/netmask on the bridge interface, here we
        # assume 10.8.0.4/255.255.255.0.  Finally we
        # must set aside an IP range in this subnet
        # (start=10.8.0.50 end=10.8.0.100) to allocate
        # to connecting clients.  Leave this line commented
        # out unless you are ethernet bridging.
#       option server_bridge "10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100"

        # Push routes to the client to allow it
        # to reach other private subnets behind
        # the server.  Remember that these
        # private subnets will also need
        # to know to route the OpenVPN client
        # address pool (10.8.0.0/255.255.255.0)
        # back to the OpenVPN server.
        list push "route 10.0.0.0 255.255.255.0"
    #PUSH
    
    
        # To assign specific IP addresses to specific
        # clients or if a connecting client has a private
        # subnet behind it that should also have VPN access,
        # use the subdirectory "ccd" for client-specific
        # configuration files (see man page for more info).

        # EXAMPLE: Suppose the client
        # having the certificate common name "Thelonious"
        # also has a small subnet behind his connecting
        # machine, such as 192.168.40.128/255.255.255.248.
        # First, uncomment out these lines:
       option client_config_dir /etc/openvpn/ccd
       list route "192.168.2.0 255.255.255.0"
        # Then create a file ccd/Thelonious with this line:
        #   iroute 192.168.40.128 255.255.255.248
        # This will allow Thelonious' private subnet to
        # access the VPN.  This example will only work
        # if you are routing, not bridging, i.e. you are
        # using "dev tun" and "server" directives.

        # EXAMPLE: Suppose you want to give
        # Thelonious a fixed VPN IP address of 10.9.0.1.
        # First uncomment out these lines:
#       option client_config_dir /etc/openvpn/ccd
#       list route "10.9.0.0 255.255.255.252"
#       list route "192.168.100.0 255.255.255.0"
        # Then add this line to ccd/Thelonious:
        #   ifconfig-push "10.9.0.1 10.9.0.2"

        # Suppose that you want to enable different
        # firewall access policies for different groups
        # of clients.  There are two methods:
        # (1) Run multiple OpenVPN daemons, one for each
        #     group, and firewall the TUN/TAP interface
        #     for each group/daemon appropriately.
        # (2) (Advanced) Create a script to dynamically
        #     modify the firewall in response to access
        #     from different clients.  See man
        #     page for more info on learn-address script.
#       option learn_address /etc/openvpn/script

        # If enabled, this directive will configure
        # all clients to redirect their default
        # network gateway through the VPN, causing
        # all IP traffic such as web browsing and
        # and DNS lookups to go through the VPN
        # (The OpenVPN server machine may need to NAT
        # the TUN/TAP interface to the internet in
        # order for this to work properly).
        # CAVEAT: May break client's network config if
        # client's local DHCP server packets get routed
        # through the tunnel.  Solution: make sure
        # client's local DHCP server is reachable via
        # a more specific route than the default route
        # of 0.0.0.0/0.0.0.0.
#       list push "redirect-gateway"

        # Certain Windows-specific network settings
        # can be pushed to clients, such as DNS
        # or WINS server addresses.  CAVEAT:
        # http://openvpn.net/faq.html#dhcpcaveats
#       list push "dhcp-option DNS 10.8.0.1"
#       list push "dhcp-option WINS 10.8.0.1"

        # Uncomment this directive to allow different
        # clients to be able to "see" each other.
        # By default, clients will only see the server.
        # To force clients to only see the server, you
        # will also need to appropriately firewall the
        # server's TUN/TAP interface.
       option client_to_client 1

        # Uncomment this directive if multiple clients
        # might connect with the same certificate/key
        # files or common names.  This is recommended
        # only for testing purposes.  For production use,
        # each client should have its own certificate/key
        # pair.
        #
        # IF YOU HAVE NOT GENERATED INDIVIDUAL
        # CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
        # EACH HAVING ITS OWN UNIQUE "COMMON NAME",
        # UNCOMMENT THIS LINE OUT.
#       option duplicate_cn 1

        # The keepalive directive causes ping-like
        # messages to be sent back and forth over
        # the link so that each side knows when
        # the other side has gone down.
        # Ping every 10 seconds, assume that remote
        # peer is down if no ping received during
        # a 120 second time period.
        option keepalive "10 120"

        # For extra security beyond that provided
        # by SSL/TLS, create an "HMAC firewall"
        # to help block DoS attacks and UDP port flooding.
        #
        # Generate with:
        #   openvpn --genkey --secret ta.key
        #
        # The server and each client must have
        # a copy of this key.
        # The second parameter should be '0'
        # on the server and '1' on the clients.
        # This file is secret:
#       option tls_auth "/etc/openvpn/ta.key 0"

        # Select a cryptographic cipher.
        # This config item must be copied to
        # the client config file as well.
        # Blowfish (default):
       option cipher BF-CBC
        # AES:
#       option cipher AES-128-CBC
        # Triple-DES:
#       option cipher DES-EDE3-CBC

        # Enable compression on the VPN link.
        # If you enable it here, you must also
        # enable it in the client config file.
        option comp_lzo 1

        # The maximum number of concurrently connected
        # clients we want to allow.
#       option max_clients 100

        # The persist options will try to avoid
        # accessing certain resources on restart
        # that may no longer be accessible because
        # of the privilege downgrade.
        option persist_key 1
#        option persist_tun 1

        # Output a short status file showing
        # current connections, truncated
        # and rewritten every minute.
        option status /tmp/openvpn-status.log

        # By default, log messages will go to the syslog (or
        # on Windows, if running as a service, they will go to
        # the "\Program Files\OpenVPN\log" directory).
        # Use log or log-append to override this default.
        # "log" will truncate the log file on OpenVPN startup,
        # while "log-append" will append to it.  Use one
        # or the other (but not both).
#       option log         /tmp/openvpn.log
#       option log_append  /tmp/openvpn.log

        # Set the appropriate level of log
        # file verbosity.
        #
        # 0 is silent, except for fatal errors
        # 4 is reasonable for general usage
        # 5 and 6 can help to debug connection problems
        # 9 is extremely verbose
        option verb 4

        # Silence repeating messages.  At most 20
        # sequential messages of the same message
        # category will be output to the log.
#       option mute 20

Posted by 훅크선장
, |
1. USB 메모리스틱의 파티션 생성
usb 메모리스틱을 openwrt에 꽂은 후의 로그는 다음과 같이 인식되어야 한다.

root@OpenWrt:/etc# logread
...
Dec 27 05:32:27 OpenWrt kern.info kernel: [ 2178.370000] usb 1-2: new high speed USB device number 3 using ar71xx-ehci
Dec 27 05:32:27 OpenWrt kern.info kernel: [ 2178.530000] scsi1 : usb-storage 1-2:1.0
Dec 27 05:32:28 OpenWrt kern.notice kernel: [ 2179.530000] scsi 1:0:0:0: Direct-Access     Generic  Flash Disk       8.07 PQ: 0 ANSI: 2
Dec 27 05:32:28 OpenWrt kern.notice kernel: [ 2179.540000] sd 1:0:0:0: [sda] 1978368 512-byte logical blocks: (1.01 GB/966 MiB)
Dec 27 05:32:28 OpenWrt kern.notice kernel: [ 2179.550000] sd 1:0:0:0: [sda] Write Protect is off
Dec 27 05:32:28 OpenWrt kern.debug kernel: [ 2179.550000] sd 1:0:0:0: [sda] Mode Sense: 03 00 00 00
Dec 27 05:32:28 OpenWrt kern.err kernel: [ 2179.550000] sd 1:0:0:0: [sda] Assuming drive cache: write through
Dec 27 05:32:28 OpenWrt kern.err kernel: [ 2179.560000] sd 1:0:0:0: [sda] Assuming drive cache: write through
Dec 27 05:32:29 OpenWrt kern.info kernel: [ 2179.860000]  sda:
Dec 27 05:32:29 OpenWrt kern.err kernel: [ 2179.860000] sd 1:0:0:0: [sda] Assuming drive cache: write through
Dec 27 05:32:29 OpenWrt kern.notice kernel: [ 2179.870000] sd 1:0:0:0: [sda] Attached SCSI removable disk

usb 메모리스틱은 /dev/sda 라는 디바이스명으로 인식되었다.

해당 디바이스의 파티션을 확인한다.

root@OpenWrt:/etc# fdisk -l /dev/sda

Disk /dev/sda: 1012 MB, 1012924416 bytes
32 heads, 61 sectors/track, 1013 cylinders
Units = cylinders of 1952 * 512 = 999424 bytes
Disk identifier: 0xb0bcd68e

   Device Boot      Start         End      Blocks   Id  System
root@OpenWrt:/etc# 

디스크 확장을 위한 공간을 생성한다.
스왑공간도 생성한다.

root@OpenWrt:/etc# fdisk  /dev/sda

Command (m for help): p

Disk /dev/sda: 1012 MB, 1012924416 bytes
32 heads, 61 sectors/track, 1013 cylinders
Units = cylinders of 1952 * 512 = 999424 bytes
Disk identifier: 0xb0bcd68e

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1013, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1013, default 1013): 913

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (914-1013, default 914): 
Using default value 914
Last cylinder or +size or +sizeM or +sizeK (914-1013, default 1013): 
Using default value 1013

Command (m for help): p

Disk /dev/sda: 1012 MB, 1012924416 bytes
32 heads, 61 sectors/track, 1013 cylinders
Units = cylinders of 1952 * 512 = 999424 bytes
Disk identifier: 0xb0bcd68e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         913      891057+  83  Linux
/dev/sda2             914        1013       97600   83  Linux

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 82
Changed system type of partition 2 to 82 (Linux swap / Solaris)

Command (m for help): p

Disk /dev/sda: 1012 MB, 1012924416 bytes
32 heads, 61 sectors/track, 1013 cylinders
Units = cylinders of 1952 * 512 = 999424 bytes
Disk identifier: 0xb0bcd68e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         913      891057+  83  Linux
/dev/sda2             914        1013       97600   82  Linux swap / Solaris

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
root@OpenWrt:/etc# fdisk -l /dev/sda

Disk /dev/sda: 1012 MB, 1012924416 bytes
32 heads, 61 sectors/track, 1013 cylinders
Units = cylinders of 1952 * 512 = 999424 bytes
Disk identifier: 0xb0bcd68e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         913      891057+  83  Linux
/dev/sda2             914        1013       97600   82  Linux swap / Solaris
root@OpenWrt:/etc# 

2. 파티션에 리눅스 파일시스템 생성
스왑공간을 활성화하고, 파티션에 리눅스 파일시스템을 생성한다.

먼저 리눅스 파일시스템 생성을 위한 프로그램을 설치해야 한다.

root@OpenWrt:/etc# opkg list-installed|grep fs
kmod-fs-ext4 - 2.6.39.4-1
libext2fs - 1.41.12-2
root@OpenWrt:/etc# opkg install e2fsprogs
Installing e2fsprogs (1.41.12-2) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/e2fsprogs_1.41.12-2_ar71xx.ipk.
Configuring e2fsprogs.
root@OpenWrt:/etc# sync
root@OpenWrt:/etc# opkg files e2fsprogs
Package e2fsprogs (1.41.12-2) is installed on root and has the following files:
/usr/sbin/mkfs.ext2
/usr/sbin/mkfs.ext3
/usr/sbin/mkfs.ext4
/usr/lib/libe2p.so.2
/lib/functions/fsck/e2fsck.sh
/usr/sbin/e2fsck
/etc/e2fsck.conf
/usr/sbin/mke2fs
/usr/lib/libe2p.so.2.3
root@OpenWrt:/etc# 

리눅스 파일시스템을 생성한다.

root@OpenWrt:/etc# mkfs.ext4 /dev/sda1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
55776 inodes, 222764 blocks
11138 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=230686720
7 block groups
32768 blocks per group, 32768 fragments per group
7968 inodes per group
Superblock backups stored on blocks: 
32768, 98304, 163840

Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

3. 파일시스템 마운트와 운영체제 파일 복사
usb 메모리스틱에 파일시스템이 정상적으로 생성되었는지를 확인한다.
스왑영역을 활성화하고,

/mnt/root 라는 디렉토리를 만들어서, 그곳에 새로운 파일시스템 공간을 마운트시킨다.

root@OpenWrt:/etc# swapon /dev/sda2
root@OpenWrt:/etc# mount
rootfs on / type rootfs (rw)
/dev/root on / type jffs2 (rw,noatime)
proc on /proc type proc (rw,noatime)
sysfs on /sys type sysfs (rw,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime,size=30964k)
tmpfs on /dev type tmpfs (rw,noatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,noatime,mode=600)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
none on /proc/bus/usb type usbfs (rw,relatime)
root@OpenWrt:/etc# ll /mnt
drwxr-xr-x    2 root     root             0 Dec 19 21:57 .
drwxr-xr-x   17 root     root             0 Jan  1  1970 ..
root@OpenWrt:/etc# mkdir -p /mnt/root/
root@OpenWrt:/etc# ll /mnt
drwxr-xr-x    3 root     root             0 Dec 27 05:52 .
drwxr-xr-x   17 root     root             0 Jan  1  1970 ..
drwxr-xr-x    2 root     root             0 Dec 27 05:52 root
root@OpenWrt:/etc# mount -t ext4 /dev/sda1 /mnt/root
root@OpenWrt:/etc# mount
rootfs on / type rootfs (rw)
/dev/root on / type jffs2 (rw,noatime)
proc on /proc type proc (rw,noatime)
sysfs on /sys type sysfs (rw,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime,size=30964k)
tmpfs on /dev type tmpfs (rw,noatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,noatime,mode=600)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
none on /proc/bus/usb type usbfs (rw,relatime)
/dev/sda1 on /mnt/root type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)

기존의 파일시스템을 확장된 디스크 영역으로 복사한다.

root@OpenWrt:~# cd /mnt
root@OpenWrt:/mnt# ll
drwxr-xr-x    3 root     root             0 Dec 27 05:52 .
drwxr-xr-x   17 root     root             0 Jan  1  1970 ..
drwxr-xr-x    3 root     root          4096 Dec 27 05:45 root
root@OpenWrt:/mnt#  tar cvO -C / bin/ etc/ root/ lib/ sbin/ usr/ www/ var/ | tar x -C /mnt/root
bin/
bin/dd
bin/cp
bin/df
bin/ln
bin/ls
bin/mv
bin/ps
bin/rm
bin/sh
bin/vi

... 중략 ...

usr/sbin/chroot
usr/sbin/mkfs.ext2
usr/sbin/mkfs.ext3
usr/sbin/mkfs.ext4
usr/sbin/iwlist
usr/sbin/iwpriv
usr/sbin/pptpctrl
usr/sbin/mke2fs
usr/sbin/fw_printenv
usr/sbin/bcrelay
usr/sbin/openvpn
usr/sbin/wpa_supplicant
usr/share/
usr/share/udhcpc/
usr/share/udhcpc/default.script
www/
var
root@OpenWrt:/mnt# mkdir -p /mnt/root/tmp && mkdir -p /mnt/root/dev && mkdir -p /mnt/root/proc && mkdir -p /mnt
/root/jffs && mkdir -p /mnt/root/mnt/openwrt && mkdir -p /mnt/root/sys
root@OpenWrt:/mnt# ll
drwxr-xr-x    3 root     root             0 Dec 27 05:52 .
drwxr-xr-x   17 root     root             0 Jan  1  1970 ..
drwxr-xr-x   16 root     root          4096 Dec 27 05:57 root
root@OpenWrt:/mnt# ll ./root/
drwxr-xr-x   16 root     root          4096 Dec 27 05:57 .
drwxr-xr-x    3 root     root             0 Dec 27 05:52 ..
drwxr-xr-x    2 root     root          4096 Dec 27 05:56 bin
drwxr-xr-x    2 root     root          4096 Dec 27 05:57 dev
drwxr-xr-x   14 root     root          4096 Dec 27 05:56 etc
drwxr-xr-x    2 root     root          4096 Dec 27 05:57 jffs
drwxr-xr-x   12 root     root          4096 Dec 27 05:56 lib
drwx------    2 root     root         16384 Dec 27 05:45 lost+found
drwxr-xr-x    3 root     root          4096 Dec 27 05:57 mnt
drwxr-xr-x    2 root     root          4096 Dec 27 05:57 proc
drwxr-xr-x    2 root     root          4096 Dec 27 05:56 root
drwxr-xr-x    2 root     root          4096 Dec 27 05:56 sbin
drwxr-xr-x    2 root     root          4096 Dec 27 05:57 sys
drwxr-xr-x    2 root     root          4096 Dec 27 05:57 tmp
drwxr-xr-x    6 root     root          4096 Dec 27 05:56 usr
lrwxrwxrwx    1 root     root             4 Dec 27 05:56 var -> /tmp
drwxr-xr-x    2 root     root          4096 Dec 19 21:57 www
root@OpenWrt:/mnt# 

4. 부팅 스크립트 수정
다음으로, 부팅스트립트 조정하기
/etc/init.d/rcS 스크립트에 루트 파일시스템을 변경하는 내용 추가

root@OpenWrt:/etc# cd /etc/init.d
root@OpenWrt:/etc/init.d# ll
drwxr-xr-x    2 root     root             0 Dec 19 21:58 .
drwxr-xr-x   14 root     root             0 Dec 27 05:44 ..
-rwxr-xr-x    1 root     root          3263 Nov 18 00:28 boot
-rwxr-xr-x    1 root     root           385 Dec 19 22:02 cron
-rwxr-xr-x    1 root     root           318 Nov  9 21:52 defconfig
-rwxr-xr-x    1 root     root         10032 Dec 19 22:04 dnsmasq
-rwxr-xr-x    1 root     root           318 Mar 21  2011 done
-rwxr-xr-x    1 root     root          4367 Dec 19 22:05 dropbear
-rwxr-xr-x    1 root     root           233 Dec 19 22:06 firewall
-rwxr-xr-x    1 root     root          2004 Dec 19 22:01 fstab
-rwxr-xr-x    1 root     root          1570 Mar 21  2011 led
-rwxr-xr-x    1 root     root           641 Nov  5 23:38 network
-rwxr-xr-x    1 root     root          4657 Dec 19 22:14 openvpn
-rwxr-xr-x    1 root     root           375 Dec 20 07:12 pptpd
-rwxr-xr-x    1 root     root           454 Mar 21  2011 rcS
-rwxr-xr-x    1 root     root           126 Mar 21  2011 sysctl
-rwxr-xr-x    1 root     root           505 Nov  9 21:52 sysntpd
-rwxr-xr-x    1 root     root           878 Dec 19 22:02 telnet
-rwxr-xr-x    1 root     root           673 Dec 20 09:34 uboot-envtools
-rwxr-xr-x    1 root     root            99 Mar 21  2011 umount
-rwxr-xr-x    1 root     root           154 Mar 21  2011 usb
-rwxr-xr-x    1 root     root           244 Nov  9 21:52 watchdog
root@OpenWrt:/etc/init.d# vi rcS
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org

run_scripts() {
        for i in /etc/rc.d/$1*; do
                [ -x $i ] && $i $2 2>&1
        done | $LOGGER
}

system_config() {
        config_get_bool foreground $1 foreground 0
}

LOGGER="cat"
[ -x /usr/bin/logger ] && LOGGER="logger -s -p 6 -t sysinit"

#--------------------------------------------------------------------                                 
# Switch to pivoroot if available
#                                                        
if [ "$2" == "boot" -a -x /etc/init.d/pivotroot ] ; then            
      echo "[`date`]: Pivot root log created." > /tmp/pivotroot.log 
      /etc/init.d/pivotroot >> /tmp/pivotroot.log 
fi                                             
#--------------------------------------------------------------------
                                   
. /etc/functions.sh                            
                                               
config_load system                 
config_foreach system_config system            
                                               
if [ "$1" = "S" -a "$foreground" != "1" ]; then
        run_scripts "$1" "$2" &
else                         
        run_scripts "$1" "$2"
fi
~
root@OpenWrt:/etc/init.d# 

/etc/init.d/ 디렉토리 밑에 pivotroot 라는 이름으로 다음 내용을 작성하고,

root@OpenWrt:/etc/init.d# vi pivotroot
                                                                               
    if [ -z $DRIVE ]; then                                                     
        echo No partitions, skipping pivotroot                                 
    else                                      
        umount $DRIVE                         
        e2fsck -p $DRIVE                      
        fsstat=$?                             
        echo e2fsck status is $fsstat
        if [ $fsstat -eq 2 ]; then   
            echo Corrected errors on $DRIVE, need to reboot
            sleep 5                                        
            reboot                                         
        elif [ $fsstat -eq 1 ]; then                       
            echo Corrected errors on $DRIVE                
        elif [ $fsstat -gt 2 ]; then       
            echo No usable filesystem on $DRIVE
        fi                                     
        echo Mounting $DRIVE                   
        mount -t ext4 $DRIVE /mnt/openwrt      
        mt=$?                                  
        if [ $mt -eq 0 ]; then           
            if [ -x /mnt/openwrt/sbin/init -a -d /mnt/openwrt/jffs -a -d /mnt/openwrt/mnt/openwrt ]; then
                echo Found OpenWRT root on $DRIVE                                                        
            # Side-effect - leave /mnt/openwrt mounted                                                   
            else                                                                                         
                echo "Missing /sbin/init, /jffs, or /mnt/openwrt (mount status was $mt)"                 
                [ -x /mnt/openwrt/sbin/init ] || echo Failed -x /sbin/init              
                [ -d /mnt/openwrt/mnt/openwrt ]     || echo Failed -x /mnt/openwrt      
                [ -d /mnt/openwrt/jffs ]      || echo Failed -x /jffs                   
                umount $DRIVE                                                           
            fi                                                                    
        else                                                                      
            echo mount status is $mt                                 
        fi                          
    fi                              
    #if everything looks ok, do the pivot root
    [ -x /mnt/openwrt/sbin/init ] && {        
        mount -o move /proc /mnt/openwrt/proc && \
        pivot_root /mnt/openwrt /mnt/openwrt/mnt/openwrt && {
            mount -o move /mnt/openwrt/dev /dev              
            mount -o move /mnt/openwrt/tmp /tmp              
            mount -o move /mnt/openwrt/jffs2 /jffs2 2>&-     
            mount -o move /mnt/openwrt/sys /sys 2>&-         
        }                                               
    }                                                   
                                                        
root@OpenWrt:/etc/init.d# sync
root@OpenWrt:/etc/init.d# ll
drwxr-xr-x    2 root     root             0 Dec 27 06:07 .
drwxr-xr-x   14 root     root             0 Dec 27 05:44 ..
-rwxr-xr-x    1 root     root          3263 Nov 18 00:28 boot
-rwxr-xr-x    1 root     root           385 Dec 19 22:02 cron
-rwxr-xr-x    1 root     root           318 Nov  9 21:52 defconfig
-rwxr-xr-x    1 root     root         10032 Dec 19 22:04 dnsmasq
-rwxr-xr-x    1 root     root           318 Mar 21  2011 done
-rwxr-xr-x    1 root     root          4367 Dec 19 22:05 dropbear
-rwxr-xr-x    1 root     root           233 Dec 19 22:06 firewall
-rwxr-xr-x    1 root     root          2004 Dec 19 22:01 fstab
-rwxr-xr-x    1 root     root          1570 Mar 21  2011 led
-rwxr-xr-x    1 root     root           641 Nov  5 23:38 network
-rwxr-xr-x    1 root     root          4657 Dec 19 22:14 openvpn
-rw-r--r--    1 root     root          2110 Dec 27 06:14 pivotroot
-rwxr-xr-x    1 root     root           375 Dec 20 07:12 pptpd
-rwxr-xr-x    1 root     root           669 Dec 27 06:03 rcS
-rwxr-xr-x    1 root     root           126 Mar 21  2011 sysctl
-rwxr-xr-x    1 root     root           505 Nov  9 21:52 sysntpd
-rwxr-xr-x    1 root     root           878 Dec 19 22:02 telnet
-rwxr-xr-x    1 root     root           673 Dec 20 09:34 uboot-envtools
-rwxr-xr-x    1 root     root            99 Mar 21  2011 umount
-rwxr-xr-x    1 root     root           154 Mar 21  2011 usb
-rwxr-xr-x    1 root     root           244 Nov  9 21:52 watchdog

pivotroot 파일에 실행권한을 부여한다.

root@OpenWrt:/etc/init.d# chmod 755 pivotroot 

위의 파일시스템 변경 스크립트에서 기본 마운트 포인트가 /mnt/openwrt 로 되어있다.

기존에 마운트해서 파일을 사용했던. /mnt/root 폴더 대신에, /mnt/openwrt 로 이름을 변경한다.

root@OpenWrt:/etc/init.d# cd /mnt
root@OpenWrt:/mnt# mount
rootfs on / type rootfs (rw)
/dev/root on / type jffs2 (rw,noatime)
proc on /proc type proc (rw,noatime)
sysfs on /sys type sysfs (rw,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime,size=30964k)
tmpfs on /dev type tmpfs (rw,noatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,noatime,mode=600)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
none on /proc/bus/usb type usbfs (rw,relatime)
/dev/sda1 on /mnt/root type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)
root@OpenWrt:/mnt# umount /dev/sda1
root@OpenWrt:/mnt# mount
rootfs on / type rootfs (rw)
/dev/root on / type jffs2 (rw,noatime)
proc on /proc type proc (rw,noatime)
sysfs on /sys type sysfs (rw,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime,size=30964k)
tmpfs on /dev type tmpfs (rw,noatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,noatime,mode=600)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
none on /proc/bus/usb type usbfs (rw,relatime)

root@OpenWrt:/mnt# ll
drwxr-xr-x    3 root     root             0 Dec 27 06:15 .
drwxr-xr-x   17 root     root             0 Jan  1  1970 ..
drwxr-xr-x    2 root     root             0 Dec 27 05:52 root
root@OpenWrt:/mnt# mv root openwrt
root@OpenWrt:/mnt# ll
drwxr-xr-x    3 root     root             0 Dec 27 06:16 .
drwxr-xr-x   17 root     root             0 Jan  1  1970 ..
drwxr-xr-x    2 root     root             0 Dec 27 05:52 openwrt
root@OpenWrt:/mnt# sync

5. 부팅 파티션의 변경 완료 확인
공유기를 재부팅해서, 정상적으로 파일시스템이 이전되었는지를 확인한다.

root@OpenWrt:/mnt# sync
root@OpenWrt:/mnt# reboot
root@OpenWrt:/mnt# 
Connection closed by foreign host.

Type `help' to learn how to use Xshell prompt.
Xshell:\> 

Connecting to 192.168.43.1:8080...
Connection established.
Escape character is '^@]'.

sh: /usr/bin/X11/xauth: not found


BusyBox v1.19.3 (2011-12-19 15:01:26 MST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 ATTITUDE ADJUSTMENT (bleeding edge, r29570) ----------
  * 1/4 oz Vodka      Pour all ingredients into mixing
  * 1/4 oz Gin        tin with ice, strain into glass.
  * 1/4 oz Amaretto
  * 1/4 oz Triple sec
  * 1/4 oz Peach schnapps
  * 1/4 oz Sour mix
  * 1 splash Cranberry juice
 -----------------------------------------------------
root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                  856.5M     27.0M    786.0M   3% /
/dev/root                 5.1M      4.2M    864.0K  83% /mnt/openwrt
tmpfs                    30.2M     76.0K     30.2M   0% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/sda1               856.5M     27.0M    786.0M   3% /
root@OpenWrt:~# cat /tmp/
.uci/               lock/               pivotroot.log       run/
TZ                  log/                resolv.conf         state/
dhcp.leases         openvpn-status.log  resolv.conf.auto    sysinfo/
root@OpenWrt:~# cat /tmp/pivotroot.log 
[Thu Jan  1 00:00:35 UTC 1970]: Pivot root log created.
/dev/sda1: clean, 840/55776 files, 10418/222764 blocks
e2fsck status is 0
Mounting /dev/sda1
Found OpenWRT root on /dev/sda1
root@OpenWrt:~# 

디스크 정보와 로그에서 완벽하게 이전되었음을 확인할 수 있다.

Posted by 훅크선장
, |
http://verejun.blogspot.com/2011/05/ubuntu.html

패키지들은 패키지 툴을 이용해 설치하게 되는데 우분투에서 사용하는 패키지 툴에는 apt, dpkg, aptitude가 있다.
먼저 apt는 온라인 리포지토리에서 패키지를 다운로드받고 설치하는데 사용 된다. 이 때 보통 로컬환경(오프라인)상에서도 사용할 수 있지만 정상적으로 사용하기 위해서는 온라인 환경에서 사용하는 것이 좋다.
dpkg는 cd-rom이나 다른 디스크장치에 있는 .deb 파일을 제어하는 경우에 일반적으로 사용되며, dpkg 명령어는 시스템 소프트웨어에 대한 설정이나 설치 및 정보를 얻는데 사용되는 옵션을 가진다.
이제 각 패키지 툴에서 사용하는 명령어들을 하나하나 살펴보자.
1. apt
실질적으로 apt는 dpkg와 함께 동작한다. 하지만 필요한 소프트웨어의 검색, 다운로드, 설치, 업그레이드, 검사 등 대부분의 패키지 관리작업을 apt 단독으로 가능하다.
$ sudo apt-get update
:  /etc/apt/sources.list를 참조로 사용할 수 있는 패키지 DB를 업데이트 한다.
$ apt-cache search 키워드
: 패키지 데이터베이스 중 주어진 키워드를 대소문자 구분 없이 검색하여 키워드를 포함하는 패키지명과 해당 설명을 출력한다.
$ sudo apt-get install 패키지명
: 패키지명을 데이터베이스에서 찾아보고 해당패키지를 다운로드 받아 설치한다. 이 때 패키지의 신뢰성을 gpg키를 사용 검증한다.
$ sudo apt-get -d install 패키지명
: 패키지를 설치는 하지 않고 /var/cache/apt/archives/ 디렉토리에 다운로드 받는다.
$ apt-cache show 패키지명
: 주어진 패키지명에 해당하는 소프트웨어에 대한 정보를 본다.
$ sudo apt-get upgrade
: 설치 되어있는 모든 프로그램 패키지에 대한 최신 업데이트를 검사한 후, 다운로드 받아 설치한다.
$ sudo apt-get dist-upgrade
: 전체 시스템을 새로운 버젼으로 업그레이드 한다. 이때 패키지 삭제도 실시된다.
단, 일반적으로 사용되는 업그레이드 방법은 아님!
$ sudo apt-get autoclean
: 불안전하게 다운로드된 패키지나 오래된 패키지의 삭제.
$ sudo apt-get clean
: 디스크 공간 확보를 위해 /var/cache/apt/archives/ 에 캐쉬된 모든 패키지 삭제
$ sudo apt-get 옵션 remove 패키지명
: 해당 패키지와 그 설정파일을 삭제한다. (옵션에 --purge 를 넣으면 설정파일을 제외하고 삭제. 옵션 없을시 전부 삭제)
$ sudo apt-get -f install
: 깨어진 패키지를 위해 정상여부를 확인
$ apt-config -V
: 설치된 APT툴의 버전을 출력
$ sudo apt-key list
: APT가 알고 있는 gpg키 목록의 출력
$ apt-cache stats
: 설치된 모든 패키지에 대한 상태정보를 출력
$ apt-cache depends
: 패키지가 설치되어 있는지 여부에 관계 없이 그 의존성을 출력한다.
$ apt-cache pkgnames
: 시스템에 설치되어 있는 모든 패키지 목록을 보여준다.
2.dpkg
이 툴의 경우 APT보다는 낮은 수준에서 작업이 수행된다. APT는 우분투의 소프트웨어를 관리하기 위해 내부적으로 이 dpkg를 이용한다. 보통 APT명령 만으로 충분하지만... 시스템에 있는 특정 파일이 어떤 패키지에 포함되는지 등의 확인 작업을 수행하기위해 dpkg 명령이 필요한 것이다.
$ dpkg -C  .deb파일
: 주어진 .deb파일이 설치한 파일의 목록을 본다.(해당 파일이 있는 곳에서 실행하거나 파일명앞에 절대 경로를 붙여준다.)
$ dpkg -I  .deb파일
: 주어진 .deb파일에 대한 정보를 본다.
$ dpkg -P  패키지명
: 패키지에 대한 정보를 보여준다.
$ dpkg -S  파일명
: 파일명 또는 경로가 포함된 패키지들을 검색한다.
$ dpkg -l
: 설치된 패키지 목록을 보여준다.
$ dpkg -L  패키지명
: 이 패키지로부터 설치된 모든 파일목록을 볼수 있다.
$ dpkg -s  패키지명
: 주어진 패키지의 상태를 본다
$ sudo dpkg -i  .deb파일
: 주어진 파일을 설치한다.
$ sudo dpkg -r  패키지명
: 시스템에서 해당 패키지를 삭제한다. (단, 삭제시 파일들은 남겨둔다.)
$ sudo dpkg -P  패키지명
: 해당 패키지와 해당 패키지의 설정파일을 모두 삭제한다.
$ sudo dpkg -x  .deb파일  디랙토리
: 파일에 포함되어있는 파일들을 지정된 디렉토리에 풀어놓는다. 단, 주의 할점은 이명령시 해당 디렉토리를 초기화 시켜버리므로 주의하여야 한다!
3. aptitude
앞에서 배운 dpkg와 APT의 경우 제대로 사용하기 위해서는 좀더 많은 지식을 요구한다. 그에 비하여 aptitude의 경우 주요 패키지 작업 과정을 자동화하여 가능한 쉽게 작업할 수 있도록 해주므로 보다 쉽게 할 수 있다. 고로 보다 많이 사용하게 될 것이... 옳지만... 아직은 인터넷 상에서 APT나 dpkg를 사용한 패키지 설치 정보가 많다는 점에서... 장래에 많이 사용하게 될 듯하다^^
$ sudo aptitude
: 실행시 curses인터페이스로 시작된다. Ctrl+t를 사용하면 메뉴에 접근할 수 있으며, q키로프로그램을 종료 시킬 수 있다.
$ aptitude help
: 도움말 보기
$ aptitude search 키워드
: 해당 키워드와 일치하는 패키지를 보여준다.
$ sudo aptitude update
: APT리포지트로들로부터 사용 가능한 패키지를 업데이트 한다.
$ sudo aptitude upgrade
: 모든 패키지를 최신으로 업그레이드 한다.
$ aptitude show 패키지명
: 해당 패키지의 설치 여부에 관계 없이 주어진 패키지에 대한 정보를 보여준다.
$ sudo aptitude download 패키지명
: 해당 패키지를 설치하지는 않고 다운로드만 받는다
$ sudo aptitude clean
: /var/cache/apt/archives디렉토리에 다운로드되어 있는 모든 .deb파일을 삭제한다.
$ sudo aptitude autoclean
: /var/cache/apt/archives디렉토리에 있는 오래된 .deb파일을 전부 삭제한다.
$ sudo aptitude install 패키지명
: 해당 패키지를 시스템에 설치한다.
$ sudo aptitude remove 패키지명
: 시스템으로부터 주어진 패키지를 삭제 한다.
$ sudo aptitude dist-upgrade
: 모든 패키지를 가장 최신 버전으로 업그레이드 시킨다. 이때, 필요한 경우 패키지를 삭제하거나 추가 한다.
참고로, 위 내용 다 넘기고 요즘 우분투의 경우 '프로그램 > 추가/제거' 메뉴나 '시스템 > 관리 > 스넵틱스관리자' 에서 쉽게 패키지를 선택하고 설치하거나 삭제 할 수 있다. 아니면 .deb파일을 받아 마우스로 클릭만 해주면 자동으로 패키지 관리자가 실행되어 설치 하게 되어있다.
하지만, 위 내용을 알고 있어야 보다 깊은 단계로 나아갈 수 있고 또 보다 세부적인 관리, 추가, 삭제가 가능하기에 알아 두는게 좋다고 본다.
이 글은 http://tpholic.com/xe/5102649 에서 가져왔음을 밝힙니다.
 
Posted by 훅크선장
, |
http://www.powerofcommunity.net/

POC 2011에 참가합니다.
특별하게 발표는 하지 않습니다만,

대신 POC 2011 기념으로 BackTrack5 R1 GNOME 64bit 버전 한글화를 완료하였습니다.

POC 2011에서 배포되었던 GNOME 64bit 버전은 POC 웹사이트에서 받을 수 있습니다.

POC 웹사이트를 확인하시고,
http://www.powerofcommunity.net/pastcon_2011.html

직접 다운로드 링크는
http://powerofcommunity.net/poc2011/BT5R1-GNOME-64bit-KR-POC.iso


배경화면은 POC 아이콘을 이용한 바탕화면 그림을 사용하였습니다.
GNOME 버전의 한글입력기는 ibus를 사용하였습니다. (중국어와 일본어도 입력할 수 있습니다. - 언어 설정을 바꾸기만 하면 됩니다.)
추가적으로, Live CD에서도 VMware 기능을 다 사용할 수 있도록, VMware Tools(open-vm-tools 패키지)를 추가하였습니다.

Posted by 훅크선장
, |

BT5 R1이 나온지 1달이 아직 안되었습니다.

2011년 추석 기념으로 우선 BackTrack5 R1 KDE 64bit 버전부터 한글화하였습니다.
한글 입력만 되도록 만든 것인데, 한글판 이라고 부르면 너무 거창한 듯한 느낌이 드나요? 좀 부끄럽군요...
(실은, 목구멍이 포도청이라~ 직장일부터 하고, 출장이며 이것저것 바뻐서...)

단계적으로, KDE 32bit와 GNOME 버전들도 한글화(한글 입력이 가능하도록) 하려고 준비중입니다.

일단, 한글입력기는 기존 BT4/5 계열들과 동일하게 SCIM을 사용하였습니다.

ibus를 사용할 수도 있다는 데, 아직 공부가 부족해서 어떻게 설정하는지 잘 모르고,(아시는 분 있으면, 정보 좀 주세요~)
기존에 쓰던 패키징 방식이 편해서(게을러서...) scim으로 했습니다.
추가적으로, Live CD에서도 VMware 기능을 다 사용할 수 있도록, VMware Tools(open-vm-tools 패키지)를 추가하였습니다.
(가까운 지인께서 요청하신 기능이라서 넣었습니다.)


배포방식은 이전과 동일하게, FTP 하나 입니다. FTP 패스워드만 퀴즈로 풀면 됩니다.
파일명은 BT5R1-KDE-64bit-KR.iso 입니다.
다른 버전들도 있으니, 한꺼번에 받지 마시고, 필요한 것만 받아가시기 바랍니다.

*** 9월 10일에 만든 버전에서 X-Windows 상의 Konsole 터미널 에뮬레이터의 폰트와 커서 모양이 맞지 않는 버그??가 있어서, 수정하였습니다. 9월 17일 이전에 받으신 분은 다시 새로 받으시기 바랍니다. ***


FTP 로그인은 BT5R2 한글버전용 FTP 계정을 사용하시기 바랍니다.
이 블로그의 최신글 중에 있습니다.

FTP 서버: hook7346.ignorelist.com
FTP 포트: 21번
FTP 계정: kali109ako
FTP 패스워드는 퀴즈입니다. => 영문자판상태에서 한글로 치시면 됩니다.
1) 패스워드는 한글 4글자와 특수문자 1개로 구성되어 있습니다.
2) 패스워드의 첫 두 글자는 우리나라 문자 이름입니다. 이미 1) 문장에서 나온 단어입니다.
3) 패스워드의 세번째와 네번째 두 글자는 3.1절에 외치던 문장에 있는 두 글자입니다.
“대한 독립 OO”에서 OO에 들어가는 단어입니다.
4) 마지막에 들어가는 특수문자는 3)의 단어뒤에 자주 붙는 특수문자입니다. 느낌이 오시나요? (이거 자주 헷갈리시는데, 쩜은 아닙니다. 느낌입니다.)

다시한번 말씀드리지만, 영문자판상태에서 한글로 치시면 됩니다.
한글 4글자와 특수문자 1개로 구성되어 있습니다.(영문자로는 총 12글자입니다.)

퀴즈가 안풀리시는 분은 이전과 동일하게, 밑에 답글로 이메일주소 적어주시면, 이메일로 접속 정보와 패스워드 알려드립니다.


Posted by 훅크선장
, |
백트랙 리눅스 5 R1이 8월 18일에 나왔습니다.
기존 BT5의 업그레이드 및 수정판입니다.

자세한 릴리즈 정보와 다운로드는 다음 링크에서 볼 수 있습니다.
http://www.backtrack-linux.org/
http://www.backtrack-linux.org/downloads/

torrent로 받으시는게 가장 편합니다.

현재 제 서버에도 받아놓았습니다.
국내 FTP로 받고 싶으시면, 다음 링크에 방문하셔서,
http://hook.tistory.com/entry/BackTrack-5-%ED%95%9C%EA%B8%80%ED%8C%90-Live-DVD-ISO-%EB%B0%B0%ED%8F%AC%ED%95%A9%EB%8B%88%EB%8B%A4%EB%8B%A8-KDE-64bit-%EB%B2%84%EC%A0%84%EB%BF%90%EC%9E%85%EB%8B%88%EB%8B%A4
위 글에 나온 FTP로 접속하시면 됩니다.


한글화 버전은 곧 만들 예정입니다. 기대해주세요~.
Posted by 훅크선장
, |
BT5가 나온지 3달이 지났습니다.
이번 데프콘(8월 10일)에서 백트랙 제작팀이 BT5 R1을 내놓겠다고 했지만,
일주일 정도 아니면 그 이상 출시가 늦어진다고 했습니다.

X-Win 버그도 있고, 개인적으로 이젠 자주 BT를 쓰지 않는지라~,
BT5 R1이 나오면, 한글판 Live CD를 내놓으려고 생각중이었지만,
그전에 정리할 필요가 있어서, 몇 가지 테스트를 하다가,
KDE 64bit 에 대해서만, 먼저 한글판을 만들어서 배포하기로 결정하였습니다.

일단, 한글입력기는 기존 BT4 계열들과 동일하게 SCIM을 사용하였습니다.
BT5는 Ubuntu 11.04 버전을 기반으로 만들어졌습니다.
한글 입력을 할 수 있는 입력기 옵션은 3가지 입니다. (ibus, scim, nabi 이렇게)

그런데, 제가 테스트해본 결과,
BT5에서 ibus는 동작하지 않습니다. (개인적인 기술적 이해 부족이라고 생각합니다.)
scim은 잘 동작합니다만, Linux용 nateon 에서 한글 입력이 안됩니다. (금번 NateOn 해킹 사고를 보고나서, 네이트온 안 쓰려고 합니다. 이전 BT4 까지는 패키지를 억지로 넣었습니다만, 이제는 넣어야할 필요가 없다고 봅니다.)
nabi도 동작은 합니다만, firefox에서 한글 입력이 안됩니다.

아마도 공부를 더 해야 할 것 같습니다.

결론으로,
BT5 KDE 64bit 버전에서 한글 입력이 가능하도록 만들었습니다.
입력기는 SCIM 입니다.
Linux용 NateOn 없습니다.
이상이 전부입니다.

BackTrack 5 R1 버전 한글판 배포하고 있습니다. 그 글로 대체합니다.
Posted by 훅크선장
, |
사설망 내부 서버들의 시간 동기화를 위해서, ntp 서버 데몬을 사용하는 방법입니다.

먼저 시간의 기준이 되는 서버를 선정합니다. 예로 그 서버가 192.168.100.15 라고 합니다.
그리고, 각 서버들이 192.168.100.x  네트워크에 속해있다고 가정합니다.

제일 우선적으로 모든 서버에 ntp 데몬을 설치하여야 합니다.
[root@localhost ~]# yum install ntp
Loaded plugins: dellsysid, fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.tt.co.kr
 * extras: centos.tt.co.kr치
 * updates: centos.tt.co.kr
base                                                                 | 2.1 kB     00:00     
dell-omsa-indep                                                      | 1.9 kB     00:00     
dell-omsa-specific                                                   | 1.9 kB     00:00     
extras                                                               | 2.1 kB     00:00     
updates                                                              | 1.9 kB     00:00     
updates/primary_db                                                   | 588 kB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ntp.x86_64 0:4.2.2p1-9.el5.centos.2.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================
 Package        Arch              Version                             Repository       Size
============================================================================================
Installing:
 ntp            x86_64            4.2.2p1-9.el5.centos.2.1            base            1.3 M

Transaction Summary
============================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 1.3 M
Is this ok [y/N]: y
Downloading Packages:
ntp-4.2.2p1-9.el5.centos.2.1.x86_64.rpm                              | 1.3 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : ntp                                                                  1/1 

Installed:
  ntp.x86_64 0:4.2.2p1-9.el5.centos.2.1

설치가 완료되었으면, ntp 관련 설정을 하면 됩니다.
기존에 자동으로 설치되는 /etc/ntp.conf 에서 일부만 고치면 됩니다.

사설망내에서 시간의 기준이 되는 예로 192.168.100.15 번 서버는 /etc/ntp.conf 파일에서 다음 부분만 수정하여 설정합니다.
# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
restrict 192.168.100.0 mask 255.255.255.0 nomodify notrap # 로컬 서버들이 시간 정보를 가져갈 수 있도록, 접근제한을 풀어줍니다.

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.rhel.pool.ntp.org  # 기존에 설정된 server 들을 모두 사용하지 않습니다.
#server 1.rhel.pool.ntp.org  # 오직 자체 시스템의 클럭만을 시간으로 사용합니다. (이 서버가 기준이므로,)
#server 2.rhel.pool.ntp.org

192.168.100.15 번 서버는 현재 사설망의 기준 시간이 되는 서버이므로, 오직 자체 시스템의 클럭만을 시간으로 사용합니다. 그러므로, /etc/ntp.conf 파일 내에서 server 라는 문구는 유일하게 다음 한 줄만 존재하여야 합니다.
server  127.127.1.0     # local clock

다음으로, 192.168.100.x 네트워크에 존재하는 다른 서버들은 기준 시간 서버로 192.168.100.15 서버를 사용하므로, /etc/ntp.conf 파일에서 다음 부분만 수정하여 설정합니다.

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.rhel.pool.ntp.org  # 기존에 설정된 server 들을 모두 사용하지 않습니다.
#server 1.rhel.pool.ntp.org
#server 2.rhel.pool.ntp.org
server 192.168.100.15  # 사설망내 시간 기준 서버를 지정합니다.

기준 시간 서버인 192.168.100.15 서버와 192.168.100.x 네트워크에 존재하는 다른 서버들의 설정이 다른 것은 기준 서버를 제외한 다른 서버들은 별도로 시간 정보를 다른 쪽에 줄 필요가 없기 때문입니다.( 기준 서버와 동일하게, 접근제한을 풀어줘서 또 다른 기준 시간 서버로 사용할 수도 있습니다만, 관리자의 선택에 따르면 됩니다.)

설정이 완료되었으면, ntpd 서비스를 시작시키고, 매 시스템이 시작될 때마다 구동되도록 설정합니다.
[root@localhost ~]# service ntpd start
[root@localhost ~]# chkconfig ntpd on

ntpd 서비스가 정상적으로 동작하는지를 확인합니다.
[root@localhost ~]# ps -ef |grep ntp
ntp      23483     1  0 14:24 ?        00:00:00 ntpd -u ntp:ntp -p /var/run/ntpd.pid -g
root     24326 23151  0 15:10 pts/12   00:00:00 grep ntp
[root@localhost ~]#

ntpd 서비스가 시간을 정상적으로 동기화하고 있는 여부는 다음과 같이 확인합니다.
기준 시간 서버인 192.168.100.15 서버는 동기화 정보를 자기 자신뿐이므로, 결과가 다음과 같이 나타나고,
[root@localhost ~]# ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*127.127.1.0     .LOCL.          10 l   19   64  377    0.000    0.000   0.001
[root@localhost ~]#

192.168.100.x 네트워크에 존재하는 다른 서버들은 기준 시간 서버인 192.168.100.15 서버를 참조하고 있기 때문에, 다음과 같이 결과가 출력됩니다.

[root@Server1 etc]# ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*192.168..100.15  LOCAL(0)        11 u   47   64  377    0.156   16.448  14.100
 127.127.1.0     .LOCL.          10 l   40   64  377    0.000    0.000   0.001
[root@Server1 etc]#


Posted by 훅크선장
, |
백트랙 리눅스 5 가 5월 10일에 나왔습니다.

잠시동안 잊고 지냈었는데, 4 R2 버전 이후 약 6개월만에 등장하였습니다. 새 버전의 출시 주기가 짧아지고 있습니다.

자세한 릴리즈 정보와 다운로드는 다음 링크에서 볼 수 있습니다.
http://www.backtrack-linux.org/
http://www.backtrack-linux.org/downloads/

torrent로 받으시는게 가장 편합니다.

현재 제 서버에도 받아놓았습니다.
국내 FTP로 받고 싶으시면, 다음 링크에 방문하셔서,
http://hook.tistory.com/entry/Backtrack-4-R2-VMware-%EC%9D%B4%EB%AF%B8%EC%A7%80-%ED%95%9C%EA%B8%80%ED%8C%90-%EB%B0%B0%ED%8F%AC
위 글에 나온 FTP로 접속하시면 됩니다.

가장 큰 변화는 일단
1. 64 비트 지원입니다. 32 비트 버전도 따로 있습니다. 게다가 arm 버전도 만들었습니다.
arm 버전은 어디서 돌리는지?? 혹시 스마트폰??
아시는 분 있으시면, 정보 좀 부탁드립니다.

2. 데스크탑 매니저가 KDE 4.6, GNOME, FLUXBOX 로 다양하게 나누어져 있습니다.

3. 수록된 보안 관련 도구가 자그마치 348 종 이라고 합니다.

한글화 하기 위해서, 현재 원 배포판들의 특징을 확인하고 있습니다.
이번에도 깔끔하게 한글화가 되기를 기대해봅니다.
일단 아시아권 언어에 대한 웹 브라우징을 해본 결과, 한글, 중국어, 일본어의 보기는 잘 됩니다.
이전까지 없었던, 폰트는 기본적으로 탑재한 듯으로 보입니다만, 한글 입력은 안됩니다. 입력기가 없는 것 같습니다.

개봉박두~~~~~~~~~~~~~~.

----------------------------------------------------------------
6월 8일 추가 :
한글화가 어렵지는 않습니다만, BT5를 VMware에서 돌리고 있는데,
모든 배포판에서 공통으로 firefox 구동시, 멈추는 문제점이 있는 것 같았습니다.

확인해보니, BT5 자체의 KDE 버전에 문제가 있는 듯 합니다. 좀더 확인해보고, 한글화 진행할 예정입니다.

제 예상에는 곧 Fix 버전이 나올 것도 같습니다.

Posted by 훅크선장
, |