FreeBSD2012. 5. 10. 12:12

# vi /etc/ssh/sshd_config

 

아래내용 #PermitRootLogin no 를 검색 하여 주석 제거 및 yes 로 변경

 

변경전
# Authentication:

 

#LoginGraceTime 2m
#PermitRootLogin no

#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

 

변경후

# Authentication:

 

#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

Posted by 배움나눔
FreeBSD2012. 5. 10. 12:07

정보 확인

# fdisk

namtop# fdisk

[출력창]
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=3916 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=3916 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 63, size 62910477 (30718 Meg), flag 80 (active)
        beg: cyl 0/ head 1/ sector 1;
        end: cyl 1023/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>

FreeBSD disk 사용량 확인

# df -h

namtop# df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/da0s1a     27G    1.9G     23G     7%    /
devfs          1.0K    1.0K      0B   100%    /dev

 

 

Posted by 배움나눔
FreeBSD2012. 5. 9. 14:34

출처 : http://4pple.tistory.com/3

 

su와 sudo는 root외의 계정에서 root의 권한을 얻어 작업을 하기 위해 사용하는 유틸리티이다. FreeBSD에서는 su는 wheel 그룹에서만 가능하고 sudo는 기본적으로 설치되어 있지 않다. 따라서 su와 sudo를 사용하기 위해서는 다음과 같은 작업이 필요하다.

su

su는 사용자를 변경하여 root 계정의 shell을 실행할때 사용하는 유틸리티이다. FreeBSD에서는 사용자가 wheel 그룹에 속해 있어야만 사용할 수 있다. 만일 su를 사용할 때 다음과 같은 오류를 만났다면 해당 사용자의 그룹을 확인해보자.


$ su
su: Sorry 


사용자 계정을 wheel 그룹에 추가하기 위해서는 pw 명령어를 사용한다. 다음은 target이라는 사용자 계정을 wheel 그룹에 추가하는 방법이다.

$ pw user mod target -G wheel


target 계정이 속한 그룹을 확인하기 위해 다음과 같이 입력해본다.

$ gr

oups target


또한, 위의 pw명령어를 사용하는 방법 외에도 /etc/group 파일에서 wheel 그룹의 마지막에 target 계정을 추가함으로써 wheel 그룹에 추가할 수 있다. 다음은 vi /etc/group 를 이용할 때의 추가 방법이다.

Wheel:*:0:root,target



sudo

sudo는 su와는 다르게 하나의 명령을 실행할 때 root 권한으로 실행하는 방법이다. 위에서 이야기 했듯이 sudo는 FreeBSD에서 기본적으로 설치되어 있지 않기 때문에 추가로 설치해야 한다.

$ cd /usr/ports/security/sudo
$ make install clean

또는 

$ pkg_add -r sudo


sudo를 설치한 이후에도 sudo를 사용하기 위해 할일이 있다. 이는 사용자에게 sudo를 사용할 수 있도록 추가해 줘야 하는 것인데, /usr/local/etc/sudoers 파일을 수정하여 할 수 있다. 만일 해당 사용자가 추가되어 있지 않으면 FreeBSD는 다음과 같은 메세지를 출력한다

$ sudo ls
target is not in the sudoers file. This incident will be reported.


