« Prev : 1 : 2 : 3 : 4 : 5 : Next »


작성일 : 2011. 4. 12.
작성자 : 이선규 (neosky)


mod_security 설치 과정중 make 시 다음과 같이 에러가 발생하는 경우
다음과 같이 조치하면 된다.


[ make 시 에러 메세지 출력 후 중단 ]

/usr/local/apache/build/libtool --silent --mode=compile gcc -prefer-pic -I/usr/kerberos/include -L/usr/kerberos/lib -DAP_HAVE_DESIGNATED_INITIALIZER -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/local/apache/include  -I/usr/local/apache/include   -I/usr/local/apache/include  -O2 -g -Wall -DWITH_PCRE_STUDY -DMODSEC_PCRE_MATCH_LIMIT=1500 -DMODSEC_PCRE_MATCH_LIMIT_RECURSION=1500 -I/usr/local/apache/include -I/usr/local/pcre/include -I/usr/include/libxml2  -c -o msc_pcre.lo msc_pcre.c && touch msc_pcre.slo

msc_pcre.c: In function 'msc_pregcomp_ex':
msc_pcre.c:73: error: invalid application of 'sizeof' to incomplete type 'pcre_extra'
msc_pcre.c:77: error: invalid application of 'sizeof' to incomplete type 'pcre_extra'
msc_pcre.c:98: warning: ignoring #pragma message
msc_pcre.c:119: warning: ignoring #pragma message
apxs:Error: Command failed with rc=65536
.
make: *** [mod_security2.la] 오류 1


[ 조치방법 ]

/usr/local/apache/include 디렉토리 내 pcre.h 파일은 백업하고,
/usr/local/pcre/include 디렉토리 내 pcre.h 파일을 /usr/local/apache/include 디렉토리 로 복사시키면 된다.

=> 여기서 apache include 는 apache 가 설치된 디렉토리이어야 한다. (위 부분중 빨간색 주목)



[다음과 같이 정상적으로 make 되는 것을 확인할 수 있음]

make
.... 생략 ....

/usr/local/apache/build/libtool --silent --mode=link gcc -o mod_security2.la  -L/usr/local/pcre/lib -lpcre -lxml2 -lz -lm -rpath /usr/local/apache/modules -module -avoid-version    msc_release.lo msc_lua.lo acmp.lo msc_geo.lo pdf_protect.lo msc_reqbody.lo persist_dbm.lo msc_pcre.lo msc_util.lo msc_parsers.lo modsecurity.lo msc_multipart.lo msc_xml.lo msc_logging.lo re_variables.lo re_tfns.lo re_actions.lo re_operators.lo re.lo apache2_util.lo apache2_io.lo apache2_config.lo mod_security2.lo
[root@neosky ]#

make install
.... 생략 ....

PATH="$PATH:/sbin" ldconfig -n /usr/local/apache/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/apache/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 755 /usr/local/apache/modules/mod_security2.so






2011/04/12 18:43 2011/04/12 18:43








마음튼튼 이 작성.

당신의 의견을 작성해 주세요.

[로그인][오픈아이디란?]
오픈아이디로만 댓글을 남길 수 있습니다


현재 디렉토리 777 속성인 것만 검색하기


find ./ -maxdepth 1 -perm 777 -type d


-maxdepth 옵션 하위디렉토리 값

값 1이면 현재 디렉토리내
값 2이면 현재 디렉토리 1단계 하위 디렉토리까지

-perm 옵션 파일(디렉토리) 속성 값


664
777
707

-type 옵션 찾을 타입 값

d이면 디렉토리
f이면 파일
2010/12/31 16:32 2010/12/31 16:32








마음튼튼 이 작성.

당신의 의견을 작성해 주세요.

[로그인][오픈아이디란?]
오픈아이디로만 댓글을 남길 수 있습니다


