본문 바로가기

Linux/보안

트래픽 모니터링 프로그램 - bandwidthd


bandwidthd

- 간단한 시스템 트래픽 모니터링 프로그램으로 서버시스템의 트래픽과 서비스별 트래픽을 알 수 있다.

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

http://bandwidthd.sourceforge.net/

http://sourceforge.net/project/showfiles.php?group_id=89685&package_id=94109&release_id=296308

bandwidthd-2.0.1.tgz : (다운로드)

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

bandwidthd 관련 의존성 파일

http://www.tcpdump.org/

libpcap-1.0.0.tar.gz : (다운로드)

http://www.libpng.org/ or http://www.libpng.org/pub/png/libpng.html

libpng-1.2.34.tar.gz : (다운로드)

http://www.libgd.org/Downloads

gd-2.0.36RC1.tar.gz : (다운로드)

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



1. 다운 및 압축 해제

 
[root@server3 ~]# cd Desktop
[root@server3 Desktop]# ls
bandwidthd-2.0.1.tgz   

[root@server3 Desktop]# tar xvfz bandwidthd-2.0.1.tgz
bandwidthd-2.0.1/

- 중략

bandwidthd-2.0.1/conf.l.c
bandwidthd-2.0.1/config.guess
bandwidthd-2.0.1/conf.tab.h
bandwidthd-2.0.1/README
bandwidthd-2.0.1/Makefile.in
bandwidthd-2.0.1/htdocs/
bandwidthd-2.0.1/htdocs/logo.gif
bandwidthd-2.0.1/htdocs/legend.gif
bandwidthd-2.0.1/install-sh
bandwidthd-2.0.1/CHANGELOG
[root@server3 Desktop]# ls
bandwidthd-2.0.1                 
bandwidthd-2.0.1.tgz   
          
[root@server3 Desktop]# mv bandwidthd-2.0.1 /usr/local/src




2. 설치 정보 확인

 
[root@server3 Desktop]# cd /usr/local/src
[root@server3 src]# ls
bandwidthd-2.0.1                
[root@server3 src]# cd bandwidthd-2.0.1/
[root@server3 bandwidthd-2.0.1]# ls
CHANGELOG        TODO          conf.tab.c    config.sub    htdocs
INSTALL.Unix     bandwidthd.c  conf.tab.h    configure     install-sh
INSTALL.Windows  bandwidthd.h  conf.y        configure.in  phphtdocs
Makefile.in      conf.l        config.guess  etc           schema.postgresql
README           conf.l.c      config.h.in   graph.c

[root@server3 bandwidthd-2.0.1]# vi INSTALL.Unix
#### INSTALLATION #

You need 3 dependencies to make Bandwidthd work: - 3개의 파일이 의존성에 걸린다. 설치가 안되어 있으면 설치를 한다.

libpcap from http://www.tcpdump.org/
libpng from http://www.libpng.org/
libgd from http://www.boutell.com/gd/




3. 의존성 해결

- APM을 RPM으로 설치한 경우에는 libpcap, libpng, libgd 도 devel과 같이 설치해 준다.
- APM을 소스로 설치한 경우에는 libpcap, libpng, libgd 도 소스로 설치해 준다.
- libpcap, libpng, libgd 를 소스로 설치한 후 bandwidth 컴파일시 제대로 인식을 못한다면 각각의 devel (RPM) 을 설치해 준다.



3-1. libpcap 설치

http://www.tcpdump.org/

libpcap-1.0.0.tar.gz : (다운로드)

 
[root@server3 ~]# cd Desktop
[root@server3 Desktop]# ls
bandwidthd-2.0.1.tgz  libpcap-1.0.0.tar.gz
gd-2.0.36RC1.tar.gz   libpng-1.2.34.tar.gz
[root@server3 Desktop]# tar xvfz libpcap-1.0.0.tar.gz
libpcap-1.0.0/

- 중략

libpcap-1.0.0/Win32/Src/
libpcap-1.0.0/Win32/Src/ffs.c
libpcap-1.0.0/Win32/Src/gai_strerror.c
libpcap-1.0.0/Win32/Src/getaddrinfo.c
libpcap-1.0.0/Win32/Src/getnetbynm.c
libpcap-1.0.0/Win32/Src/getnetent.c
libpcap-1.0.0/Win32/Src/getopt.c
libpcap-1.0.0/Win32/Src/getservent.c
libpcap-1.0.0/Win32/Src/inet_aton.c
libpcap-1.0.0/Win32/Src/inet_net.c
libpcap-1.0.0/Win32/Src/inet_pton.c
[root@server3 Desktop]# ls
gd-2.0.36RC1.tar.gz 
libpcap-1.0.0.tar.gz   libpcap-1.0.0
bandwidthd-2.0.1.tgz  libpng-1.2.34.tar.gz