/usr/local/etc/sudoers 파일을 직접 수정하는 것은 매우 위험한 일이기 때문에 root 계정으로 로그인 한뒤 visudo를 이용해 편집하는 것을 추천한다. 여러가지 옵션들이 미리 작성되어 주석으로 처리되어 있는데 wheel 그룹의 모든 사용자에게 sudo를 사용할 수 있도록 하려면 다음의 부분에서 주석(# 으로 표시)을 제거하면 된다.

## Uncomment to allow members of group sheel to execute any command
# %wheel ALL=(ALL) ALL


이 후 부터는 wheel 그룹의 모든 사용자가 sudo를 사용할 수 있다.
Posted by 배움나눔
FreeBSD2012. 5. 9. 11:50

출처 : http://hbesthee.tistory.com/584

 

freebsd-update로 간단하고 손쉽게 패치들을 적용할 수 있게 되었습니다.

커널을 업그레이들 하려면, 다음과 같은 순서로 작업을 합니다.

  1. 모든 패키지가 최신으로 업그레이드 되어 있고, 잘 설치되는지 확인 : portupgrade -af
  2. 커널의 메이저 및 마이너 업그레이드를 위하여 패치 파일 다운로드 : freebsd-update -r 7.2-RELEASE upgrade
  3. 패치 적용 : freebsd-update install
  4. 재부팅 한 이후에 다시 남은 패치 적용 : freebsd-update install
  5. 패키지에 문제가 있으면, 패키지 재 설치

# portupgrade -f ruby
# rm /var/db/pkg/pkgdb.db
# portupgrade -f ruby18-bdb
# rm /var/db/pkg/pkgdb.db /usr/ports/INDEX-*.db
# portupgrade -af

저의 경우 다음과 같은 오류가 발생하였었습니다.

stone# freebsd-update fetch
Looking up update.FreeBSD.org mirrors... 2 mirrors found.
Fetching public key from update4.FreeBSD.org... failed.
Fetching public key from update5.FreeBSD.org... failed.
No mirrors remaining, giving up.



원인을 분석하기 위해서 7.2 Release 버전에 대한 공개키를 받는 것에 문제가 없는지 확인합니다.

stone# fetch -vvv http://update1.FreeBSD.org/7.2-RELEASE/i386/pub.ssl
scheme:   [http]
user:     []
password: []
host:     [update1.FreeBSD.org]
port:     [0]
document: [/7.2-RELEASE/i386/pub.ssl]
---> update1.FreeBSD.org:80
looking up update1.FreeBSD.org
connecting to update1.FreeBSD.org:80
requesting
http://update1.FreeBSD.org/7.2-RELEASE/i386/pub.ssl
>>> GET /7.2-RELEASE/i386/pub.ssl HTTP/1.1
>>> Host: update1.FreeBSD.org
>>> User-Agent: fetch libfetch/2.0
>>> Connection: close
>>>
<<< HTTP/1.1 200 OK
<<< Date: Tue, 02 Jun 2009 13:20:01 GMT
<<< Server: Apache/1.3.41 (Unix)
<<< Cache-Control: max-age=60
<<< Expires: Tue, 02 Jun 2009 13:21:01 GMT
<<< Last-Modified: Sat, 02 May 2009 18:02:40 GMT
last modified: [2009-05-02 18:02:40]
<<< ETag: "702e56-320-49fc8ac0"
<<< Accept-Ranges: bytes
<<< Content-Length: 800
content length: [800]
<<< Connection: close
<<< Content-Type: text/plain
<<<
offset 0, length -1, size -1, clength 800
remote size / mtime: 800 / 1241287360
pub.ssl                                       100% of  800  B 2158 kBps

freebsd-update
의 디버깅을 아래와 같이 진행합니다.
stone# freebsd-update -v debug -s update.FreeBSD.org upgrade -r 7.2-RELEASE
Looking up update.FreeBSD.org mirrors... 2 mirrors found.
Fetching public key from update5.FreeBSD.org... fetch:
http://update5.FreeBSD.org/7.0-STABLE/i386/pub.ssl: Not Found
failed.
Fetching public key from update4.FreeBSD.org... fetch:
http://update4.FreeBSD.org/7.0-STABLE/i386/pub.ssl: Not Found
failed.
No mirrors remaining, giving up.



위 디버깅 정보를 보면, 공개키가 들어 있는 파일을 가져오는곳에서 문제가 발생하는 것을 알 수 있습니다.
현재 커널의 정보를 확인해 보았더니, 아래와 같았습니다.

stone# uname -a
FreeBSD stone.bflysoft.kr 7.0-STABLE FreeBSD 7.0-STABLE #1: Thu Mar 20 08:52:44 UTC 2008  i386



서버의 릴리즈 정보에 해당하는 공개키가 없어서 문제가 발생하는 것이므로, 아래와 같이 임시적으로 서버의 버전 정보를 수정합니다.

stone# setenv UNAME_r 7.0-RELEASE
stone# uname -a
FreeBSD stone.bflysoft.kr 7.0-RELEASE FreeBSD 7.0-STABLE #1: Thu Mar 20 08:52:44 UTC 2008 i386



위와 같이 릴리즈 정보가 변경되었음을 확인한 이후에 다시 freebsd-update를 시도하여 그제서야 마이너 업그레이드가 제대로 진행이 되었습니다.

업그레이드가 진행중에 다음과 같은 메시지가 표시되면서 각종 텍스트 파일의 수정이 필요합니다.

stone# freebsd-update -r 7.2-RELEASE upgrade                              
Looking up update.FreeBSD.org mirrors... 2 mirrors found.
Fetching metadata signature for 7.0-RELEASE from update4.FreeBSD.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 1 metadata files... done.
Inspecting system... done.

The following components of FreeBSD seem to be installed:
kernel/generic src/base src/bin src/cddl src/contrib src/crypto src/etc
src/games src/gnu src/include src/krb5 src/lib src/libexec src/release
src/rescue src/sbin src/secure src/share src/sys src/tools src/ubin
src/usbin world/base world/dict world/doc world/games world/info
world/manpages world/proflibs

The following components of FreeBSD do not seem to be installed:
src/compat world/catpages

Does this look reasonable (y/n)? y

Fetching metadata signature for 7.2-RELEASE from update4.FreeBSD.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 1 metadata files... done.
Inspecting system... done.
Fetching files from 7.0-RELEASE for merging... done.
Preparing to download files... done.
Attempting to automatically merge changes in files... done.

The following file could not be merged automatically: /etc/defaults/periodic.conf
Press Enter to edit this file in vi and resolve the conflicts
manually...



버전 정보에 따라 절절히 모든 파일을 수정해 줍니다.

그리고 난 후에 install 합니다.

stone# freebsd-update install
Installing updates...
Kernel updates have been installed.  Please reboot and run
"/usr/sbin/freebsd-update install" again to finish installing updates.



재부팅 이후에, 다시 한번 freebsd-update install하면 업그레이드가 마무리 됩니다.

'FreeBSD' 카테고리의 다른 글

FreeBSD disk partition 정보 확인  (0) 2012.05.10
FreeBSD su sudo 사용 방법  (0) 2012.05.09
freebsd-update를 이용한 보안 업데이트  (0) 2012.05.09
FreeBSD 8.2 APM 설치  (0) 2012.05.09
FreeBSD + APM + cacti 설치  (0) 2012.05.09
Posted by 배움나눔
FreeBSD2012. 5. 9. 11:39

출처 : http://sunkyu.tistory.com/71456

 

FreeBSD를 위한 자동 바이너리 보안 업데이트 시스템 개요

1.
원문 출처

http://www.daemonology.net/freebsd-update/index.html
http://www.daemonology.net/freebsd-update/binup.html
http://www.daemonology.net/bsdiff/index.html

2. freebsd-update
설치

자동 바이너리 보안 업데이트 시스템(이하 freebsd-update)를 사용하려면

/usr/ports/security/freebsd-update
에서 포트를 직접 설치하고

/usr/local/etc/freebsd-update.conf.sample
freebsd-update.conf

복사하여 사용하면 됩니다
.

현재 1.4 대의 클라이언트 프로그램이 나와 있는 상태이므로

1.3 port
라면 먼저 cvsup으로 ports을 업그레이드하고 설치하면 됩니다
.

3. freebsd-update
사용 가능 여부

freebsd-update
사용 가능한 버젼은 현재 4.7, 4.8, 4.9이며

공식 FreeBSD 배포판만(official FreeBSD distribution) 업데이트가 가능하며

일부를 재컴파일하였다면 모든 필요한 파일이 업데이트되지 않을 수도 있습니다
.
하지만 이 경우 1.4.1 버젼의 클라이언트를 사용한다면 업데이트되지 않는 파일에 대한

경고 메시지를 보여줍니다.(-q, quiet 옵션을 사용하지 않았을 경우에 해당
)

)
[root@bsd etc]# freebsd-update fetch
Fetching updates signature...
Fetching hash list signature...
Examining local system...

The following files are affected by security
fixes, but cannot be updated because they
have been modified locally:

/usr/libexec/named-xfer
/usr/sbin/named

No updates available

4. freebsd-update
사용 방법

클라이언트 프로그램을 설치하였다면 다음 과정을 거쳐 바이너리가 업데이트 됩니다
.
-
바이너리 보안 업데이트 가져오기

# freebsd-update fetch

-
바이너리 보안 업데이트 설치하기

# freebsd-update install

- freebsd-update cron
사용하기

약 매 3600(1시간)마다 updates를 확인하여 다운로드한 후

관리자에게 메일로 알려줍니다. 특별한 언급이 없는 것으로 보아서는

아마도 root에게 메일을 보낼 듯합니다
.
# freebsd-update cron &

5.
참고 사항

- freebsd-update
는 암호화된 서명을 이용하며 상당한 양의 트래픽 사용을

감소시키기 위해 binary diff(bsdiff, bspatch)로써 배포됩니다
.