제     목 : 리눅스 쉘 dir color, vi color, prompt color 바꾸기
작 성 자 : 이선규  (neosky) (neosky(at)smileserv.com, admin(at)nple.com,
http://seroot.com)
작성일자 : 2010년 11월 3일






1. 리눅스 쉘 dir color 바꾸기

$ cp /etc/DIR_COLORS ~/.dircolors

$ vi ~./dircolors
#DIR 01;34   #directory    <-- 주석처리
DIR 01;33   #directory


=> dir 색상을 밝은 노란색으로 바꾼다.


<변경전>

사용자 삽입 이미지
























<변경후>

사용자 삽입 이미지



























2. vi color 바꾸기


$ vi ~/.vimrc

hi Comment ctermfg=6 ctermbg=none cterm=none
--> 라인추가


=> 주석의 색상을 밝은 청록색으로 바꾼다.


<변경전>

사용자 삽입 이미지

<변경후>

사용자 삽입 이미지




3. 리눅스 쉘 prompt color 바꾸기

$ vi ~/.bash_profile

PS1='\[\033[01;35m\][\h] \e[32;1m$PWD\e[37m > \$\e[0m '
--> 라인추가


=> 프롬프트 색상을 가독성 높게 바꾼다.  [호스트네임]  디렉토리위치 > # (일반 계정은 $)

<변경후>

사용자 삽입 이미지








2010/11/03 12:51 2010/11/03 12:51








마음튼튼 이 작성.

당신의 의견을 작성해 주세요.

[로그인][오픈아이디란?]
오픈아이디로만 댓글을 남길 수 있습니다


제   목 : Ganglia 모니터링 툴 소개 및 설치방법

구   분 : 소개 및 설치메뉴얼
작성자 : 이선규 (neosky) (neosky(at)smileserv.com, admin(at)nple.com,
http://seroot.com)
작성일 : 2010년 8월 20일



1. Ganglia 소개

Ganglia는 원래 클러스터나 그리드 컴퓨팅과 같이 대량의 노드가 있는 환경에서 사용하는 것을
상정해서 만들어진 모니터링 시스템이라고 합니다.

Ganglia 는 Ganglia Monitor Daemon (Gmond), Ganglia Meta Daemon Gmetad), Ganglia Web Interface로
나뉩니다.

- Ganglia Monitor Daemon (Gmond)

다른 호스트의 Gmond 데몬에 멀티캐스트 메세지를 보내 자신의 상태를 알리고,
다른 호스트의 정보를 수집하여 자신과 다른 노드의 시스템 상태를 XML 형식으로 알려주는 기능을 합니다.

이때, 정보를 수집할 모든 노드에 Gmond 데몬이 설치되어야만 합니다.


- Ganglia Meta Daemon (Gmetad)


Gmond는 같은 네트웍상의 호스트에서만 호스트정보를 전달하므로, WAN (Wide Area Network)에서는
멀티캐스팅이 되지 않습니다. Gmetad는 WAN에서 여러 Gmond 데몬으로부터 수집된 호스트 정보를
RRD (Round-Robin Database)에 저장합니다.

Gmetad는 Ganglia Web Interface가 설치될 웹서버에만 설치하면 됩니다.


- Ganglia Web Interface

웹 인터페이스 모듈은 PHP언어로 작성되어 있으며, PHP가 지원되는 웹서버에서 동작합니다.

Ganglia Web Interface를 이용해서 Gmetad에 의해 수집되어 RRD에 저장된 시스템 정보를
비주얼하게 보여주는 역할을 합니다.


Gangila Monitoring System 의 공식 홈페이지는 http://ganglia.info/ 이며,
2010년 8월 현재 최신버전은 3.1.7 입니다. 

위에서 소개한 세가지 툴은 Ganglia monitor core 패키지 이름으로 배포됩니다.


사용자 삽입 이미지



2. 설치

홈페이지에서 Ganglia monitoring core 소스를 다운로드 받습니다.

Home > Download > Ganglia monitor core > 버전 (3.1.7)

직접 주소 : http://downloads.sourceforge.net/project/ganglia/ganglia%20monitoring%20core/3.1.7/ganglia-3.1.7.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fganglia%2Ffiles%2Fganglia%2520monitoring%2520core%2F3.1.7%2F&ts=1282266029&mirror=cdnetworks-kr-1


압축해제

설치

# ./configure --sysconfdir=/etc/ganglia


Welcome to..
     ______                  ___
    / ____/___ _____  ____ _/ (_)___ _
   / / __/ __ `/ __ \/ __ `/ / / __ `/
  / /_/ / /_/ / / / / /_/ / / / /_/ /
  \____/\__,_/_/ /_/\__, /_/_/\__,_/
                   /____/

Copyright (c) 2005 University of California, Berkeley

Version: 3.1.7
Library: Release 3.1.7 0:0:0

Type "make" to compile.



# make




make 이전 다음과 같이 에러가 나면 confuse 파일을 받아 컴파일 설치해준다.

Checking for confuse
checking for cfg_parse in -lconfuse... no
Trying harder including gettext
checking for cfg_parse in -lconfuse... no
Trying harder including iconv
checking for cfg_parse in -lconfuse... no
libconfuse not found

파일 위치 : http://savannah.nongnu.org/download/confuse/confuse-2.7.tar.gz

# ./configure
# make
# make install







2010/08/20 09:58 2010/08/20 09:58








마음튼튼 이 작성.

당신의 의견을 작성해 주세요.

[로그인][오픈아이디란?]
오픈아이디로만 댓글을 남길 수 있습니다


제목 : Linux SNMP OID’s for CPU,Memory and Disk Statistics

구   분 : 스크랩
작성자 : 이선규 (neosky)  (neosky(at)smileserv.com, admin(at)nple.com,
http://seroot.com)
작성일 : 2010년 8월 17일




SNMP stands for Simple Network Management Protocol and consists of three key components: managed devices, agents, and network-management systems (NMSs). A managed device is a node that has an SNMP agent and resides on a managed network. These devices can be routers and access server, switches and bridges, hubs, computer hosts, or printers. An agent is a software module residing within a device. This agent translates information into a compatible format with SNMP. An NMS runs monitoring applications. They provide the bulk of processing and memory resources required for network management.

SNMP MIBs, OIDs Overview

MIB stands for Management Information Base and is a collection of information organized hierarchically. These are accessed using a protocol such as SNMP. There are two types of MIBs: scalar and tabular. Scalar objects define a single object instance whereas tabular objects define multiple related object instances grouped in MIB tables.
MIB files for specific devices or systems can be downloaded from here

OIDs or Object Identifiers uniquely identify manged objects in a MIB hierarchy. This can be depicted as a tree, the levels of which are assigned by different organizations. Top level MIB object IDs (OIDs) belong to different standard organizations. Vendors define private branches including managed objects for their own products.

Here is a sample structure of an OID

Iso (1).org(3).dod(6).internet(1).private(4).transition(868).products(2).chassis(4).card(1).slotCps(2)­
.­cpsSlotSummary(1).cpsModuleTable(1).cpsModuleEntry(1).cpsModuleModel(3).3562.3

Most of the people may be looking for OID’s for Linux OID’s for CPU,Memory and Disk Statistics for this first you need to install SNMP server and clients. If you want to install SNMP server and client installation in linux check here

CPU Statistics

Load
1 minute Load: .1.3.6.1.4.1.2021.10.1.3.1
5 minute Load: .1.3.6.1.4.1.2021.10.1.3.2
15 minute Load: .1.3.6.1.4.1.2021.10.1.3.3

CPU
percentage of user CPU time: .1.3.6.1.4.1.2021.11.9.0
raw user cpu time: .1.3.6.1.4.1.2021.11.50.0
percentages of system CPU time: .1.3.6.1.4.1.2021.11.10.0
raw system cpu time: .1.3.6.1.4.1.2021.11.52.0
percentages of idle CPU time: .1.3.6.1.4.1.2021.11.11.0
raw idle cpu time: .1.3.6.1.4.1.2021.11.53.0
raw nice cpu time: .1.3.6.1.4.1.2021.11.51.0

Memory Statistics

Total Swap Size: .1.3.6.1.4.1.2021.4.3.0
Available Swap Space: .1.3.6.1.4.1.2021.4.4.0
Total RAM in machine: .1.3.6.1.4.1.2021.4.5.0
Total RAM used: .1.3.6.1.4.1.2021.4.6.0
Total RAM Free: .1.3.6.1.4.1.2021.4.11.0
Total RAM Shared: .1.3.6.1.4.1.2021.4.13.0
Total RAM Buffered: .1.3.6.1.4.1.2021.4.14.0
Total Cached Memory: .1.3.6.1.4.1.2021.4.15.0

Disk Statistics

The snmpd.conf needs to be edited. Add the following (assuming a machine with a single ‘/’ partition):

disk / 100000 (or)

includeAllDisks 10% for all partitions and disks

The OIDs are as follows

Path where the disk is mounted: .1.3.6.1.4.1.2021.9.1.2.1
Path of the device for the partition: .1.3.6.1.4.1.2021.9.1.3.1
Total size of the disk/partion (kBytes): .1.3.6.1.4.1.2021.9.1.6.1
Available space on the disk: .1.3.6.1.4.1.2021.9.1.7.1
Used space on the disk: .1.3.6.1.4.1.2021.9.1.8.1
Percentage of space used on disk: .1.3.6.1.4.1.2021.9.1.9.1
Percentage of inodes used on disk: .1.3.6.1.4.1.2021.9.1.10.1

System Uptime: .1.3.6.1.2.1.1.3.0

Examples

These Commands you need to run on the SNMP server

Get available disk space for / on the target host

#snmpget -v 1 -c “community” target_name_or_ip .1.3.6.1.4.1.2021.9.1.7.1

this will return available disk space for the first entry in the ‘disk’ section of snmpd.conf; replace 1 with n for the nth entry

Get the 1-minute system load on the target host

#snmpget -v 1 -c “community” target_name_or_ip .1.3.6.1.4.1.2021.10.1.3.1

Get the 5-minute system load on the target host

#snmpget -v 1 -c “community” target_name_or_ip .1.3.6.1.4.1.2021.10.1.3.2

Get the 15-minute system load on the target host

#snmpget -v 1 -c “community” target_name_or_ip .1.3.6.1.4.1.2021.10.1.3.3

Get amount of available swap space on the target host

#snmpget -v 1 -c “community” target_name_or_ip .1.3.6.1.4.1.2021.4.4.0


출처 : http://www.debianadmin.com/linux-snmp-oids-for-cpumemory-and-disk-statistics.html

2010/08/17 13:27 2010/08/17 13:27








마음튼튼 이 작성.

당신의 의견을 작성해 주세요.

[로그인][오픈아이디란?]
오픈아이디로만 댓글을 남길 수 있습니다


제목 : 시스템 모니터링툴 'htop'
작성자 : 이선규 (neosky)  (neosky(at)smileserv.com, admin(at)nple.com,
http://seroot.com)
작성일 : 2010년 7월 5일



0. 소개


현재 프로세스 상태를 살펴볼때 자주 사용하는 top 명령어의 TUI (text user interface) 버전인
htop 은 리눅스, BSD 계열 모두 사용 가능하며, 시스템 상황을 쉽게 모니터링 할 수 있습니다.

아래 F1 ~ F10 을 통해 Setup, Search, Invert, Tree, SortBy, Nice, Kill 등 상세한 조작이 가능하다.
(F1은 도움말, F10은 htop 빠져나가기)

2010년 7월 5일 현재 0.8.3이 최신버전이며 아래 URL에서 다운로드 받을 수 있다.


▲ htop 프로젝트 URL
http://htop.sourceforge.net/index.php?page=downloads


▲ 다운로드 URL (stable 0.8.3 버전)
http://downloads.sourceforge.net/project/htop/htop/0.8.3/htop-0.8.3.tar.gz?use_mirror=cdnetworks-kr-2&6412852


1. 다운로드

# wget http://downloads.sourceforge.net/project/htop/htop/0.8.3/htop-0.8.3.tar.gz?use_mirror=cdnetworks-kr-2&6412852

htop-0.8.3.tar.gz 파일이 다운로드 됩니다.


# tar zvfx htop-0.8.3.tar.gz


2. 설치

# cd htop-0.8.3

# ./configure
...
configure: creating ./config.status
config.status: creating plpa-1.1/Makefile
config.status: creating plpa-1.1/src/Makefile
config.status: creating Makefile
config.status: creating htop.1
config.status: creating config.h
config.status: config.h is unchanged
config.status: creating plpa-1.1/src/plpa_config.h
config.status: creating plpa-1.1/src/plpa.h
config.status: executing depfiles commands

# make
...
gcc -pedantic -Wall -std=c99 -D_XOPEN_SOURCE_EXTENDED -g -O2 -o htop htop-AvailableMetersPanel.o htop-CategoriesPanel.o htop-CheckItem.o htop-ClockMeter.o htop-ColorsPanel.o htop-ColumnsPanel.o htop-CPUMeter.o htop-CRT.o htop-DebugMemory.o htop-DisplayOptionsPanel.o htop-FunctionBar.o htop-Hashtable.o htop-Header.o htop-htop.o htop-ListItem.o htop-LoadAverageMeter.o htop-MemoryMeter.o htop-Meter.o htop-MetersPanel.o htop-Object.o htop-Panel.o htop-BatteryMeter.o htop-Process.o htop-ProcessList.o htop-RichString.o htop-ScreenManager.o htop-Settings.o htop-SignalItem.o htop-SignalsPanel.o htop-String.o htop-SwapMeter.o htop-TasksMeter.o htop-TraceScreen.o htop-UptimeMeter.o htop-UsersTable.o htop-Vector.o htop-AvailableColumnsPanel.o htop-AffinityPanel.o htop-HostnameMeter.o htop-OpenFilesScreen.o  ./plpa-1.1/src/.libs/libplpa_included.a -lncurses -lm
make[2]: Leaving directory `/usr/local/src/htop-0.8.3'
make[1]: Leaving directory `/usr/local/src/htop-0.8.3'

# make install
...
test -z "/usr/local/share/pixmaps" || /bin/mkdir -p "/usr/local/share/pixmaps"
 /usr/bin/install -c -m 644 'htop.png' '/usr/local/share/pixmaps/htop.png'
make[3]: Leaving directory `/usr/local/src/htop-0.8.3'
make[2]: Leaving directory `/usr/local/src/htop-0.8.3'
make[1]: Leaving directory `/usr/local/src/htop-0.8.3'


3. 실행방법

# htop           --> 기본적으로 5초간격으로 화면이 갱신됩니다.
# htop -d 1    --> 1초간격으로 화면이 갱신됩니다.


4. 실행화면


▲ htop (기본)
사용자 삽입 이미지


▲ htop (F5를 눌러 Tree 형태로 볼때)

사용자 삽입 이미지





2010/07/05 09:52 2010/07/05 09:52








마음튼튼 이 작성.

당신의 의견을 작성해 주세요.

[로그인][오픈아이디란?]
오픈아이디로만 댓글을 남길 수 있습니다



포트 포워딩 (Port Forwarding) 이란?

: 패킷을 포트 번호별로 전송하겠다라는 의미임.
  0~65535까지의 포트가 있지만, 0~1024까지는 예약이 되어 있으므로 사용하지 못한다.
  1024~49151까지는 윈도우가 동적으로 할당, 나머지는 필요할때 사용한다.
  포트 포워딩은 포트별로 하나씩 설정이 가능하다.
  DMZ 는 모든 포트를 개방하는 것이다.





NAT 구성

** 마스커레이드 서버 구축 (Masquerade Server), NAT

1. 포워딩 기능 활성화

# echo 1 > /proc/sys/net/ipv4/ip_forward


2. 재부팅시에도 포워딩 기능이 활성화 되도록 설정함.

# vi /etc/sysctl.conf
net.ipv4.ip_forward = 0 을 1 로 수정함.


3. 방화벽 설정

# vi /etc/sysconfig/iptables

*nat
:POSTROUTING ACCEPT
-A POSTROUTING ACCEPT -o eth0 -j MASQUERADE
COMMIT
* filter

~

-A RH-Firewall-1-INPUT -m state --state NEW -o eth0 -j ACCEPT


4. iptables 데몬 재시작

# service iptables restart


5. 마스커레이드 동작 확인

# iptables -L
# iptables -L -t nat


** 콘솔에서 설정하는 방법

# vi /etc/rc.d/rc.local 에 작성

# iptables -F
# iptables -F -t nat
# iptables -A FORWARD -o [내부인터페이스:사설] -j ACCEPT
# iptables -A FORWARD -o [외부인터페이스:공인] -j ACCEPT
# iptables -t nat -A POSTROUTING -o [외부인터페이스:공인] -j MASQUERADE


- CentOS 의 경우 오류가 발생할 수 있으니 iptables 에 다음의 명령을 추가해준다.

-A FORWARD -o eth0 -j ACCEPT
-A FORWARD -o eth1 -j ACCEPT


6.

위 iptables *nat 부분에 COMMIT 전에 적어준다.

-A PREROUTING -p tcp --dport 4000 -i eth0 -j DNAT --to 222.122.45.255:80

==> eth0 의 TCP 4000 번을 통해 들어온 패킷은 222.122.45.255:80 으로 바로 전달함.
즉, LAN을 통해 외부에서 들어온 패킷을 다시 내부에서 적절히 할당하는 것임.


-A PREROUTING -t nat -p tcp -d 222.12.45.255 --dport 9999 -j DNAT --to 222.122.45.255:8888



IPTABLES=/sbin/iptables
#IPTABLES=/usr/local/sbin/iptables
HOST_IP="`ifconfig eth0 | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'`"

/sbin/depmod -a
/sbin/insmod ip_tables
/sbin/insmod ip_conntrack
/sbin/insmod ip_conntrack_ftp
/sbin/insmod iptable_nat
/sbin/insmod ip_nat_ftp

echo " - Enabling packet forwarding in the kernel"
echo "1" > /proc/sys/net/ipv4/ip_forward

echo " - Enabling dynamic addressing measures"
echo "1" > /proc/sys/net/ipv4/ip_dynaddr

echo " - Resetting the firewall and setting the default FORWARD policy to DROP"
$IPTABLES -P INPUT ACCEPT
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD ACCEPT
$IPTABLES -F FORWARD

echo " - FWD: Allow all connections OUT and only existing and related ones IN"
$IPTABLES -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i eth1 -o eth0 -j ACCEPT
$IPTABLES -A FORWARD -j LOG

#echo " - Proidea: Test "
#$IPTABLES -A INPUT -i eth0 -p icmp -j DROP
#$IPTABLES -A INPUT -i eth0 -p tcp --dport 1024 -j DROP
#$IPTABLES -A INPUT -i eth0 -p tcp --dport sunrpc -j DROP

echo " - Enabling SNAT (MASQUERADE) functionality on eth0"
$IPTABLES -t nat -A POSTROUTING -o eth0 -j MASQUERADE

#Popdesk (포트 포워딩 부분)
$IPTABLES -t nat -A PREROUTING -i eth0 -p udp --dport 2000:2020 -j DNAT --to 192.168.200.200
$IPTABLES -t nat -A PREROUTING -i eth0 -p tcp --dport 2000:2020 -j DNAT --to 192.168.200.200
#soribada (포트 포워딩 부분)
$IPTABLES -t nat -A PREROUTING -p udp -d $HOST_IP --dport 9065 -j DNAT --to 192.168.200.200:9065
$IPTABLES -t nat -A PREROUTING -p udp -d $HOST_IP --dport 9066 -j DNAT --to 192.168.200.200:9066
$IPTABLES -t nat -A PREROUTING -p udp -d $HOST_IP --dport 9067 -j DNAT --to 192.168.200.200:9067
$IPTABLES -t nat -A PREROUTING -p udp -d $HOST_IP --dport 9068 -j DNAT --to 192.168.200.200:9068


#FTP server (포트 포워딩 부분)
$IPTABLES -t nat -A PREROUTING -p tcp -d $HOST_IP --dport 8819 -j DNAT --to 192.168.0.9:8819
$IPTABLES -t nat -A PREROUTING -p udp -d $HOST_IP --dport 8819 -j DNAT --to 192.168.0.9:8819


#FTP server (포트 포워딩 부분)
$IPTABLES -t nat -A PREROUTING -p tcp -d $HOST_IP --dport 8820 -j DNAT --to 192.168.200.200:21
$IPTABLES -t nat -A PREROUTING -p udp -d $HOST_IP --dport 8820 -j DNAT --to 192.168.200.200:21



#80 (포트 포워딩 부분)
$IPTABLES -t nat -A PREROUTING -p udp -d $HOST_IP --dport 8881 -j DNAT --to 192.168.200.200:80
$IPTABLES -t nat -A PREROUTING -p tcp -d $HOST_IP --dport 8881 -j DNAT --to 192.168.200.200:80

# mms 미디어 동영상 192.168.200.200 1755 (포트 포워딩 부분)

$IPTABLES -t nat -A PREROUTING -p udp -d $HOST_IP --dport 1755 -j DNAT --to 192.168.200.200:1755
$IPTABLES -t nat -A PREROUTING -p tcp -d $HOST_IP --dport 1755 -j DNAT --to 192.168.200.200:1755

# mms 미디어 동영상 192.168.200.200 1755 (포트 포워딩 부분)

$IPTABLES -t nat -A PREROUTING -p udp -d $HOST_IP --dport 2000 -j DNAT --to 192.168.200.200:2000
$IPTABLES -t nat -A PREROUTING -p tcp -d $HOST_IP --dport 2000 -j DNAT --to 192.168.200.200:2000

# win 2000 터미널 서버 연결 192.168.200.200 3389 (포트 포워딩 부분)
$IPTABLES -t nat -A PREROUTING -p udp -d $HOST_IP --dport 3389 -j DNAT --to 192.168.200.200:3389
$IPTABLES -t nat -A PREROUTING -p tcp -d $HOST_IP --dport 3389 -j DNAT --to 192.168.200.200:3389
 

 




2010/06/15 14:31 2010/06/15 14:31








마음튼튼 이 작성.

당신의 의견을 작성해 주세요.

[로그인][오픈아이디란?]
오픈아이디로만 댓글을 남길 수 있습니다


load average

서버에 걸리는 평균 부하율 1분, 5분, 15분

load average 는 process 작업의 대기를 의미합니다. 즉, 1분간 평균 load average가 1 이라면, 1분동안 1개의 작업이 대기하고 있다는 얘기입니다.
즉 값이 높으면 높을수록 대기하는 작업이 많아지게 되고, 이는 곧 서버가 부하를 받고 있다는 얘기가 됩니다.

즉, 서버가 아주 좋은 상태는 load average 가 1 보다 작은 값이고, 1보다 클 경우 는 서버가 부하를 받기 시작한다고 보게 됩니다.

평균적으로 4정도를 넘으면 부하를 받는다고 판단을 하며, 이 기준은 관리자마다 주관적인 차이가 있습니다.
또한 같은 사람이라도, 서비스에 따라, load average 15 가 양호한 상태라고 판단하는 경우가 있습니다.
즉, load average 는 절대적인 판단 기준이 되는 것은 아니라는 의미입니다.

예를 들어 서버에서 별로 하는 것이 없는데 15가 넘는다면, 그건 심각한 문제가 있다는 얘기가 될수 있지만, 서버에서 DB 돌리고, ftp 돌리고, 대량메일 발송하고, 웹 동시 접속자가 1000명 정도 되는 서버인데 15라면 잘 버티고 있는 것이라 봐야 겠습니다.

우리 서비스상의 서버의 load average 값이 5이상이라면 이때는
커널 튜닝 and or 하드웨어의 업그래이드가 필요한데 이것은 메모리의 사용률을 함께 참조 해야 합니다.

먼저 필요 없는 프로세스가 실행되고 있나 확인 하고
필요 없는 프로세스라고 판단되는 경우 과감하게 종료 시킵니다.
※ Zombie : process는 죽었는데 자원을 차지하고 있는 것(전염성이 있음)
반드시 강제 종료해야 한다.
강제 종료 안 되면 시스템 재부팅 합니다.

커널의 튜닝의 경우 로그 파일을 확인 하여 file limit과 같이 프로세스 관련 항목을 튜닝해야 하며
메모리의 자원이 부족하거나 swap메모리의 양이 늘어나면
메모리를 추가 하여야 하며
메모리에 여유가 있으나 load average값이 늘어나면 CPU를 업그래이드 해야 합니다.

PRI : priority(우선순위)

CPU 스케줄링에서 필요한 순위입니다.

현재 OS는 한번에 여러개의 프로세스가 동시에 실행되도록 함으로써 CPU의 노는 시간을 줄이고 자원사용의 효율성을 최대화 시키기 위해서 다중프로그래밍이라는 알고리즘을 이용합니다.

※ 다중 프로그래밍 : CPU 점유방법

CPU는 사용자가 계산을 요구하면 그 작업에 대한 header 를 가지고 작업을 메모리에서 수행합니다.
메모리에서 작업을 하는 동안 사용자가 또다른 요구를 하게 되면 CPU는 우선되는 값을 체크합니다.
나중에 사용자가 요구한 계산값이 우선권이 더 높으면 CPU는 처음에 사용자가 요구한 계산값을 메모리사용량을 줄이고 나중에 요구한 값에 더 많은 메모리 영역을 분배하여 계산을 하도록 합니다.
이렇게 작업영역을 배분해주는 것이 스케줄링이라고 보시면 됩니다.

이 다중 프로그래밍에서 프로세스 순서에서 순위를 나타내는 값을 우선 순위 라고 합니다.
 
출처 : http://noartist.com
2010/05/28 02:39 2010/05/28 02:39








마음튼튼 이 작성.

당신의 의견을 작성해 주세요.

[로그인][오픈아이디란?]
오픈아이디로만 댓글을 남길 수 있습니다



특정 파일, 디렉토리 제외하고 압축하기

작성자 : neosky (http://me2day.net/neosky)
작성일 : 2010년 5월 26일



오늘은 압축시 이미지 파일이나 session 디렉토리처럼 부피가 크고 따로 압축하지 않아도 되는

파일, 디렉토리를 제외하고 압축하는 방법에 대해 알아보겠습니다.


명령어 사용방법은 --exclude 구문을 사용하고 그 뒤에 제외할 파일 확장자, 디렉토리 등을 열거하면 됩니다.

몇번 연습해보면 어렵지 않게 실무에 적용할 수 있습니다. ^^



예1) 특정 확장자 (jpg) 를 가진 파일은 제외하고 tar 압축할때

      tar cvf backup.tar --exclude *.jpg /home/nplecom/public_html/


예2) 특정 다중 확장자 (jpg, gif, zip) 를 가진 파일은 제외하고 tar 압축할때

      tar cvf backup.tar --exclude *.jpg --exclude *.gif --exclude=*.zip /home/nplecom/public_html/