[root@server3 Desktop]# mv libpcap-1.0.0 /usr/local/src
[root@server3 Desktop]# cd /usr/local/src
[root@server3 src]# ls
libpcap-1.0.0    bandwidthd-2.0.1
[root@server3 src]# cd libpcap-1.0.0/
[root@server3 libpcap-1.0.0]# ls
CHANGES            lbl                          pcap_compile.3pcap.in
CREDITS            llc.h                        pcap_create.3pcap
ChmodBPF           missing                      pcap_datalink.3pcap.in
INSTALL.txt        mkdep                        pcap_datalink_name_to_val.3pcap
LICENSE            msdos                        pcap_datalink_val_to_name.3pcap
Makefile.in        nametoaddr.c                 pcap_dump.3pcap
README             net                          pcap_dump_close.3pcap
README.Win32       nlpid.h                      pcap_dump_file.3pcap
README.aix         optimize.c                   pcap_dump_flush.3pcap
README.dag         org.tcpdump.chmod_bpf.plist  pcap_dump_ftell.3pcap
README.hpux        packaging                    pcap_dump_open.3pcap.in
README.linux       pcap                         pcap_file.3pcap
README.macosx      pcap-bpf.c                   pcap_fileno.3pcap
README.septel      pcap-bpf.h                   pcap_findalldevs.3pcap
README.sita        pcap-bt-linux.c              pcap_free_datalinks.3pcap
README.tru64       pcap-bt-linux.h              pcap_freealldevs.3pcap
SUNOS4             pcap-config.1                pcap_freecode.3pcap
TODO               pcap-config.in               pcap_get_selectable_fd.3pcap

- 중략

[root@server3 libpcap-1.0.0]# vi README.linux