- /usr/local/etc/freebsd-update.conf
# Configuration file for freebsd-update-client
#

# Specifies the base URL from which updates will be fetched
URL=http://update.daemonology.net/

# Specifies a trusted public key fingerprint
KEYPRINT=f212b8797f3b2f981a772cdbacccfed9

- freebsd-update install
작업 디렉토리

# ls /usr/local/freebsd-update
md5vals num pub.key updates

# cat md5vals
/usr/libexec/named-xfer$428a22618d68eb27054b19aa7b3fc48e
/usr/libexec/named-xfer$9de98a9f61de848ebbcd6dbaff2e30c7
/usr/sbin/named$35a4c4e6c31eabbd9ac2b991e4d9b82f
/usr/sbin/named$98a01a49593dd0167daae1be4e87e570

# cat updates(
형식
: /path/to/file$oldhash$newhash)
/usr/libexec/named-xfer$428a22618d68eb27054b19aa7b3fc48e$9de98a9f61de848ebbcd6dbaff2e30c7
/usr/sbin/named$98a01a49593dd0167daae1be4e87e570$35a4c4e6c31eabbd9ac2b991e4d9b82f

6.
옵션

usage: freebsd-update [options] command

Options:
-b basedir -- Set the base directory to basedir (default: /)
-d workdir -- Store working files in workdir
(default: /usr/local/freebsd-update/)
-f conffile -- Read configuration options from conffile
(default: /usr/local/etc/freebsd-update.conf)
-q -- Quiet.
-v -- Verbose.

Commands:
fetch -- Fetch updates from server
cron -- Sleep rand(3600) seconds, fetch updates, and send an
email to root if updates were found.
install -- Install downloaded updates
rollback -- Uninstall most recently installed updates
IDS -- For every file which is installed as part of a
binary RELEASE install, compare against a signed
index of "known good" files.

Posted by 배움나눔
FreeBSD2012. 5. 9. 10:48

출처 : http://toybsd.tistory.com/900

 

FreeBSD 8.2에서 APM환경을 구축해보자!

이번에 CentOS에서 FreeBSD로 넘어오면서 Apache + PHP + MySQL환경을 구축을 새로하게 되었다. 내가 마지막으로 사용하던 FreeBSD버전은 8.0이였는데 지난 2월달에 8.2버전이 새로 나와서 설치를 하게 되었다.

이번 글에선 FreeBSD에서 APM환경 구축하기이다. 원래는 MySQL말고 PostgreSQL을 설치를 하고 싶었지만, 지금 사용하고 있는 워드프레스에선 MySQL만 지원을 하기 때문에 어쩔수 없이 MySQL을 설치를 하게 되었다.(플러그인을 사용하면 PostgreSQL도 사용이 가능하지만, MySQL을 사용하는 플러그인도 있기때문에 어쩔수 없이 MySQL을 구축했다. PostgreSQL하고 MySQL하고 포트가 달라서 둘다 설치해도 되지만 서버 스펙이..)

난 포트로 구축을 했다. 설치 순서는 MySQL->Apache22->PHP->PHP-Extension 순이다.

1. MySQL 설치 및 설정

[root@localhost ~]# cd /usr/ports/databases/mysql51-server && make install clean

설치가 끝난뒤 mysql을 활성화 시켜줘야 한다. /etc/rc.conf에 mysql_enable=”YES”를 추가를 해준다.
[root@localhost ~]# echo ‘mysql_enable=”YES”‘ >> /etc/rc.conf

그다음은 mysqld를 올린다.
[root@localhost ~]# /usr/local/etc/rc.d/mysqld start

그런뒤 root패스워드를 지정을 해준다. %%%%부분에 사용할 패스워드를 입력해주면 된다.
[root@localhost ~]# mysqladmin -u root password ‘%%%%%’

이것으로 MySQL은 손쉽게 설치가 되었다. 난 my.cnf는 디폴트로 사용하기로 했다. (나중에 튜닝할 예정)

2. Apache 설치 및 설정

[root@localhost ~]# cd /usr/ports/www/apache22 && make install clean

위 와같이 설치를 하면 도중에 어떤 모듈도 설치할건지가 나오는데, 자기가 필요한 모듈을 선택하고 진행하면 된다. 이후 설치가 끝나면 httpd.conf파일을 조금 수정을 해야할 필요가 있다.

[root@localhost ~]# vim /usr/local/etc/apache22/httpd.conf

149번째줄에 있는 ServerName부분을 주석을 해제 시키고 다음과 같이 수정을 한다.
ServerName 127.0.0.1:80

설정이 간단하게 끝났다. httpd.conf는 자신의 입맛에 맞게 설정을 해주면 된다.

마지막으로 apache22를 활성화를 해준다.

[root@localhost ~]# echo ‘apache22_enable=”YES”‘ >> /etc/rc.conf

3. PHP 설치 및 설정

[root@localhost ~]# cd /usr/ports/lang/php5 && make install clean

위의 명령어를 치면 어떤 모듈을 설치할것인지 나오는데, ‘APACHE’부분을 꼭! 체크하고 설치를 해준다.

설치가 끝나면 extension을 설치를 한다.
[root@localhost ~]# cd /usr/ports/lang/php5-extensions && make install clean

여기서 자신이 필요한 모듈을 설치를 해준다. 필수적으로 해주어야 할것은 ‘MySQL’부분이다. MySQL 모듈을 설치를 해주어야지만 MySQL에 연결을 할수가 있다. xpressengine같은것을 사용하려면 gd 라이브러리도 필요하므로 ‘gd’정도도 체크하면 된다. 나머지는 사용자가 필요에 따라 선택한다.

php 설치가 끝나면 이제 apache에 mime type을 추가를 해주어야 한다.
[root@localhost ~]# echo ‘application/x-httpd-php php’ >> /usr/local/etc/apache22/mime.types

DirectoryIndex에서 php도 추가를 해주어야 한다.
[root@localhost ~]# vim /usr/local/etc/apache22/httpd.conf
httpd.conf에서 217번째 줄에서 다음과 같이 수정한다.
DirectoryIndex index.html index.htm index.php

그리고 apache 데몬을 올린다.
[root@localhost ~]# /usr/local/etc/rc.d/apache22 start

이제 웹브라우저로 접속을 해서 잘 접속이 되는지 확인을 하고  phpinfo()도 넣어서 잘 연동이 되는지도 확인을 해보면 된다.

Posted by 배움나눔
FreeBSD2012. 5. 9. 10:44

출처 : http://visualnet.tistory.com/334

 

FreeBSD + APM + cacti 설치

#vi .cshrc 수정