예3) 특정 디렉토리 (session) 은 제외하고 tar 압축할때

      tar cvf backup.tar --exclude session /home/nplecom/public_html/








2010/05/26 09:52 2010/05/26 09:52








마음튼튼 이 작성.

당신의 의견을 작성해 주세요.

[로그인][오픈아이디란?]
오픈아이디로만 댓글을 남길 수 있습니다


대용량 하드 파티셔닝 
작성자 : neosky (www.seroot.com, www.nple.com)
작성일 : 2008년 6월 17일



1. fdisk에서 2TB 이상의 파티션을 지원하지 못하므로, 2TB 이상 파티션을 구성하기 위해서는
   다음과 같은 방법에 따라 작업을 해줘야 합니다.

2. fdisk 명령으로 전체 하드 용량을 확인한다.

[root@localhost ~]# fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

.. 중간 출력부분 생략 ..

Disk /dev/sdb: 3499.9 GB, 3499925438464 bytes
255 heads, 63 sectors/track, 425508 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

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


3. parted 명령으로 파티셔닝 한다.

[root@localhost ~]# parted /dev/sdb   <-- 파티셔닝 할 스토리지 지정
GNU Parted 1.8.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt  
(parted) print   <-- 하드 정보를 확인합니다.

Model: AMCC 9650SE-8LP DISK (scsi)
Disk /dev/sdb: 3500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End  Size  File system  Name  Flags