[root@server3 libpcap-1.0.0]# ./configure --help
`configure' configures this package to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR           user executables [EPREFIX/bin]
  --sbindir=DIR          system admin executables [EPREFIX/sbin]
  --libexecdir=DIR       program executables [EPREFIX/libexec]
  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
  --libdir=DIR           object code libraries [EPREFIX/lib]
  --includedir=DIR       C header files [PREFIX/include]
  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
  --datarootdir=DIR      read-only arch.-independent data root [PREFIX/share]
  --datadir=DIR          read-only architecture-independent data [DATAROOTDIR]
  --infodir=DIR          info documentation [DATAROOTDIR/info]
  --localedir=DIR        locale-dependent data [DATAROOTDIR/locale]
  --mandir=DIR           man documentation [DATAROOTDIR/man]
  --docdir=DIR           documentation root [DATAROOTDIR/doc/PACKAGE]
  --htmldir=DIR          html documentation [DOCDIR]
  --dvidir=DIR           dvi documentation [DOCDIR]
  --pdfdir=DIR           pdf documentation [DOCDIR]
  --psdir=DIR            ps documentation [DOCDIR]

System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
  --target=TARGET   configure for building compilers for TARGET [HOST]

Optional Features:
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --disable-largefile     omit support for large files
  --disable-protochain    disable \"protochain\" insn
  --enable-ipv6           build IPv6-capable version [default=yes, if getaddrinfo available]
  --enable-optimizer-dbg  build optimizer debugging code
  --enable-yydebug        build parser debugging code

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --without-gcc           don't use gcc
  --with-sita             include SITA support
  --with-pcap=TYPE        use packet capture TYPE
  --with-dag[=DIR]        include Endace DAG support ("yes", "no" or DIR; default="yes" on BSD and Linux if present)
  --with-dag-includes=DIR   Endace DAG include directory
  --with-dag-libraries=DIR  Endace DAG library directory
  --with-septel[=DIR]     include Septel support (located in directory DIR, if supplied).  default=yes, on Linux, if present
  --without-flex          don't use flex
  --without-bison         don't use bison

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

[root@server3 libpcap-1.0.0]# ./configure --prefix=/usr/local/libpcap

- 중략

config.status: creating Makefile
config.status: creating pcap-filter.manmisc
config.status: creating pcap-linktype.manmisc
config.status: creating pcap-savefile.manfile
config.status: creating pcap.3pcap
config.status: creating pcap_compile.3pcap
config.status: creating pcap_datalink.3pcap
config.status: creating pcap_dump_open.3pcap
config.status: creating pcap_list_datalinks.3pcap
config.status: creating pcap_open_dead.3pcap
config.status: creating pcap_open_offline.3pcap
config.status: creating config.h

[root@server3 libpcap-1.0.0]# make
gcc -O2 -fPIC -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -c ./pcap-linux.c
gcc -O2 -fPIC -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -c ./pcap-usb-linux.c
gcc -O2 -fPIC -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -c ./fad-getad.c
sed -e 's/.*/static const char pcap_version_string[] = "libpcap version &";/' ./VERSION > version.h
gcc -O2 -fPIC -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -c ./pcap.c
gcc -O2 -fPIC -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -c ./inet.c
gcc -O2 -fPIC -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -c ./gencode.c
gcc -O2 -fPIC -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -c ./optimize.c
gcc -O2 -fPIC -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -c ./nametoaddr.c
gcc -O2 -fPIC -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -c ./etherent.c
gcc -O2 -fPIC -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -c ./savefile.c
gcc -O2 -fPIC -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -c bpf_filter.c
gcc -O2 -fPIC -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -c ./bpf_image.c
gcc -O2 -fPIC -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -c ./bpf_dump.c
./runlex.sh flex -Ppcap_ -oscanner.c scanner.l
bison -y -p pcap_ -d grammar.y
mv y.tab.c grammar.c
mv y.tab.h tokdefs.h
gcc -O2 -fPIC -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -c scanner.c
gcc -O2 -fPIC -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -Dyylval=pcap_lval -c grammar.c
sed -e 's/.*/char pcap_version[] = "&";/' ./VERSION > version.c
gcc -O2 -fPIC -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -c version.c
ar rc libpcap.a pcap-linux.o pcap-usb-linux.o fad-getad.o pcap.o inet.o gencode.o optimize.o nametoaddr.o etherent.o savefile.o bpf_filter.o bpf_image.o bpf_dump.o  scanner.o grammar.o version.o 
ranlib libpcap.a
sed -e 's|@includedir[@]|/usr/local/libpcap/include|g' \
            -e 's|@libdir[@]|/usr/local/libpcap/lib|g' \
            -e 's|@DEPLIBS[@]||g' \
            pcap-config.in >pcap-config.tmp
mv pcap-config.tmp pcap-config
chmod a+x pcap-config

[root@server3 libpcap-1.0.0]# make install
[ -d /usr/local/libpcap/lib ] || \
            (mkdir -p /usr/local/libpcap/lib; chmod 755 /usr/local/libpcap/lib)
/usr/bin/install -c -m 644 libpcap.a /usr/local/libpcap/lib/libpcap.a
ranlib /usr/local/libpcap/lib/libpcap.a
[ -d /usr/local/libpcap/include ] || \
            (mkdir -p /usr/local/libpcap/include; chmod 755 /usr/local/libpcap/include)
[ -d /usr/local/libpcap/include/pcap ] || \
            (mkdir -p /usr/local/libpcap/include/pcap; chmod 755 /usr/local/libpcap/include/pcap)
[ -d /usr/local/libpcap/share/man/man1 ] || \
            (mkdir -p /usr/local/libpcap/share/man/man1; chmod 755 /usr/local/libpcap/share/man/man1)
[ -d /usr/local/libpcap/share/man/man3 ] || \
            (mkdir -p /usr/local/libpcap/share/man/man3; chmod 755 /usr/local/libpcap/share/man/man3)
[ -d /usr/local/libpcap/share/man/man5 ] || \
            (mkdir -p /usr/local/libpcap/share/man/man5; chmod 755 /usr/local/libpcap/share/man/man5)
[ -d /usr/local/libpcap/share/man/man7 ] || \
            (mkdir -p /usr/local/libpcap/share/man/man7; chmod 755 /usr/local/libpcap/share/man/man7)

- 중략

for i in pcap-savefile.manfile.in; do \
                /usr/bin/install -c -m 644 ./`echo $i | sed 's/.manfile.in/.manfile/'` \
                    /usr/local/libpcap/share/man/man5/`echo $i | sed 's/.manfile.in/.5/'`; done
for i in pcap-filter.manmisc.in pcap-linktype.manmisc.in; do \
                /usr/bin/install -c -m 644 ./`echo $i | sed 's/.manmisc.in/.manmisc/'` \
                    /usr/local/libpcap/share/man/man7/`echo $i | sed 's/.manmisc.in/.7/'`; done
[root@server3 libpcap-1.0.0]#




3-2. libpng 설치

http://www.libpng.org/ or http://www.libpng.org/pub/png/libpng.html

libpng-1.2.34.tar.gz : (다운로드)

 
[root@server3 ~]# cd Desktop
[root@server3 Desktop]# ls
bandwidthd-2.0.1      gd-2.0.36RC1.tar.gz  libpng-1.2.34.tar.gz
bandwidthd-2.0.1.tgz  libpcap-1.0.0.tar.gz
[root@server3 Desktop]# tar xvfz libpng-1.2.34.tar.gz
libpng-1.2.34/

- 중략

libpng-1.2.34/projects/visualc71/README.txt
libpng-1.2.34/projects/visualc71/libpng.vcproj
libpng-1.2.34/projects/visualc71/libpng.sln
libpng-1.2.34/projects/visualc71/README_zlib.txt
libpng-1.2.34/projects/visualc71/PRJ0041.mak
libpng-1.2.34/projects/visualc71/zlib.vcproj
libpng-1.2.34/projects/visualc71/pngtest.vcproj
libpng-1.2.34/projects/visualc6/libpng.dsw
libpng-1.2.34/projects/visualc6/README.txt
libpng-1.2.34/projects/visualc6/libpng.dsp
libpng-1.2.34/projects/visualc6/pngtest.dsp
libpng-1.2.34/projects/beos/x86-shared.proj
libpng-1.2.34/projects/beos/x86-static.proj
libpng-1.2.34/projects/beos/x86-static.txt
libpng-1.2.34/projects/beos/x86-shared.txt
[root@server3 Desktop]# ls
111.txt   222.txt               gd-2.0.36RC1.tar.gz  gd.txt~               libpng-1.2.34
111.txt~  bandwidthd-2.0.1.tgz  gd-lib.txt~          libpcap-1.0.0.tar.gz  libpng-1.2.34.tar.gz
[root@server3 Desktop]# mv libpng-1.2.34 /usr/local/src
[root@server3 Desktop]# cd /usr/local/src
[root@server3 src]# ls
bandwidthd-2.0.1  httpd-2.2.11          libmcrypt-2.5.8  mysql-5.1.30         php-5.2.8.tar.bz2
freetype-2.3.8    httpd-2.2.11.tar.bz2  libpcap-1.0.0    mysql-5.1.30.tar.gz  tomcat-connectors-1.2.27-src
gd-2.0.36RC1      jpeg-6b               libpng-1.2.34    php-5.2.8            zlib-1.2.3
[root@server3 src]# cd libpng-1.2.34/
[root@server3 libpng-1.2.34]# ls
ANNOUNCE           libpng-config            libpng12_la-pngrutil.o   libpng_la-pngrio.o     pngbar.png
CHANGES            libpng.3                 libpng12_la-pngset.lo    libpng_la-pngrtran.lo  pngconf.h
INSTALL            libpng.la                libpng12_la-pngset.o     libpng_la-pngrtran.o   pngerror.c
KNOWNBUG           libpng.pc                libpng12_la-pngtrans.lo  libpng_la-pngrutil.lo  pnggccrd.c
LICENSE            libpng.sym               libpng12_la-pngtrans.o   libpng_la-pngrutil.o   pngget.c
Makefile           libpng.vers              libpng12_la-pngwio.lo    libpng_la-pngset.lo    pngmem.c
Makefile.am        libpng12-config          libpng12_la-pngwio.o     libpng_la-pngset.o     pngnow.png
Makefile.in        libpng12.la              libpng12_la-pngwrite.lo  libpng_la-pngtrans.lo  pngpread.c
README             libpng12.pc              libpng12_la-pngwrite.o   libpng_la-pngtrans.o   pngread.c
TODO               libpng12_la-png.lo       libpng12_la-pngwtran.lo  libpng_la-pngwio.lo    pngrio.c
Y2KINFO            libpng12_la-png.o        libpng12_la-pngwtran.o   libpng_la-pngwio.o     pngrtran.c
aclocal.m4         libpng12_la-pngerror.lo  libpng12_la-pngwutil.lo  libpng_la-pngwrite.lo  pngrutil.c
autogen.sh         libpng12_la-pngerror.o   libpng12_la-pngwutil.o   libpng_la-pngwrite.o   pngset.c
config.guess       libpng12_la-pngget.lo    libpng_la-png.lo         libpng_la-pngwtran.lo  pngtest.c
config.h           libpng12_la-pngget.o     libpng_la-png.o          libpng_la-pngwtran.o   pngtest.png
config.h.in        libpng12_la-pngmem.lo    libpng_la-pngerror.lo    libpng_la-pngwutil.lo  pngtrans.c
config.log         libpng12_la-pngmem.o     libpng_la-pngerror.o     libpng_la-pngwutil.o   pngvcrd.c
config.status      libpng12_la-pngpread.lo  libpng_la-pngget.lo      libpngpf.3             pngwio.c
config.sub         libpng12_la-pngpread.o   libpng_la-pngget.o       libtool                pngwrite.c
configure          libpng12_la-pngread.lo   libpng_la-pngmem.lo      ltmain.sh              pngwtran.c
configure.ac       libpng12_la-pngread.o    libpng_la-pngmem.o       missing                pngwutil.c
contrib            libpng12_la-pngrio.lo    libpng_la-pngpread.lo    mkinstalldirs          projects
depcomp            libpng12_la-pngrio.o     libpng_la-pngpread.o     png.5                  scripts
example.c          libpng12_la-pngrtran.lo  libpng_la-pngread.lo     png.c                  stamp-h1
install-sh         libpng12_la-pngrtran.o   libpng_la-pngread.o      png.h                  test-pngtest.sh
libpng-1.2.34.txt  libpng12_la-pngrutil.lo  libpng_la-pngrio.lo      pngbar.jpg

[root@server3 libpng-1.2.34]# ./configure --help
`configure' configures libpng 1.2.34 to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR            user executables [EPREFIX/bin]
  --sbindir=DIR           system admin executables [EPREFIX/sbin]
  --libexecdir=DIR        program executables [EPREFIX/libexec]
  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
  --libdir=DIR            object code libraries [EPREFIX/lib]
  --includedir=DIR        C header files [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
  --infodir=DIR           info documentation [DATAROOTDIR/info]
  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
  --mandir=DIR            man documentation [DATAROOTDIR/man]
  --docdir=DIR            documentation root [DATAROOTDIR/doc/libpng]
  --htmldir=DIR           html documentation [DOCDIR]
  --dvidir=DIR            dvi documentation [DOCDIR]
  --pdfdir=DIR            pdf documentation [DOCDIR]
  --psdir=DIR             ps documentation [DOCDIR]

Program names:
  --program-prefix=PREFIX            prepend PREFIX to installed program names
  --program-suffix=SUFFIX            append SUFFIX to installed program names
  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names

System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-maintainer-mode  enable make rules and dependencies not useful
                          (and sometimes confusing) to the casual installer
  --disable-dependency-tracking  speeds up one-time build
  --enable-dependency-tracking   do not reject slow dependency extractors
  --enable-shared[=PKGS]  build shared libraries [default=yes]
  --enable-static[=PKGS]  build static libraries [default=yes]
  --enable-fast-install[=PKGS]
                          optimize for fast installation [default=yes]
  --disable-libtool-lock  avoid locking (might break parallel builds)

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
  --with-pic              try to use only PIC/non-PIC objects [default=use
                          both]
  --with-pkgconfigdir     Use the specified pkgconfig dir (default is
                          libdir/pkgconfig)
  --with-binconfigs       Generate shell libpng-config scripts as well as
                          pkg-config data [default=yes]
  --with-libpng-compat    Generate the obsolete libpng.so library
                          [default=yes]

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

Report bugs to <png-mng-implement@lists.sourceforge.net>.

[root@server3 libpng-1.2.34]# ./configure --prefix=/usr/local/libpng

- 중략

config.status: creating Makefile
config.status: creating libpng.pc
config.status: creating libpng-config
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands

[root@server3 libpng-1.2.34]# make

- 중략

libtool: link: (cd ".libs" && rm -f "libpng.so.3" && ln -s "libpng.so.3.34.0" "libpng.so.3")
libtool: link: (cd ".libs" && rm -f "libpng.so" && ln -s "libpng.so.3.34.0" "libpng.so")
libtool: link: ar cru .libs/libpng.a  libpng_la-png.o libpng_la-pngset.o libpng_la-pngget.o libpng_la-pngrutil.o libpng_la-pngtrans.o libpng_la-pngwutil.o libpng_la-pngread.o libpng_la-pngrio.o libpng_la-pngwio.o libpng_la-pngwrite.o libpng_la-pngrtran.o libpng_la-pngwtran.o libpng_la-pngmem.o libpng_la-pngerror.o libpng_la-pngpread.o
libtool: link: ranlib .libs/libpng.a
libtool: link: ( cd ".libs" && rm -f "libpng.la" && ln -s "../libpng.la" "libpng.la" )
cp libpng-config libpng12-config
cp libpng.pc libpng12.pc
make[1]: Leaving directory `/usr/local/src/libpng-1.2.34'

[root@server3 libpng-1.2.34]# make install

- 중략

make[2]: Leaving directory `/usr/local/src/libpng-1.2.34'
test -z "/usr/local/libpng/share/man/man3" || /bin/mkdir -p "/usr/local/libpng/share/man/man3"
 /usr/bin/install -c -m 644 './libpng.3' '/usr/local/libpng/share/man/man3/libpng.3'
 /usr/bin/install -c -m 644 './libpngpf.3' '/usr/local/libpng/share/man/man3/libpngpf.3'
test -z "/usr/local/libpng/share/man/man5" || /bin/mkdir -p "/usr/local/libpng/share/man/man5"
 /usr/bin/install -c -m 644 './png.5' '/usr/local/libpng/share/man/man5/png.5'
test -z "/usr/local/libpng/lib/pkgconfig" || /bin/mkdir -p "/usr/local/libpng/lib/pkgconfig"
 /usr/bin/install -c -m 644 'libpng12.pc' '/usr/local/libpng/lib/pkgconfig/libpng12.pc'
test -z "/usr/local/libpng/include/libpng12" || /bin/mkdir -p "/usr/local/libpng/include/libpng12"
 /usr/bin/install -c -m 644 'png.h' '/usr/local/libpng/include/libpng12/png.h'
 /usr/bin/install -c -m 644 'pngconf.h' '/usr/local/libpng/include/libpng12/pngconf.h'
make  install-data-hook
make[2]: Entering directory `/usr/local/src/libpng-1.2.34'
cd /usr/local/libpng/include; rm -f png.h pngconf.h
cd /usr/local/libpng/include; ln -s libpng12/png.h png.h
cd /usr/local/libpng/include; ln -s libpng12/pngconf.h pngconf.h
cd /usr/local/libpng/lib/pkgconfig; rm -f libpng.pc
cd /usr/local/libpng/lib/pkgconfig; ln -s libpng12.pc libpng.pc
make[2]: Leaving directory `/usr/local/src/libpng-1.2.34'
make[1]: Leaving directory `/usr/local/src/libpng-1.2.34'
[root@server3 libpng-1.2.34]#




3-3. libgd 설치

http://www.libgd.org/Downloads

gd-2.0.36RC1.tar.gz : (다운로드)

 
[root@server3 ~]# cd Desktop
[root@server3 Desktop]# ls
111.txt   222.txt   bandwidthd-2.0.1.tgz  gd-lib.txt~  libpcap-1.0.0.tar.gz  libpng-1.2.34.tar.gz
111.txt~  222.txt~  gd-2.0.36RC1.tar.gz   gd.txt~      libpng-1.2.34
[root@server3 Desktop]# tar xvfz gd-2.0.36RC1.tar.gz
gd-2.0.36RC1/VMS/CONFIGURE.COM

- 중략

gd-2.0.36RC1/windows/Makefile
gd-2.0.36RC1/windows/libgd.rc
gd-2.0.36RC1/aclocal.m4
gd-2.0.36RC1/Makefile.in
gd-2.0.36RC1/configure

[root@server3 Desktop]# mv gd-2.0.36RC1 /usr/local/src
[root@server3 Desktop]# ls
111.txt   222.txt   333.txt               gd-2.0.36RC1         gd-lib.txt~  libpcap-1.0.0.tar.gz  libpng-1.2.34.tar.gz
111.txt~  222.txt~  bandwidthd-2.0.1.tgz  gd-2.0.36RC1.tar.gz  gd.txt~      libpng-1.2.34
[root@server3 Desktop]# cd /usr/local/src
[root@server3 src]# ls
bandwidthd-2.0.1  httpd-2.2.11          libmcrypt-2.5.8  mysql-5.1.30         php-5.2.8.tar.bz2
freetype-2.3.8    httpd-2.2.11.tar.bz2  libpcap-1.0.0    mysql-5.1.30.tar.gz  tomcat-connectors-1.2.27-src
gd-2.0.36RC1      jpeg-6b               libpng-1.2.34    php-5.2.8            zlib-1.2.3
[root@server3 src]# cd gd-2.0.36RC1/
[root@server3 gd-2.0.36RC1]# ls
CMakeLists.txt    demoin.gif        gd2topng.c     gd_png.c        gdfontl.h     gdparttopng.c  mkinstalldirs
COPYING           demoin.png        gd2topng.o     gd_png.lo       gdfontl.lo    gdparttopng.o  netware
ChangeLog         depcomp           gd_gd.c        gd_png.o        gdfontl.o     gdtables.c     pngtogd
INSTALL           entities.h        gd_gd.lo       gd_security.c   gdfontmb.c    gdtables.lo    pngtogd.c
Makefile          entities.html     gd_gd.o        gd_security.lo  gdfontmb.h    gdtables.o     pngtogd.o
Makefile.am       entities.tcl      gd_gd2.c       gd_security.o   gdfontmb.lo   gdtest         pngtogd2
Makefile.in       err.out           gd_gd2.lo      gd_ss.c         gdfontmb.o    gdtest.c       pngtogd2.c
NEWS              fontconfigtest    gd_gd2.o       gd_ss.lo        gdfonts.c     gdtest.o       pngtogd2.o
README-JPEG.TXT   fontconfigtest.c  gd_gif_in.c    gd_ss.o         gdfonts.h     gdtestft       readme.jpn
README.TESTING    fontconfigtest.o  gd_gif_in.lo   gd_topal.c      gdfonts.lo    gdtestft.c     stamp-h1
README.TXT        fontsizetest      gd_gif_in.o    gd_topal.lo     gdfonts.o     gdtestft.o     strlcpy.c
VMS               fontsizetest.c    gd_gif_out.c   gd_topal.o      gdfontt.c     gdtopng        test
aclocal.m4        fontsizetest.o    gd_gif_out.lo  gd_wbmp.c       gdfontt.h     gdtopng.c      testac
annotate          fontwheeltest     gd_gif_out.o   gd_wbmp.lo      gdfontt.lo    gdtopng.o      testac.c
annotate.c        fontwheeltest.c   gd_io.c        gd_wbmp.o       gdfontt.o     gdxpm.c        testac.o
annotate.o        fontwheeltest.o   gd_io.h        gdcache.c       gdft.c        gdxpm.lo       tests
bdftogd           gd.c              gd_io.lo       gdcache.h       gdft.lo       gdxpm.o        testtr
bootstrap.sh      gd.h              gd_io.o        gdcache.lo      gdft.o        gifanimtest    testtr.c
circletexttest    gd.lo             gd_io_dp.c     gdcache.o       gdfx.c        gifanimtest.c  testtr.o
circletexttest.c  gd.o              gd_io_dp.lo    gdcmpgif        gdfx.h        gifanimtest.o  wbmp.c
circletexttest.o  gd2copypal        gd_io_dp.o     gdcmpgif.c      gdfx.lo       giftogd2       wbmp.h
cmake             gd2copypal.c      gd_io_file.c   gdcmpgif.o      gdfx.o        giftogd2.c     wbmp.lo
config            gd2copypal.o      gd_io_file.lo  gddemo          gdhelpers.c   giftogd2.o     wbmp.o
config.h          gd2time           gd_io_file.o   gddemo.c        gdhelpers.h   index.html     webpng
config.h.cmake    gd2time.c         gd_io_ss.c     gddemo.o        gdhelpers.lo  install-item   webpng.c
config.hin        gd2time.o         gd_io_ss.lo    gdfontg.c       gdhelpers.o   install-sh     webpng.o
config.log        gd2togif          gd_io_ss.o     gdfontg.h       gdkanji.c     jisx0208.h     windows
config.status     gd2togif.c        gd_jpeg.c      gdfontg.lo      gdkanji.lo    libgd.la
configure         gd2togif.o        gd_jpeg.lo     gdfontg.o       gdkanji.o     libtool
configure.ac      gd2topng          gd_jpeg.o      gdfontl.c       gdparttopng   missing

[root@server3 gd-2.0.36RC1]# ./configure --help
`configure' configures GD 2.0.36 to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR           user executables [EPREFIX/bin]
  --sbindir=DIR          system admin executables [EPREFIX/sbin]
  --libexecdir=DIR       program executables [EPREFIX/libexec]
  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
  --libdir=DIR           object code libraries [EPREFIX/lib]
  --includedir=DIR       C header files [PREFIX/include]
  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
  --datarootdir=DIR      read-only arch.-independent data root [PREFIX/share]
  --datadir=DIR          read-only architecture-independent data [DATAROOTDIR]
  --infodir=DIR          info documentation [DATAROOTDIR/info]
  --localedir=DIR        locale-dependent data [DATAROOTDIR/locale]
  --mandir=DIR           man documentation [DATAROOTDIR/man]
  --docdir=DIR           documentation root [DATAROOTDIR/doc/gd]
  --htmldir=DIR          html documentation [DOCDIR]
  --dvidir=DIR           dvi documentation [DOCDIR]
  --pdfdir=DIR           pdf documentation [DOCDIR]
  --psdir=DIR            ps documentation [DOCDIR]

Program names:
  --program-prefix=PREFIX            prepend PREFIX to installed program names
  --program-suffix=SUFFIX            append SUFFIX to installed program names
  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names

X features:
  --x-includes=DIR    X include files are in DIR
  --x-libraries=DIR   X library files are in DIR

System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
  --target=TARGET   configure for building compilers for TARGET [HOST]

Optional Features:
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --disable-dependency-tracking  speeds up one-time build
  --enable-dependency-tracking   do not reject slow dependency extractors
  --enable-shared[=PKGS]  build shared libraries [default=yes]
  --enable-static[=PKGS]  build static libraries [default=yes]
  --enable-fast-install[=PKGS]
                          optimize for fast installation [default=yes]
  --disable-libtool-lock  avoid locking (might break parallel builds)
  --disable-rpath         do not hardcode runtime library paths

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
  --with-pic              try to use only PIC/non-PIC objects [default=use
                          both]
  --with-tags[=TAGS]      include additional configurations [automatic]
  --with-x                use the X Window System
  --with-gnu-ld           assume the C compiler uses GNU ld default=no
  --with-libiconv-prefix[=DIR]  search for libiconv in DIR/include and DIR/lib
  --without-libiconv-prefix     don't search for libiconv in includedir and libdir
  --with-png=DIR          where to find the png library
  --with-freetype=DIR     where to find the freetype 2.x library
  --with-fontconfig=DIR         where to find the fontconfig library
  --with-jpeg=DIR         where to find the jpeg library
  --with-xpm=DIR          where to find the xpm library

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor
  CXX         C++ compiler command
  CXXFLAGS    C++ compiler flags
  CXXCPP      C++ preprocessor
  F77         Fortran 77 compiler command
  FFLAGS      Fortran 77 compiler flags
  XMKMF       Path to xmkmf, Makefile generator for X Window System

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

Report bugs to <http://bugs.libgd.org>.

[root@server3 gd-2.0.36RC1]# ./configure --prefix=/usr/local/libgd
libpng 를 자동으로 지원하지 못하는 경우 경로를 적어준다.  ./configure --prefix=/usr/local/libgd --with-png=/usr/local/libpng

- 중략

** Configuration summary for gd 2.0.36:

   Support for PNG library:          yes
   Support for JPEG library:         no
   Support for Freetype 2.x library: no
   Support for Fontconfig library:   no
   Support for Xpm library:          no
   Support for pthreads:             yes

configure: creating ./config.status
config.status: creating Makefile
config.status: creating config/Makefile
config.status: creating config/gdlib-config
config.status: creating test/Makefile
config.status: creating config.h
config.status: executing depfiles commands

[root@server3 gd-2.0.36RC1]# make

- 중략

make[2]: Leaving directory `/usr/local/src/gd-2.0.36RC1'
make[1]: Leaving directory `/usr/local/src/gd-2.0.36RC1'

[root@server3 gd-2.0.36RC1]# make install

- 중략
 
make[2]: Leaving directory `/usr/local/src/gd-2.0.36RC1'
make[1]: Leaving directory `/usr/local/src/gd-2.0.36RC1'
[root@server3 gd-2.0.36RC1]#




4. bandwidthd 설치
- libpcap, libpng, libgd 를 소스로 설치한 후 bandwidth 컴파일시 제대로 인식을 못한다면 각각의 devel (RPM) 을 설치해 준다.

 
[root@server3 bandwidthd-2.0.1]# ./configure --help
`configure' configures this package to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR           user executables [EPREFIX/bin]
  --sbindir=DIR          system admin executables [EPREFIX/sbin]
  --libexecdir=DIR       program executables [EPREFIX/libexec]
  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
  --libdir=DIR           object code libraries [EPREFIX/lib]
  --includedir=DIR       C header files [PREFIX/include]
  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
  --infodir=DIR          info documentation [PREFIX/info]
  --mandir=DIR           man documentation [PREFIX/man]

X features:
  --x-includes=DIR    X include files are in DIR
  --x-libraries=DIR   X library files are in DIR

System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       build programs to run on HOST [BUILD]

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-x                use the X Window System

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
              headers in a nonstandard directory <include dir>
  CPP         C preprocessor

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

[root@server3 bandwidthd-2.0.1]# ./configure - 기본 설치 폴더 /usr/local/bandwidthd

- 중략

configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h

[root@server3 bandwidthd-2.0.1]# make
gcc -Wall -g -O2  -I/usr/local/include -DHAVE_CONFIG_H -DINSTALL_DIR="\"/usr/local/bandwidthd\""   -c -o bandwidthd.o bandwidthd.c
gcc -Wall -g -O2  -I/usr/local/include -DHAVE_CONFIG_H -DINSTALL_DIR="\"/usr/local/bandwidthd\""   -c -o graph.o graph.c
graph.c: In function ‘GraphData’:
graph.c:697: warning: pointer targets in passing argument 5 of ‘gdImageString’ differ in signedness
graph.c:698: warning: pointer targets in passing argument 5 of ‘gdImageString’ differ in signedness
graph.c:712: warning: pointer targets in passing argument 5 of ‘gdImageString’ differ in signedness
graph.c:713: warning: pointer targets in passing argument 5 of ‘gdImageString’ differ in signedness
graph.c: In function ‘PrepareYAxis’:
graph.c:762: warning: pointer targets in passing argument 5 of ‘gdImageString’ differ in signedness
graph.c: In function ‘PrepareXAxis’:
graph.c:814: warning: pointer targets in passing argument 5 of ‘gdImageString’ differ in signedness
graph.c:848: warning: pointer targets in passing argument 5 of ‘gdImageString’ differ in signedness
gcc -Wall -g -O2  -I/usr/local/include -DHAVE_CONFIG_H -DINSTALL_DIR="\"/usr/local/bandwidthd\""   -c -o conf.tab.o conf.tab.c
gcc -g -O2  -I/usr/local/include -DHAVE_CONFIG_H -c -o conf.l.o conf.l.c
gcc -Wall -g -O2  -I/usr/local/include -DHAVE_CONFIG_H -DINSTALL_DIR="\"/usr/local/bandwidthd\"" bandwidthd.o graph.o conf.tab.o conf.l.o -o bandwidthd -L/usr/local/lib -lpcap -lgd -lpng -lm -lresolv -lnsl 

[root@server3 bandwidthd-2.0.1]# make install
/usr/bin/install -c -d /usr/local/bandwidthd/etc
/usr/bin/install -c -d /usr/local/bandwidthd/htdocs
/usr/bin/install -c -m755 -s bandwidthd /usr/local/bandwidthd
if [ ! -f /usr/local/bandwidthd/etc/bandwidthd.conf ] ; then /usr/bin/install -c -m644 etc/bandwidthd.conf /usr/local/bandwidthd/etc/ ; fi
/usr/bin/install -c -m644 htdocs/legend.gif /usr/local/bandwidthd/htdocs
/usr/bin/install -c -m644 htdocs/logo.gif /usr/local/bandwidthd/htdocs
[root@server3 bandwidthd-2.0.1]#




5. bandwidthd + Apache 설정


bandwidthd 설정
[root@server3 etc]# pwd
/usr/local/bandwidthd/etc
[root@server3 etc]# ls
bandwidthd.conf
[root@server3 etc]# vi bandwidthd.conf
####################################################
# Bandwidthd.conf
#
# Commented out options are here to provide
# documentation and represent defaults

# Subnets to collect statistics on.  Traffic that
# matches none of these subnets will be ignored.
# Syntax is either IP Subnet Mask or CIDR - 서브넷에 대한 트래픽을 축정하기 위해 설정하는 부분이다.
subnet 10.0.0.0 255.0.0.0
subnet 192.168.0.0/16
subnet 172.16.0.0/12

# Device to listen on
# Bandwidthd listens on the first device it detects
# by default.  Run "bandwidthd -l" for a list of
# devices.
#dev "eth0" - 인터페이스 정보를 나타낸다.

###################################################
# Options that don't usually get changed

# An interval is 2.5 minutes, this is how many
# intervals to skip before doing a graphing run
#skip_intervals 0 - default 로 2.5분에 그래프화 한다.

# Graph cutoff is how many k must be transfered by an
# ip before we bother to graph it
#graph_cutoff 1024 -1M 이상의 트래픽을 발생시키는 IP에 대해서만 그래프에 기록한다.

#Put interface in promiscuous mode to score to traffic
#that may not be routing through the host machine.
#promiscuous true - pormiscuous 모드를 사용할 것인지 여부를 묻는다.
promiscuous 모드 사용시 모든 패킷을 모니터링 하고, 사용하지 않을 경우에는 해당 IP에 관계된 트래픽만 모니터링한다.


#Log data to cdf file htdocs/log.cdf
#output_cdf false - 로그 데이터를 htdocs/log.cdf 파일에 남길 것인지 여부를 결정한다.

#Read back the cdf file on startup
#recover_cdf false - 시작시 cdf 로그 파일을 읽을 것인지를 지정한다.

#Libpcap format filter string used to control what bandwidthd see's
#Please always include "ip" in the string to avoid strange problems
#filter "ip"

#Draw Graphs - This default to true to graph the traffic bandwidthd is recording
#Usually set this to false if you only want cdf output or
#you are using the database output option.  Bandwidthd will use very little
#ram and cpu if this is set to false.
#graph true - 그래프를 나타낼 것인지를 지정한다.

#Set META REFRESH seconds (default 150, use 0 to disable).
#meta_refresh 150
 

[root@server3 bandwidthd]# pwd - bandwidthd 의 Docuroot 폴더이다.
/usr/local/bandwidthd/htdocs
[root@server3 bandwidthd]# ls
legend.gif  logo.gif

[root@server3 bandwidthd]# pwd
/usr/local/bandwidthd
[root@server3 bandwidthd]# ./bandwidthd - bandwidthd 를 실행시켜주면 ./htdocs 폴더에 *.html 파일이 생성된다.
[root@server3 bandwidthd]# ls
bandwidthd  etc  htdocs
[root@server3 bandwidthd]# cd htdocs/
[root@server3 htdocs]# ls
index.html  index2.html  index3.html  index4.html  legend.gif  logo.gif


Virtual host 설정
[root@server3 extra]# pwd
/usr/local/apache/conf/extra
[root@server3 extra]# ls
httpd-autoindex.conf  httpd-info.conf       httpd-mpm.conf                 httpd-userdir.conf
httpd-dav.conf        httpd-languages.conf  httpd-multilang-errordoc.conf  httpd-vhosts.conf
httpd-default.conf    httpd-manual.conf     httpd-ssl.conf                 tomcat.conf
[root@server3 extra]# vi httpd-vhosts.conf - bandwidthd 정보를 추가시켜준다.

<VirtualHost 10.10.33.3:80>
    ServerAdmin root@server3.co.kr
    DocumentRoot "/usr/local/apache/htdocs/bandwidthd"
</VirtualHost>


아파치 Docuroot에 bandwidth의 Docuroot를 소프트 링크 건다.
[root@server3 htdocs]# pwd
/usr/local/apache/htdocs
[root@server3 htdocs]# ln -s /usr/local/bandwidthd/htdocs ./bandwidthd
[root@server3 htdocs]# ll
합계 20
lrwxrwxrwx  1 root root   39  2월  4 23:50 bandwidthd -> /usr/local/bandwidthd/htdocs
drwxrwxrwx 12 1000 1000 4096  1월 22 15:14 bbs
-rw-r--r--  1 root root   73  2월  2 15:55 index.html
-rw-r--r--  1 root root   18  1월 22 12:41 phpinfo.php
drwxr-xr-x 10 root root 4096  1월 22 18:15 xe
drwxr-xr-x 10 root root 4096  1월 22 18:21 xe-2

[root@server3 htdocs]# /usr/local/apache/bin/apachectl restart - 아파치 서버를 재시작해준다.




6. bandwidth 실행

웹 브라우저에서 server3.co.kr/bandwidthd or 10.10.33.3/bandwidthd 라고 입력한다.