setenv  LANG ko_KR.UTF-8
setenv  LC_ALL ko_KR.UTF-8
(로케이션 한글 설정)
set prompt = "%B`whoami`%b@`hostname`[%~]#"

#source .cshrc


port 업데이트

cvsup -g -L 2 -h cvsup.jp.freebsd.org /usr/share/examples/cvsup/ports-supfile


1.apache22 설치

whereis apache22

cd /usr/ports/www/apache22
make WITH_MPM=worker install clean (2코어 활성)

선택 옵션에서 mysql 선택하고 탭ok 누르면 된다.

apache22 셋팅은 mysql55-server 와.. php5 를 설치 하고나서 한번에 셋팅 한다..


2. mysql55-server 설치

cd /usr/ports/databases/mysql55-server

#make WITH_CHARSET=utf8 WITH_COLLATION=utf8_general_ci install clean
* EUC-KR을 사용하기 위한 옵션 설치
 # > make WITH_CHARSET=euckr WITH_COLLATION=euckr_korean_ci install clean

utf8로 설치 한다..

#make WITH_CHARSET=utf8 WITH_COLLATION=utf8_general_ci install clean

 특별히 설정할껀 없다.

 

 * mysql 설정파일 복사
 # > cp /usr/local/share/mysql/my-medium.cnf /etc/my.cnf


3. php5 설치

apache22 와 연동하기 위하여..

cd /usr/ports/lang/php5 && make config

설정 화면에서 Build Apache module 선택후.. ok 버튼으로 넘김

cd /usr/ports/lang/php5-extensions

make config install 로 설치

설치 옵션에서 FTP GD MYSQL SOCKETS SNMP 선택후 OK 눌러 설치

설치중 나오는 옵션은 전부 탭눌러서 넘긴다.
설정


1. apache22 설정

cd /usr/local/etc/apache22

vi httpd.conf

AddType 로 검색하여 적당한 곳에..
AddType application/x-httpd-php .php .inc .html
AddType application/x-httpd-php-source .phps


추가한다.


    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php .inc .html
    AddType application/x-httpd-source .phps
이런식으로 적어 주면 된다.

DirectoryIndex 를 검색하여.

DirectoryIndex index.html index.php  추가해준다.


# Virtual hosts
Include etc/apache22/extra/httpd-vhosts.conf

Include 앞에 주석 해제 위와 같이 변경
vi /etc/rc.conf
apache22_enable="YES"


2. mysql 설정

cp /usr/local/share/mysql/my-medium.cnf /etc/my.cnf
vi /etc/rc.conf
mysql_enable="YES" 추가후 리붓

 

3.php 설정
cd /usr/local/etc

cp  php.ini-development php.ini 로 카피 한다.

리붓후
sockstat -4 로 mysql 과 httpd 작동을 확인 한다..

root     sshd       1174  4  tcp4   *:22                  *:*
root     httpd      1147  3  tcp4 6 *:80                  *:*
root     httpd      1147  4  tcp4   *:*                   *:*
mysql    mysqld     1081  11 tcp4 6 *:3306                *:*

4. mysql 나머지 설정..

* 기본 사용자가 mysql로 사용하는 기본 관리 DB 설치
/usr/local/bin/mysql_install_db --user=mysql

---------------------------------------------------------------------------------------

FATAL ERROR: Could not find ./bin/my_print_defaults

 


If you compiled from source, you need to run 'make install' to

copy the software into the correct location ready for operation.

 


If you are using a binary release, you must either be at the top

level of the extracted archive, or pass the --basedir option

pointing to that location.

---------------------------------------------------------------------------------------

위와 같은 오류때문에.. mysql_install_db 가 설치가 안된다고 하면 아래 방법으로 설치

/usr/local/bin/mysql_install_db --user=mysql --basedir=/usr/local

* 관리자 비밀번호 지정 하기
/usr/local/bin/mysqladmin -u root password '패스워드' (패스워드 앞에 '은 엔터옆에 '임)

* 캐릭터셋 점검
 # > mysql -u root -p
      Enter password:
      Welcome to the MySQL monitor.  Commands end with ; or \g.
      Your MySQL connection id is 9 to server version: 5.1.34-log

      Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

      mysql> use test;
      Database changed
      mysql> show variables like 'c%';
      +--------------------------+----------------------------------+
      | Variable_name            | Value                            |
      +--------------------------+----------------------------------+
      | character_set_client     | utf8                            |
      | character_set_connection | utf8                            |
      | character_set_database   | utf8                            |
      | character_set_results    | utf8                            |
      | character_set_server     | utf8                            |
      | character_set_system     | utf8                            |
      | character_sets_dir       | /usr/local/share/mysql/charsets/ |
      | collation_connection     | utf8_general_ci                  |
      | collation_database       | utf8_general_ci                  |
      | collation_server         | utf8_general_ci                  |
      | concurrent_insert        | ON                              |
      | connect_timeout          | 5                                |
      +--------------------------+----------------------------------+
      12 rows in set (0.00 sec)
     
      mysql >

mysql > quit
- 서버설정에 타라 위의 내용이 다를 수 있습니다.
quit 로 빠져 나온다..

 

mysql utf8 적용

vi /etc/my.cnf


[client]
default-character-set=utf8

 

[mysqld]
character-set-server=utf8

 

[mysql]
dafault-character-set=utf8


mysql> use test;
Database changed
mysql> show variables like 'c%';
+--------------------------+----------------------------------+
| Variable_name            | Value                            |
+--------------------------+----------------------------------+
| character_set_client     | utf8                             |
| character_set_connection | utf8                             |
| character_set_database   | utf8                             |
| character_set_filesystem | binary                           |
| character_set_results    | utf8                             |
| character_set_server     | utf8                             |
| character_set_system     | utf8                             |
| character_sets_dir       | /usr/local/share/mysql/charsets/ |
| collation_connection     | utf8_general_ci                  |
| collation_database       | utf8_general_ci                  |
| collation_server         | utf8_general_ci                  |
| completion_type          | NO_CHAIN                         |
| concurrent_insert        | AUTO                             |
| connect_timeout          | 10                               |
+--------------------------+----------------------------------+
14 rows in set (0.01 sec)

mysql>


apm 설치및 셋팅이 끝났다..

 

mysql> status

--------------

mysql  Ver 14.14 Distrib 5.1.60, for portbld-freebsd8.2 (amd64) using  5.2


Connection id: 1048

Current database:

Current user: root@localhost

SSL: Not in use

Current pager: more

Using outfile: ''

Using delimiter: ;

Server version: 5.1.60-log FreeBSD port: mysql-server-5.1.60

Protocol version: 10