(parted) mkpart
Partition name?  []?  엔터
File system type?  [ext2]?  엔터
Start? <-- Start 지점은 0으로 설정
End? 3.5TB  <-- 위에서 확인된 전체 용량을 적어준다.
(parted) q


4. 실제 잡혀 있는지 /proc/partitions 를 확인한다.

[root@localhost ~]# cat /proc/partitions
major minor  #blocks  name

   8     0   78150744 sda
   8     1      80293 sda1
   8     2    2096482 sda2
   8     3    2096482 sda3
   8     4          1 sda4
   8     5   10241406 sda5
   8     6    6144831 sda6
   8     7    4096543 sda7
   8     8     329301 sda8
   8     9   53062663 sda9
   8    16 3417895936 sdb
   8    17 3417895902 sdb1

5. /dev/sdb1 을 ext3 방식으로 포멧한다.

[root@localhost ~]#  mkfs.ext3 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
427245568 inodes, 854473975 blocks
42723698 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
26077 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000, 214990848, 512000000, 550731776, 644972544

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

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

6. 포멧 완료된 sdb1 을 마운트 한다.

[root@localhost /]# mkdir data
[root@localhost /]# mount /dev/sdb1 /data
[root@localhost /]# df -Th
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda2     ext3    2.0G  496M  1.4G  27% /
/dev/sda1     ext3     76M   15M   58M  21% /boot
tmpfs        tmpfs    2.0G     0  2.0G   0% /dev/shm
/dev/sda9     ext3     50G  180M   47G   1% /home
/dev/sda8     ext3    312M   11M  286M   4% /tmp
/dev/sda7     ext3    3.8G  1.8G  1.9G  48% /usr
/dev/sda5     ext3    9.5G  253M  8.8G   3% /usr/local
/dev/sda6     ext3    5.7G  580M  4.9G  11% /var
/dev/sdb1     ext3    3.2T  199M  3.0T   1% /data    <-- 3.2T 정상적으로 마운트가 된 것을 확인할 수 있다.


7. fdisk 로 실제 파티셔닝된 정보를 확인한다.

[root@localhost /]# fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          10       80293+  83  Linux
/dev/sda2              11         271     2096482+  83  Linux
/dev/sda3             272         532     2096482+  82  Linux swap / Solaris
/dev/sda4             533        9729    73874902+   5  Extended
/dev/sda5             533        1807    10241406   83  Linux
/dev/sda6            1808        2572     6144831   83  Linux
/dev/sda7            2573        3082     4096543+  83  Linux
/dev/sda8            3083        3123      329301   83  Linux
/dev/sda9            3124        9729    53062663+  83  Linux

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdb: 3499.9 GB, 3499925438464 bytes
255 heads, 63 sectors/track, 425508 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      267350  2147483647+  ee  EFI GPT   
<-- EFI GPT로 잡혀 있는 것을 확인할 수 있음


2010/05/20 14:44 2010/05/20 14:44








마음튼튼 이 작성.

당신의 의견을 작성해 주세요.

[로그인][오픈아이디란?]
오픈아이디로만 댓글을 남길 수 있습니다
« Prev : 1 : 2 : 3 : 4 : 5 : Next »