Connection: Localhost via UNIX socket

Server characterset: utf8

Db     characterset: utf8

Client characterset: utf8

Conn.  characterset: utf8

UNIX socket: /tmp/mysql.sock

Uptime: 1 day 16 hours 37 min 20 sec


Threads: 1  Questions: 109705  Slow queries: 0  Opens: 1107  Flush tables: 1  Open tables: 54  Queries per second avg: 0.750

--------------


cacti 를 설치 합니다.

기본적으로 apm 이 설치 되어 있어야 한다. php 설치 옵션중 snmp

test# whereis cacti
cacti: /usr/ports/net-mgmt/cacti


cacti: /usr/ports/net-mgmt/cacti
test# cd /usr/ports/net-mgmt/cacti && make install clean

 

mysql 의 db와 계정을 셋팅한다.

# mysql -u root -p

Enter password: **********

---------------------------------------------------


mysql> create database cacti;

mysql> use mysql;

mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'password';

mysql> FLUSH privileges;

mysql> quit


mysql -u root -p cacti < /usr/local/share/cacti/cacti.sql

php.ini timezone 수정

vi /usr/local/etc/php.ini

date.timezone = Asia/Seoul

로 수정

# vi /usr/local/share/cacti/include/config.php
--------------->modify<------------------

#database_type = "mysql";

#database_default = "cacti";

$database_hostname = "127.0.0.1";

$database_hostname = "localhost";

$database_username = "cacti";

$database_password = "password";

$database_port = "3306";

------------------------------------------


vi /etc/rc.conf

snmpd_enable="YES"
snmptrapd_enable="YES"
linux_enable="YES"

cd /usr/local/share/snmp/

cp snmpd.conf.example snmpd.conf

vi snmpd.conf

#trap2sink    localhost public

#rocommunity public  localhost

주석 제거 해 준다.

vi /etc/crontab

*/5 * * * * cacti /usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null 2>&1

추가 해 준다.

리눅스 에뮬레이터 설치
메모리 부분 스크립트가 linux 전용으로 되어 있기 때문에 linux에뮬레이터를 설치 해야 정상적으로 작동한다.
위에 rc.conf 수정에서 linux_enable="YES" 로 한후 리붓을 해야 정상적으로 설치가 가능하다.

rc.conf 를 수정 하지 않고 설치 했을경우

root@cacti.test.com[/usr/ports/emulators/linux_base-f10]#make install clean
===>  linux_base-f10-10_4 linuxulator is not (kld)loaded.
*** Error code 1

Stop in /usr/ports/emulators/linux_base-f10.

와 같은 오류 메시지를 볼수 있다
리눅스 에뮬레이터 사용시 시작스크립트인 rc.conf 에서 리눅스 모듈? 을 불러와야 정상적으로 설치가 된다.

리붓후 다시 설치 하도록 한다.

root@test.crois.net[~]#cd /usr/ports/emulators/linux_base-f10/
root@test.crois.net[~]#make install clean

cacti 메모리 부분 스크립트 변경
리눅스 용으로 작성이 되어 있기때문에 freebsd 에서 구동시키면 정상 작동이 되질 않습니다.
 test# cd /usr/local/share/cacti/scripts/
 test# vi linux_memory.pl

#!/usr/bin/perl

$mem = `cat /compat/linux/proc/meminfo | grep -w "$ARGV[0]"`;
$mem =~ s/($ARGV[0].*\s)(.*[0-9])( kB)//;

print $2;


-------------------------------------------------

linux 에뮬레이터 사용을 위해.
fstab 부분에 설정을 합니다.

 vi /etc/fstab
 linproc   /compat/linux/proc linprocfs rw 0 0

 

vi /etc/crontab

*/5 * * * * cacti /usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null 2>&1


---------------------------------------

root@cacti.test.com[/usr/local/share/cacti/scripts]#cd /usr/local/etc/apache22/
vi httpd.conf

apache 설정

Alias /cacti /usr/local/share/cacti
<Directory "/usr/local/share/cacti">
    AllowOverride None
    Order Allow,deny
    Allow from all
</Directory>

 


root@cacti.test.com[~]#/etc/rc.d/cron restart


--------------------------------------------------------


01/09/2012 10:35:02 AM - PCOMMAND: Poller[0] Host[1] WARNING: Recache Event Detected for Host

오류가 뜨면
php -q /usr/local/share/cacti/cli/poller_reindex_hosts.php -id=2 -d

php -q /usr/local/share/cacti/cli/poller_reindex_hosts.php -id=All

삭제 해 줘야 한다.
오류 관련 설정 페이지

http://docs.cacti.net/manual:087:6_reference.4_cli_script.2_reindex_hosts


정상적으로 snmpd 가 작동 하는걸 보기 위해.. 아래 명령어를 실행해 본다.

snmpwalk -v 2c -c public localhost


-----------------------------------------------------------

cacti 설정


admin:admin 으로 로그인 하고 로그인 후에 비번을 만들어 주면 된다.



 

Devices 부분


Host Template 부분을 ucd/net SNMP Host 로 바꿔 준다.

SNMP Version 을 Version 2 로 바꿔준다.

Associated Graph Templates 에서

2) ucd/net - CPU Usage  Not Being Graphed   
3) ucd/net - Load Average  Not Being Graphed   
4) ucd/net - Memory Usage  Not Being Graphed 


위와 같이 추가를 해준다.

Associated Data Queries 부분에서

1) SNMP - Interface Statistics 추가


그리고 저장.

Management 부분에서

Graph Management

기본으로 되어 있던 설정을 전부 삭제 한다.


다시
Create
New Graphs  부분에서 그래프를 만들어 준다.

 

Collection Methods
Data Queries

부분에서 SNMP - Interface Statistics 를 추가

전부 설치 하고 나면 5분 후 아래와 같은 그래프를 볼수 있다.




----------------------------------------------
설명이 너무 부실하여 도움이 될지는 모르겠지만..
차후좀더 수정 보완하겠습니다.
어설픈글 읽어 주셔서 감사합니다 _(__)_

Posted by 배움나눔
Windows2012. 5. 8. 16:05

출처 : http://cafe.naver.com/hostingfaq/1011

 

Windows 2008 R2 서버 이벤트로그 메일 보내기

 

윈도우2008R2 서버의 이벤트로그 전달 기능을 이용한 특정한 이벤트로그 발생시 관리자가 알람을 메일로 받아 보는 방법입니다.

이를 실행하기 위한 방법으로 아래 같이 명령 프롬프트에서 작업 합니다.

1. wecutil.exe qc             

2. winrm.exe quickconfig  

 

이벤트 뷰어에서 특정이벤트에서 대해서 포워드 기능을 설정 합니다.

 

위의 그림과 같이 이벤트 18456 (EventID=18456) 에 대하여 이벤트 발생시 관리자 메일로 메일 발송을 하도록 이 이벤트에 작업 연결을 합니다.

 

 

위와 같이 EventID 18456 이벤트 아이디로 작업 스케줄러가 생성 된 것을 확인 할 수 있습니다.

 

메일 보내는 것에 대해서 작업이 생성 되었는데 이제 첨부 파일로 이벤트 로그 내용을 첨부하는 스크립트를 추가 합니다.

Windows Events Command Line Utility를 이용하여 아래의 명령어를 실행 합니다.

1. wevtutil qe Application "/q:*[System [(EventID=18456)]]" /rd:true /f:text /c:1

위의 명령을 이용하여 이벤트로그에 내용을 쿼리하여 출력 된 모습입니다.

위의 내용을 메일에 첨부 하기 위하여 배치 파일로 만든 후 생성된 작업 스케줄러 - 이벤트 로그 뷰어 작업에 추가 합니다.

아래와 같이 배치 파일을 생성 합니다.

파일명: event_forward.cmd

위치: C:\event_forward\

배치 파일 소스:

@ECHOOFF                                                                                                                                                      

del C:\event_forward\eventforward.txt                                                                                                        

wevtutil qe Application "/q:*[System [(EventID=18456)]]" /rd:true /f:text /c:1  > C:\event_foreard\eventforward.txt .txt     

배치 파일 생성후 정상 작동을 위해 배치 파일을 실행 합니다.

실행후 정상적으로 출력 파일로 eventforward.txt 파일을 확인 할 수 있습니다.

위의 그림과 같이 작업 스케줄러 - 이벤트 뷰어 작업 - 생성된 작업 항목의 속성을 클릭

동작 탭에 새로만들기 클릭후 생성된 배치파일을 추가 합니다. (작업 추가시 : 프로그램 시작 선택)

추가후 순서가 제일 첫순위로 오게 설정 합니다

전자 메일 보내기 작업을 수정 합니다. 첨부 파일 위치를 [찾아보기] 클릭 후 배치파일 디렉토리의 eventforward.txt 파일을 선택

모든 설정 완료후 새로 생성한 작업 스케줄러를 재실행 합니다.

 

이벤트 ID 18456 발생시 아래와 같이 메일로 확인 하실수 있습니다.

 

참고:

http://blogs.technet.com/b/jhoward/archive/2010/06/16/getting-event-log-contents-by-email-on-an-event-log-trigger.aspx

Posted by 배움나눔
FreeBSD2012. 5. 7. 14:37

출처 : http://visualnet.tistory.com/284

 

버철 박스를 이용하여 10g 하드 512mb ram 으로 설치


1. Boot Freebsd [Default] 을 선택 합니다 (10초후 자동으로 디폴트 선택으로 넘어 갑니다)



2. Country Selection 기본으로 되어 있는 United States 로 선택하여도 무방 합니다.
117 번에 Korea, Republic of 로 선택 하여도 됩니다. (둘다 사용해 봤지만 아직까지는 특별한 차이점을 못느껴 봤습니다.



3. System Console Keymap 부분은 USA ISO 를 선택 합니다.



4. sysinstall Main Menu
기본적인 설치 화면인 sysinstall 부분이 나옵니다.
Standard 를 눌러 줍니다.



5.Message 창이 나오는데 ok 를 눌러 줍니다

 


 




6. 하드부분을 fdisk 합니다.

C 를 눌러 슬라이스를 만들어 줍니다. 용량을 전체를 사용하기 위해 표기 되는 용량을 놔두고.. Tab 을 눌러 ok 를 누릅니다

위에 부분에서도 ok 로 넘겨 줍니다.

q를 눌러 빠져 나가면 됩니다.




7.Install Boot Manager for drive

부트매니저 설치 입니다. 보통 윈도우와 같이 설치 해서 데스크 탑이나 테스트용 으로 듀얼 운영체제를 쓰지
않는다고 하면.. Standard 를 선택해서 넘어 갑니다.

(Standard 설치)



8.Message 부분은 그냥 ok 눌러 넘어 갑니다.



 



 



 



 





 


 


 


 



9. FreeBSD Disklabel Editor (파티션 나누기)
보통 첨에 배울때는 a를 눌러 Auto Defaults 로 했었는데
첨부터 대략적으로 알고 있는게 좋을꺼 같아서 파티션작업을 합니다.
/ 는 600mb 면 충분 합니다.
swap 은 현제 버철 박스에 램이 512mb 니 1024mb 정도면 충분 합니다.
데스크탑으로 쓸때도.. 2048mb 정도가 적당합니다.
swap 은 장착되어 있는 램에  기본적으로 1.5배에서 2배 정도로 설정 합니다
/var (로그가 쌓이는 디렉 토리 입니다. 테스트 용도로 쓸때는 보통 600mb 정도 만 줘도 괜찮습니다 테스트 용도가 아닌
실제로 운영되는 개인용 서버라고 하면 보통 4g ~ 에서 사용하는 용도에 따라 용량을 줍니다.
/tep (temp 디렉토리는 보통 1g 정도로 주면 될꺼 같습니다 테스트 용도로 쓰는 서버에선 600mb 정도 주면 됩니다.
/usr ( 보통적으로 freebsd 에서 port 시스템 이나... pkg_add 로 설치 하는 데몬들이 설치 됩니다. 용량이 조금크게 주는게 좋습니다
테스트 용에선 4g 정도만 주면 됩니다. 기타 데스크 탑이나.. 운영되는 서버 라고 하면.. 보통
10g 에서 용도에 따라 줍니다.
/home ( 사용자 디렉터리 입니다 데스크탑 으로 쓸땐 하드 용량의 나머지를 전부 주면 됩니다.
여기에서도 나머지 용량을 모두 줍니다

용량을 나눌땐 c 를 눌러 만듭니다.
다시 하드를 나눌땐 커서를 맨위에 하드 디스크로 올리고 c 를 눌러 나눠 주면 됩니다.

 

만약 잘못 되었다고 하면 오른쪽 화살표 커서를 이용하여 잘못지정한 곳에 가서 D 버튼을 누르면 지워 집니다.

 

파티션 나누기가 끝났으면.. q를 눌러 빠져 나가면 됩니다.



10. Choose Distributions

기본적인 테스트용으로 쓰기 위해.. 5번 Kern-Developer 를 선택 합니다.



11. FreeBSD Documentation Installation Menu
kr 은 없군요.. ㅠㅠ en 을 선택 합니다.



 


12. User confirmation Requsted

yes 를 넘겨 넘깁니다.


13.  cd/dvd  install from a FreeBSD CD/DVD  를 눌러 설치 합니다.



 


14. ok 를 눌러 설치 합니다.



15. User Confirmation Requsted
Would you like to configure any Ethernet network devices?

이더넷 카드를 사용하기 위해 yes 를 선택 합니다.



16.User Confirmation Requsted
Do you want to try IPv6 configuration fof the insterface?

현재 IPv4 버젼을 쓰고 있기 때문에 No 라고 선택 하면 됩니다.



17 User Confirmation Requested
Do you want to try DHCP configuration of the interface?

(보통 서버에선 DHCP 를 사용하지 않습니다 ip 가 자주 변하기 때문입니다.
DHCP server 나 DHCP client 에 관해선 따로 언급 하겠습니다.)
수동으로 ip 를 잡기 위해 No를 선택 합니다.


 


18 수동으로 서버 도메인및 ip 를 셋팅 하시면 됩니다.
Host 부분에 풀도메인을 쓰시면 되고
Domain 부분은 자동적으로 넘어 갑니다.
IPv4 Gateway 부분은 공유기를 쓰고 계시다고 하면 공유기 주소를 적어 놓으시면 됩니다.
아이피 타임 같은 공유기는 192.168.0.1 이렇게 쓰시면 됩니다.
Name server 는 168.126.63.1 이렇게 적으시면 됩니다. kt dns server 주소 입니다.
구굴 dns 가 8.8.8.8 이던데 잘 사용은 안해 봤습니다.

Netmask 부분은. 255.255.255.0 쓰시면 됩니다.

이렇게 하시고 ok 눌러 넘어 갑니다.

여기에 아이피 주소나 따로 잘못 쓰셨다고 하면
나중에 /etc/rc.conf 파일을 수정하면 됩니다.
네트워크 인터페이스 ip 주소는 /etc/rc.conf 를 수정 하면 되고 
nameserver (dns) 는 /etc/resolv.conf 를 수정 하면 됩니다.

19. User Confirmation Requested
Would you like to bring the em0 interface up right now?

네트웍 인터페이스 활성화 정도로 이해 하시면 될꺼 같군요.
Yes 를 선택 합니다.



20. User Confirmation Requested
Do you want this machine to function as a network gateway?

게이트웨이 로 사용안하기 때문에 No 를 선택 합니다.



21.  User Confirmation Requested
Do you to configure inetd and the network services that it provides?
inetd 를 사용할껀지 물어 보는 내용입니다. 따로 sshd 및 ftp 등을 사용하기 때문에.
No 를 선택 합니다.
기본적으로 inetd 에서 sshd ftp telnet 등을 제공 하고 있지만 요즘은 따로 셋팅해서 쓰고 있습니다.



22  User Confirmation Requested
Would you like to enable SSH login?

따로 설정 하기 때문에 No 를 선택 합니다.



23.  User Confirmation Requested
Do you want to have anonymous FTP access to this machine ?

익명 FTP 서버 를 사용하지 않기 때문에 No 를 선택 합니다.



24. User Confirmation Requested
Do you want to configure this machine as an NFS server ?
 NFS 서버를 사용하지 않기 때문에 No 를 선택 합니다.



25.  User Confirmation Requested
Do you want to configure this machine as an NFS client ?
NFS client 를 사용하지 않기 때문에 No 를 선택 합니다.



26. User Confirmation Requested
Would you like to customize your system console setting ?
Yes 를누릅니다



27. System Console Configuration

Repeat 를 선택 합니다.
fast 를 선택 하고 나옵니다.

Repeat 를 따로 fast 로 하지 않고 넘어 가면.. 콘솔에서 키보드 감이 약깐 느린걸 느낄수 있습니다.

다 하셨으면 exit 를 누릅니다.




28 User Confirmation Requested

Would you like to set this machine's time zone now?

 time zone 설정 입니다. yes를 눌러 줍니다.



29 Select local or UTC (Greenwich Mean Time ) clock
Is this machine's CMOS clock set to UTC? If it is set to local time, or
you don't know, please choose NO here!

No 를 선택 합니다 
 



 


 


30 asia 에 Korea, Republic of 를 선택 합니다.


31. User Confirmation Requested
Does this system have a PS/2, serial, or bus mouse?

No 를 선택 합니다


32.User Confirmation Requested

The FreeBSD package collection is a collection of thousands of ready-to-run applications, from text
editors to games to Web servers and mor. Would you like to browse the collection now?

설치가 끝난후 필요한 패키지를 설치 하기 때문에  때문에.. no 를 선택 합니다.



33. User Confirmation Requested

Would you like to add any initial user accounts to the system?
Adding at least one account for yourself at his stage is suggested since working as the "root" user is dangerous
(it is easy to do things which adversely affect the entire system).

유저 추가 및 root 암호 설정 입니다 YES 를 선택 합니다.


 


 



34 . User and group management

The submenus here allow to manipulate user groups and login accounts.

유저를 추가 하기 위해 User 을 선택 합니다.

35.  User and group management
Login ID:
대략적인 아이디를 넣어 줍니다.

password 부분에 특수 문자를 포함해서 외울수 있는 아주긴 패스워드를 만듭니다....;;;;;
(테스트용도로 쓸땐 편하게 하시는게 좋습니다..)

Member groups 만 wheel 이랗고 만들어 줍니다.
나중에 ssh 로 로그인 하여.. su 명령어로 root 가 될수 있도록.

다 끝나셨으면 ok 눌러 나갑니다.

exit 를 선택 합니다.


36. Message

Now you must set the system manager's password.
This is the password you'll use to log in as "root"

ok 를 눌러 넘어 갑니다.


 


root 패스워드를 눌러 줍니다.
패스워드는 보이지 않습니다.


37 .  User and group management

Visit the general configuration menu for a chance to set any last optins?

 No 를 선택 합니다. 



38 . 수고 하셨습니다 freebsd 설치는 끝났습니다. 보통 .. 어느정도.. 설치 매뉴만 외운다고 하면.. 5~7분 정도면 모든 설치가 끝납니다.
초기 화면 으로 나왔으면 E Exit Install 을 눌러 빠져 나갑니다.



39 User Confimation Requested

Are you sure you wish to exit? The system will reboot.

yes 를 선택 하여 리붓 하여 줍니다.

 // 대략 적인 설치가 다 끝났습니다.
이제 설치 후 csup 로 포트업데잇 하고 기본적인 sshd 설정을 /etc/rc.conf 수정 하여 sshd_enable="YES"
등 해주고 사용하면 됩니다.

Posted by 배움나눔
FreeBSD2012. 5. 7. 10:41

출처 : http://www.allsoft.co.kr/bbs/board.php?bo_table=tip_tech&wr_id=9

 

1. 기본 네트웍 설정

1.1 /etc/hosts.allow 설정

보안상의 이유로 inetd로 서비스되는 데몬들의 경우 hosts.allow 파일을 편집하여 차단합니다.

#>  /etc/hosts.allow
ALL : localhost 127.0.0.1 : allow
sshd : ALL : allow
proftpd : xxx.xxx.xxx.xxx / yyy.yyy.yyy.yyy : allow

# The rest of the daemons are protected.
ALL : ALL \
     : severity auth.info \
     : twist /bin/echo "You are not welcome to use %d from %h."
#>

위의 설정으로 localhost 시스템 상에서 시스템 상이 서비스에는 모든 접근을 허용하고, sshd는 모두에게 허용, Proftpd 즉 FTP는 xxx.xxx.xxx.xxx / yyy.yyy.yy.yyy에 해당되는 호스트들에게만 허용, 그리고 나머지 모든 서비스들에 접근 시 경고문만 보여주게 됩니다.


1.2 네트워크 설정

#> ifconfig -l
dc0 faith0 lo0 ppp0 sl0

여기서 dc0이 intel 10/100BaseTX 이더넷카드 디바이스명입니다. faith0의 경우는 IP6-to-IP4 translation용
가상장치이고 lo0은 로컬호스트 장치명, ppp0은 전화접속 장치명, sl0은 파라렐포트 연결장치명입니다.
dc0을 제외한 나머지는 기본으로 생성됩니다.

#> dmesg | more

위 명령을 쳐서 어떤 네트워크 카드가 인식되었는지 확인 가능합니다.

FreeBSD에서는 대부분의 시스템 전반적인 설정을 /etc/rc.conf에서 할 수 있습니다.

#> /etc/rc.conf

network_interface="dc0 lo0"
Ifconfig_lo0="inet 127.0.0.1"
Ifconfig_dc0="inet 192.168.1.2 netmast 255.255.255.0 media 100BaseTX/UTP mediaopt full-duplex"
hostname="myhost"
defaultrouter="192.168.1.1"
#>

network_interface : 네트워크 장치들을 열거합니다. 여기선 dc0과 lo0을 추가했습니다.
ifconfig_lo0 : 127.0.0.1로 설정하는 것으로 충분
ifconfig_dc : inet 뒤에 서버의 IP주소, netmask 뒤엔 넷마스크, 그 뒷 부분은 옵션입니다.
hostname : 호스트명 입력, 임의대로 지정할 수 있습니다.
defaultrouter : 기본 게이트웨이/라우터 주소를 적습니다.

이번엔 DNS 주소를 설정합니다. /etc/resolv.conf 파일에 추가합니다. 파일이 없다면 새로 생성합니다.

#> /etc/resolv.conf

domain myhost
nameserver 192.168.1.2
nameserver xxx.xxx.xxx.xxx
nameserver yyy.yyy.yyy.yyy
#>

DNS 서버 주소는 최대 3개까지 지정할 수가 있습니다. 직접 DNS도 운영할 것이므로 자신의 서버 아이피
주소를 먼저 넣어주고 그 아래에 자신이 계약을 맺은 ISP회사의 DNS서버 주소를 넣어주면 됩니다.

내부호스트나 자주 접속하는 호스트의 주소들을 /etc/hosts에 추가해줍니다.
기본 로컬호스트와 공인 IP 추가.

#> /etc/hosts

127.0.0.1 localhost localhost.localdomain
192.168.1.1 myhost myhost.mydomain
#>

이제 시스템을 reboot하고 네트워크가 잘 잡혔는지, 작동하는지 ping, nslookup으로 확인해 봅니다.

 

------------  별도 페이지 ---------------------

출처 : ftp://ftp.kr.freebsd.org/pub/FreeBSD-kr/doc/www/htdocs/fom-serve/cache/51.html

대략 2가지 방법이 있습니다.
첫번째로 /etc/rc.conf파일을 수정해 주는 것입니다. 다음은 rc.conf파일의 예입니다.

ifconfig_fxp0="inet 155.230.12.92  netmask 255.255.252.0"
hostname="tenet2.knu.ac.kr"
defaultrouter="155.230.12.1"

위에 보이는 부분을 적당히 변경해주고 리부팅을 시켜주면 됩니다.

리부팅을 못할 경우는 다음과 같은 방법이 가능합니다.
먼저 "ifconfig -a"해 보시면 자신의 network 카드 이름과 아이피 주소 등을 알 수 있습니다. 결과는 다음과 비슷할 것입니다.
tenet2@~> ifconfig -a
fxp0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet 155.230.12.92 netmask 0xfffffc00 broadcast 155.230.15.255
        ether 00:d0:b7:09:4a:f9
        media: autoselect (10baseT/UTP) status: active
        supported media: autoselect 100baseTX <full-duplex> 100baseTX 10baseT/UTP <full-duplex> 10baseT/UTP
tun0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
        inet 127.0.0.1 netmask 0xff000000

아이피 주소의 변경은 위와 같은 환경에서 다음과 같이 합니다.
ifconfig fxp0 down
ifconfig fxp0 up 155.230.12.100 netmask 0xfffffc00

아이피 주소가 변경되어 디폴트 라우터의 주소또한 변경되어야 하는 경우는 route명령을 사용합니다. 우선 "netstat -rn" 으로 라우팅 테이블을 확인해 봅니다.
tenet2@~> netstat -rn
Routing tables
Internet:
Destination        Gateway            Flags     Refs     Use     Netif Expire
default            155.230.12.1       UGSc        5        9     fxp0
127.0.0.1          127.0.0.1          UH          0       66      lo0
155.230.12/22      link#1             UC          0        0     fxp0
155.230.12.1       40:bb:82:10:1:21   UHLW        5        0     fxp0   1171
155.230.12.4       8:0:20:a6:7e:a7    UHLW        0        8     fxp0   1182
--생략--

이제 디폴트 라우터 변경을 위해서는 다음과 같이
route delete default
route add default 155.230.16.1

자 다시 "netstat -rn"으로 라우팅 테이블이 변경되었나 확인해 보세요.

참고로 DNS의 설정은 /etc/resolv.conf파일에서 수정합니다. 다음은 resolv.conf의 예입니다.

domain  knu.ac.kr
nameserver      155.230.12.4


 

Posted by 배움나눔