레이블이 network인 게시물을 표시합니다. 모든 게시물 표시
레이블이 network인 게시물을 표시합니다. 모든 게시물 표시

2012-09-16

Network] mrtg nt installation guide - 원문


NAME

mrtg-nt-guide - The Windows Guide to MRTG 2.12.2

SYNOPSIS

Installing MRTG on a Windows box is not quite as ``click and point'' as some might want it to be. But then again, it is not all that difficult if you follow the instructions below.

PREREQUISITS

To get MRTG to work on Windows you need the following:

INSTALLATION

I suggest you do the following from the machine that will be running MRTG, which, in this case, is also a web server. All examples are for doing things to a LOCAL machine.
First
Unzip MRTG to C:\mrtg-2.12.2 on the Windowsmachine of your choice.
Next
Install Perl on the same Windows machine. You might want to make sure that the Perl binary directory is listed in your system path.
           C:\Perl\bin;%SystemRoot%\system32;%SystemRoot%;...
          
You can manually check this by going to [Control Panel]->[System]->[Environment]
To see if everything is installed properly you can open a Command Shell and go into c:\mrtg-2.12.2\bin. Type:
           perl mrtg
          
This should give you a friendly error message complaining about the missing mrtg configuration file. Now, you have successfully installed mrtg and perl.

CONFIGURING MRTG

Now it is time to create a configuration for mrtg. But before we begin you need to know a few things. Take an opportunity to gather the following information:
  • The IP address or hostname and the snmp port number, (if non standard), of the device you want to monitor.
  • If you want to monitor something other than bytes in and out, you must also know the SNMPOID of what you want to monitor.
  • Finally you need to know the read-only SNMP community string for your device. If you don't know it, try public, that is the default.
For the rest of this document we will be using device 10.10.10.1 ( a CISCO Catalyst 5000) with Community string public. We are interested in monitoring traffic, and the CPU load. Let's begin.
The first thing we do in setting up mrtg is making a default config file. Get to a cmd prompt and change to the c:\mrtg-2.12.2\bin directory. Type the following command:
           perl cfgmaker public@10.10.10.1 --global "WorkDir: c:\www\mrtg" --output mrtg.cfg
          
This creates an initial MRTG config file for you. Note that in this file all interfaces of your router will be stored by number. Unfortunately, these numbers are likely to change whenever you reconfigure your router. In order to work around this you can get cfgmaker to produce a configuration which is based on Ip numbers, or even Interface Descriptions. Check the cfgmaker manpage
If you get an error message complaining about no such name or no response, your community name is probably wrong.
Now, let's take a look at the mrtg.cfg file that was created.
In Perl, a # is a comment, synonymous with REM in DOS.
Add the following to the top of the mrtg.cfg file:
           WorkDir: D:\InetPub\wwwroot\MRTG
          
This is where the web pages are created, usually a web root.
           ######################################################################

           # Description: LCP SUWGB

           # Contact: Administrator

           # System Name: LC-Bridge

           # Location: Here

           #.....................................................................
          
TargetDevice's IP Address:Interface Number:Community:IP Address
           Target[10.10.10.1.1]: 1:public@10.10.10.1
          
This is the interface speed (Default is 10 megabits; for 100Mbit devices use 12500000 and so on...)
           MaxBytes[10.10.10.1.1]: 1250000
          
           Title[10.10.10.1.1]: LC-Bridge (sample.device): ether0
          
This section determines how the web page headers will look
           PageTop[10.10.10.1.1]: <H1>Traffic Analysis for ether0</H1>

            <TABLE>

            <TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>

            <TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>

            <TR><TD>Interface:</TD><TD>ether0(1)</TD></TR>

            <TR><TD>IP:</TD><TD>sample.device(10.10.10.1)</TD></TR>

            <TR><TD>Max Speed:</TD>

            <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>

            </TABLE>
          
            Target[10.10.10.1.2]: 2:public@10.10.10.1

            MaxBytes[10.10.10.1.2]: 1250000

            Title[10.10.10.1.2]: LC-Bridge (): ulink0

            PageTop[10.10.10.1.2]: <H1>Traffic Analysis for ulink0</H1>

             <TABLE>

             <TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>

             <TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>

             <TR><TD>Interface:</TD><TD>ulink0(2)</TD></TR>

             <TR><TD>IP:</TD><TD>()</TD></TR>

             <TR><TD>Max Speed:</TD>

             <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>

             </TABLE>
          
            #---------------------------------------------------------------
          
And that's a very basic mrtg config file. You can run this and see your results by going into the c:\mrtg-2.12.2\bindirectory and typing:
           perl mrtg mrtg.cfg
          
It is normal to get errors for the first two times you run this command. The errors will alert you about the fact that there have not been any log files in existence before.
If you take a look at those web pages they are not very exciting (yet). You need to have the mrtg files run every five minutes to produce the desired results. Just run it again after a few minutes. You should now be able to see the first lines in your graphs.

MAKE MRTG RUN ALL THE TIME

Starting mrtg by hand every time you want to run it is not going to make you happy I guess.
There is a special option you can set in the mrtg configuration file so so that mrtg will not terminate after it was started. Instead it will wait for 5 minutes and then run again.
Add the option
           RunAsDaemon: yes
          
to your mrtg.cfg file and start it with:
           start /Dc:\mrtg-2.12.2\bin wperl mrtg --logging=eventlog mrtg.cfg
          
If you use wperl instead of perl, no console window will show. MRTG is now running in the background. If it runs into problems it will tell you so over the EventLog. To stop MRTG, open the Task Manager and terminate the wperl.exeprocess. If mrtg has anything to tell you these messages can be found in the event log.
If you put a shortcut with
           Target:    wperl mrtg --logging=eventlog mrtg.cfg

           Start in:  c:\mrtg-2.12.2\bin
          
into your startup folder, mrtg will now start whever you login to your NT box.
If you do not want to log into your box just to start mrtg. Have a look at http://www.firedaemon.com/mrtg-howto.htmlwhich describes a free tool to start any program as a Service. The pages gives specific instructions for mrtg users.

HOW TO SETUP MRTG AS A WINDOWS SERVICE

Additional Prerequisites

Preparation

Please complete the following steps before starting the installation:
  • Copy srvany.exe and instsrv.exe to c:\mrtg\bin\ (your MRTG bin directory).
  • Create a file called mrtg.reg anywhere on your system and paste the following content into it:
               Windows Registry Editor Version 5.00
              
               [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRTG\Parameters]
    
               "Application"="c:\\perl\\bin\\wperl.exe"
    
               "AppParameters"="c:\\mrtg\\bin\\mrtg --logging=eventlog c:\\mrtg\\bin\\mrtg.cfg"
    
               "AppDirectory"="c:\\mrtg\\bin\\"
              

Installation

Once again, assuming that MRTG is already fully installed and configured on the target system under c:\mrtg\ the following steps are necessary to setup MRTG as a service.
Using the command prompt go into the temporary directory where you unzipped the package. When there type the following command to create a service named ``MRTG'' in the Windows Services management console:
           instsrv MRTG c:\mrtg\bin\srvany.exe
          
Now you need to create the App* entries required for the new service. You can do this by either right-clicking on the mrtg.reg file and selecting 'merge' or by running the following command:
           regedit /s mrtg.reg
          
After setting up the registry entry it is time to point it to your MRTG installation. If you have installed MRTG underc:\mrtg\, you can skip this step. Open your registry editor (Start -> Run -> regedt32), and locate the[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRTG] key. Make sure that theImagePath variable is correctly pointing to srvany.exe located in your MRTG bin directory (for example c:\mrtg\bin\srvany.exe). Next you have to expand the MRTG tree, and go to the[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRTG\Parameters] key. Under Parameters make sure that all the Application variables are setup propperly.
At this point you are ready to run the service. The only thing left to do is to start the MRTG service in the Services management console. After you do this, you should see two new processes running on your system: srvany.exe and wperl.exe. Make sure to stop any previously running MRTG processes to avoid confict.
Note that it is imperative to set the RunAsDaemon: yes option or the service will stop after just one single run!

EXAMPLE

Now lets look at a config file to monitor what we wanted to on our mythical Cisco Cat 5000 -- utilization on ports 3, 5, 10, and 24, and the CPU Load, which will show us nonstandard mrtg configurations as well as more options..
           WorkDir: D:\InetPub\wwwroot\MRTG

           RunAsDaemon: yes
          
           ######################################################################

           # Description: LCP SUWGB

           # Contact: Administrator

           # System Name: LC-Bridge

           # Location: Here

           #.....................................................................
          
           Target[10.10.10.1.1]: 3:public@10.10.10.1

           MaxBytes[10.10.10.1.1]: 1250000

           Title[10.10.10.1.1]: LC-Bridge (sample-device): ether0

           PageTop[10.10.10.1.1]: <H1>Traffic Analysis for ether0</H1>

            <TABLE>

           <TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>

           <TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>

           <TR><TD>Interface:</TD><TD>ether0(3)</TD></TR>

           <TR><TD>IP:</TD><TD>sample-device(10.10.10.1)</TD></TR>

           <TR><TD>Max Speed:</TD>

           <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>

           </TABLE>
          
           #---------------------------------------------------------------
          
           Target[10.10.10.1.2]: 5:public@10.10.10.1

           MaxBytes[10.10.10.1.2]: 1250000

           Title[10.10.10.1.2]: LC-Bridge (): ulink0

           PageTop[10.10.10.1.2]: <H1>Traffic Analysis for ulink0</H1>

            <TABLE>

            <TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>

            <TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>

            <TR><TD>Interface:</TD><TD>ulink0(5)</TD></TR>

            <TR><TD>IP:</TD><TD>()</TD></TR>

            <TR><TD>Max Speed:</TD>

            <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>

            </TABLE>
          
           #---------------------------------------------------------------
          
           Target[10.10.10.1.1]: 10:public@10.10.10.1

           MaxBytes[10.10.10.1.1]: 1250000

           Title[10.10.10.1.1]: LC-Bridge (sample-device): ether0

           PageTop[10.10.10.1.1]: <H1>Traffic Analysis for ether0</H1>

            <TABLE>

            <TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>

            <TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>

            <TR><TD>Interface:</TD><TD>ether0(10)</TD></TR>

            <TR><TD>IP:</TD><TD>sample-device(10.10.10.1)</TD></TR>

            <TR><TD>Max Speed:</TD>

            <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>

            </TABLE>
          
           #---------------------------------------------------------------
          
           Target[10.10.10.1.2]: 24:public@10.10.10.1

           MaxBytes[10.10.10.1.2]: 1250000

           Title[10.10.10.1.2]: LC-Bridge (): ulink0

           PageTop[10.10.10.1.2]: <H1>Traffic Analysis for ulink0</H1>

            <TABLE>

            <TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>

            <TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>

            <TR><TD>Interface:</TD><TD>ulink0(24)</TD></TR>

            <TR><TD>IP:</TD><TD>()</TD></TR>

            <TR><TD>Max Speed:</TD>

            <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>

            </TABLE>
          
           #---------------------------------------------------------------
          
           # Router CPU load %

           Target[cpu.1]:1.3.6.1.4.1.9.2.1.58.0&1.3.6.1.4.1.9.2.1.58.0:public@10.10.10.1

           RouterUptime[cpu.1]: public@10.10.10.1

           MaxBytes[cpu.1]: 100

           Title[cpu.1]: CPU LOAD

           PageTop[cpu.1]: <H1>CPU Load %</H1>

           Unscaled[cpu.1]: ymwd

           ShortLegend[cpu.1]: %

           XSize[cpu.1]: 380

           YSize[cpu.1]: 100

           YLegend[cpu.1]: CPU Utilization

           Legend1[cpu.1]: CPU Utilization in % (Load)

           Legend2[cpu.1]: CPU Utilization in % (Load)

           Legend3[cpu.1]:

           Legend4[cpu.1]:

           LegendI[cpu.1]:

           LegendO[cpu.1]: &nbsp;Usage

           Options[cpu.1]: gauge
          
This is a nice example of how to monitor any SNMP device if you know what OID you want to use. Once again, For an explanation of the more advance features of mrtg, please see Tobias's documentation.

AUTHORS

Tobi Oetiker <oetiker@ee.ethz.ch>, David S. Divins <ddivins@moon.jic.com>, Steve Pierce <MRTG@HDL.com>, Artyom Adjemov <one.bofh@gmail.com>, Ilja Ivanov <ivanov@bseu.by> Karel Fajkus <karel@fajkus.cz>
출처 : http://people.ee.ethz.ch/~oetiker/webtools/mrtg/mrtg-nt-guide.html

2012-09-14

LINUX]CentOS(리눅스) 네트워크 설정


/etc/sysconfig/network
/etc/host.conf
/etc/hosts
/etc/resolv.conf
/etc/sysconfig/network-scripts/ifcfg-*
/etc/sysconfig/network-scripts/route-*
/etc/services
/etc/protocols

/etc/sysconfig/network
로컬 시스템의 호스트 네임을 포함하여 네트워크의 사용 유무를 선택. 호스트 네임을 변경하고자 할 경우에는 /etc/hosts 파일을 함께 수정.
[root@localhost ~]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=localhost.localdomain
[root@localhost ~]#
NETWORKING : 네크워크의 사용 유무 결정, HOSTNAME : 호스트 네임 정의
주의할 점은 /etc/sysconfig/network에서 정의한 호스트네임은 /etc/hosts에도 정의되어야 함.

/etc/host.conf
네트워크에 연결되어 있는 호스트를 찾고자 할 경우 /etc/hosts 파일을 참고할지 네임서버에 질의를 할지의 순서를 결정. 기본적으로 /etc/hosts 파일을 먼저 검색하도록 설정되어 있음.
 [root@localhost ~]# cat /etc/host.conf
order hosts,bind
 [root@localhost ~]#
/etc/hosts
네트워크에 연결되어 있는 시스템들에 대한 IPv4 주소와 호스트 네임을 정의하고 있음.
 [root@localhost ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1  localhost.localdomain localhost
::1  localhost6.localdomain6 localhost6
 [root@localhost ~]#
IP 주소
호스트 네임
별칭
 127.0.0.1
localhost.localdomain
localhost
/etc/hosts 파일은 IP주소, 호스트 네임, 별칭으로 구성되어 있음.
/etc/resolv.conf
네임서버를 사용하도록 클라이언트 시스템을 설정할 경우에는 먼저 어느 네임서버를 사용할지, 그리고 어떻게 사용할지를 지정해 줌. domain, search, nameserver 지시자를 사용할 수 있음.
domain e-zis.co.kr
domain 지시자는 기본적으로 확인할 로컬 도메인 이름을 resolver에게 지시함. 위와 같이 지정하면 ping www라고 실행시, resolver은 www뒤에 e-zis.co.kr을 추가하여 www.e-zis.co.kr에 ping을 시도함.
search e-zis.co.kr lyzzang.co.kr rockplace.co.kr
search 지시자를 사용하여 도메인들을 목록을 지정할 수도 있음. 위의 예에서 보면 ping www실행시 resolver는 3개의 도메인을 순서대로 찾으려고 시도하게 됨.
nameserver 127.0.0.1
nameserver 192.168.100.201
nameserver 168.126.63.1
로컬 시스템이 사용할 네임서버를 nameserver 지시자를 이용하여 지정해 줌.
 
 
 
=======================
 
 
http://www.jopenbusiness.com/tc/oss/entry/CentOS-%EB%84%A4%ED%8A%B8%EC%9B%8C%ED%81%AC-%EC%84%A4%EC%A0%95
 
 

CentOS Network 설정

  • CentOS에 있는 네트워크 카드명을 확인 한다.
  • ifconfig -a : lo, eth0, eth1 등의 이름을 확인할 수 있다.
  • /etc/sysconfig/network-scripts/ifcfg-eth0 에 네트워크 카드를 위한 설정이 저장 된다.
          #--- eth0 네트워크 카드에 고정 IP 설정시

          DEVICE=eth0

          BOOTPROTO=none

          HWADDR=00:24:1D:71:21:5C

          ONBOOT=yes

          NETMASK=255.255.255.0

          IPADDR=203.261.27.22

          GATEWAY=203.261.27.1

          TYPE=Ethernet

          USERCTL=no

          IPV6INIT=no

          PEERDNS=yes

          

          #--- eth0 네트워크 카드에 DHCP 설정시

          DEVICE=eth0

          BOOTPROTO=dhcp

          HWADDR=00:24:1D:71:21:5C

          ONBOOT=yes
          
  • /etc/sysconfig/network
          NETWORKING=yes

          NETWORKING_IPV6=no

          HOSTNAME=localhost.localdomain   #--- 호스트명과 도메인명 지정

          # HOSTNAME=localhost

          # DOMAINNAME=localdomain
          
  • /etc/hosts #--- 호스트명 지정
          127.0.0.1               localhost.localdomain localhost
          
  • /etc/resolv.conf #--- DNS를 위한 네임서버를 지정 한다.
          search

          nameserver 164.124.101.2  #--- 데이콤에서 사용하는 nameserver IP

          nameserver 168.126.63.1   #--- 코넷에서 사용하는 nameserver IP
          
  • /etc/host.conf
          #--- 호스트명 찾는 우선 순위 지정, hosts. /etc/hosts, bind. DNS 서버

          order hosts,bind   #--- /etc/hosts 파일에서 찾고 없을 경우 DNS 서버에서 찾는다.
          
  • Network 설정 GUI 명령어
          system-config-network
          
  • Network 설정이 마무리 되면 network 서비스를 재기동 한다.
          service  network  restart
          
*** 참고 문헌 ***

2012-09-13

FreeBSD] ntop 설치 및 설정


이번에 ntop 설치와 설정에 관한 내용입니다.. 참조하세요..^^;;

참조한 문서들이 있으니.. 부족하다 생각되시면 해당 문서들은 보시기 바랍니다..

(세부 설명은 해당 문서들을 그대로 카피했음을 미리 알려드립니다.. 제가 설명한것보다 잘 되어 있는 것 같아서요..^^)


#############################################################
ntop은 네트워크에서 관련 호스트들과의 관계를 네트워크 트래픽을 통해 모니터링하는 프로그램이다.

사용 방법은 터미널 방식과 웹 방식이 있는데 웹 방식이 보다 관리하기 편하다. 그리고 ntop에서 보고되는 결과 값은 서브네트에서 발생하는 트래픽을 보여주며 적어도 아래와 같은 내용을 체크 할 수 있다.


1) 네트워크의 모든 프로토콜에 대한 송수신
2) 사용되는 프로토콜의 통계 제공
3) 트래픽 통계 제공
4) IP 트래픽
5) 현재 사용되는 세션(TCP)
6) 트래픽 사용 형태(지역 및 원격여부)
7) 패킷 필터링을 통해서 서버쪽에 연결된 세션(session)을 쉽게 확인

#############################################################



참조 문서 : http://tunelinux.pe.kr/tune/tunning-pse/pse-02.html (설명 위주)
http://kltp.kldp.org/stories.php?story=02/04/25/5169083 (설치 위주)

다운 http://snapshot.ntop.org/ 에서 ntop-2.0-src.tgz (안정 버전) 다운


[root@kan ntop]# ./configure
[root@kan ntop]# mkdir /usr/local/man/man1/intop

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

이것은 make 후 make install시 redhat7.2 에서는 컴파일 과정 automake 때문에 man 페이지를 생성하지 못해 에러가 발생해서 직접 생성한것임


/bin/sh ./mkinstalldirs /usr/local/man/man1
/usr/bin/install -c -m 644 ./intop/intop.1 /usr/local/man/man1/intop/intop.1
/usr/bin/install: cannot create regular file `/usr/local/man/man1/intop/intop.1': 그런 파일이나 디렉토리가 없음


생성 안하고 make install 할 경우 나타나는 에러 문구
-----------------------------------------------------------
[root@kan ntop]# make
[root@kan ntop]# make install

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

Libraries have been installed in:

/usr/local/lib



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 `-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.
----------------------------------------------------------



[root@kan ntop]# mkdir /home/kan/html/ntop_conf
[root@kan ntop]# /usr/local/bin/ntop -W 3000 -P /home/kan/html/ntop_conf -r 180 -i eth0 -m 해당아이피 -d



Wait please: ntop is coming up...
15/Jun/2002 13:51:36 Initializing IP services...
15/Jun/2002 13:51:36 Initializing SSL...
15/Jun/2002 13:51:36 Unable to find SSL certificate 'ntop-cert.pem'. SSL support has been disabled

15/Jun/2002 13:51:36 Bye bye: I'm becoming a daemon...



SSL에서 에러가 발생하면.. ntop-cert.pem 을 카피해서 해당 디비 밑으로 이동하면 된다..

[root@kan bin]# pwd
 /usr/local/bin
[root@kan bin]# cp ntop-cert.pem /home/kan/html/ntop_conf/



다시 실행을 하면..

Wait please: ntop is coming up...

15/Jun/2002 14:02:33 Initializing IP services...
15/Jun/2002 14:02:33 Initializing SSL...
15/Jun/2002 14:02:33 SSL initialized successfully
15/Jun/2002 14:02:33 Bye bye: I'm becoming a daemon..

정상적으로 스타팅이 되는것을 볼수 있을것이다..



-w: http 프로토콜의 포트번호
-W: ssl 로 띄울 포트번호
-P: ntop 이 시작될때 생성되는 db 화일이 존재할 디렉토리..꼭 이 옵션을 줘야 함.
-r: refresh 시간입니다. default 는 3초
-m: 모니터링할 네트웍 대역폭.
-d : 는 데몬으로 띄운다는 거죠..처음에 실행하실때는 데몬으로 띄우지 마시고 그냥 띄우면서 어떻게 뜨는지 확인해 보시는 것도 좋을것



웹상에서 https://aaa.co.kr:3000 입력하면 ntop 의 막강한 기능을 웹상에서 볼수 있을 것이다..



ntop의 웹 페이지는 /usr/local/share/ntop/html 이곳에 있다.. ($NTOP_PREFIX/share/ntop/html )


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

텔넷 모드

ntop은 텔넷 모드를 이용하여 그 순간에 발생되는 트래픽에 대해 쉽게 트래픽을 얻을 수 있다. 터미널 모드는 관리자의 핫키를 선택함으로써 그 값을 얻을 수 있다. 'r'키를 선택하면 통계 데이타를 리셋하게 된다. 'n'키를 선택하게 되면 장비와 장비 주소(Mac address) 그리고 일반 호스트 값을 얻을 수 있으며  'p'키를 선택하면 각 인터페이스 카드에서 받은 트래픽 양을 볼 수 있다. 'l'을 선택하게 되면 현재 호스트 들의 값을 보여주며 'd'는 idle 상태에서 송수신으로 되는 비율을 나타내고 't'는 송수신량에 대해 분류하여 제공한다. 'y'는 각 컬럼을 소트하여 보여주고 일반 스페이스는 각 호스트별 네트워크 사용량을 체크 할 수 있다. 위와 같은 방법을 이용하면 쉽게 터미널 모드에서 원하는 통계 값을 얻을 수 있다.

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


참고 rrdtool 을 사용해서 mrtg 처럼 시간대별로 그래픽화 할수 있다고 함..


[root@kan html]# ps -ax

19612 ? S 0:00 /usr/local/bin/ntop -W 3000 -P /home/kan/html/ntop_conf -r 180 -i eth0 -m 12.34.56.78 -d

19613 ? S 0:00 /usr/local/bin/ntop -W 3000 -P /home/kan/html/ntop_conf -r 180 -i eth0 -m 12.34.56.78 -d

19614 ? S 0:00 /usr/local/bin/ntop -W 3000 -P /home/kan/html/ntop_conf -r 180 -i eth0 -m 12.34.56.78 -d

19615 ? S 0:00 /usr/local/bin/ntop -W 3000 -P /home/kan/html/ntop_conf -r 180 -i eth0 -m 12.34.56.78 -d

19616 ? S 0:00 /usr/local/bin/ntop -W 3000 -P /home/kan/html/ntop_conf -r 180 -i eth0 -m 12.34.56.78 -d

19617 ? S 0:00 /usr/local/bin/ntop -W 3000 -P /home/kan/html/ntop_conf -r 180 -i eth0 -m 12.34.56.78 -d

19618 ? S 0:00 /usr/local/bin/ntop -W 3000 -P /home/kan/html/ntop_conf -r 180 -i eth0 -m 12.34.56.78 -d

19619 ? S 0:00 /usr/local/bin/ntop -W 3000 -P /home/kan/html/ntop_conf -r 180 -i eth0 -m 12.34.56.78 -d

19620 ? S 0:00 /usr/local/bin/ntop -W 3000 -P /home/kan/html/ntop_conf -r 180 -i eth0 -m 12.34.56.78 -d

19621 ? S 0:03 /usr/local/bin/ntop -W 3000 -P /home/kan/html/ntop_conf -r 180 -i eth0 -m 12.34.56.78 -d

19622 ? S 0:00 /usr/local/bin/ntop -W 3000 -P /home/kan/html/ntop_conf -r 180 -i eth0 -m 12.34.56.78 -d

19970 pts/2 R 0:00 ps -ax

[root@kan html]# kill -9 19612 <== 프로세스 죽일시 맨 위에거 하나만 죽이면 다 죽음..



[root@kan bin]# /usr/local/bin/ntop -W 3000 -P /home/kan/html/ntop_conf -r 180 -i eth0 -m 12.34.56.78 -d -u kan

Wait please: ntop is coming up...

15/Jun/2002 15:00:44 Initializing IP services...
15/Jun/2002 15:00:44 Initializing SSL...
15/Jun/2002 15:00:44 SSL initialized successfully
15/Jun/2002 15:00:44 Bye bye: I'm becoming a daemon...


[root@kan bin]# /usr/local/bin/ntop -w 3000 -P /home/kan/html/ntop_conf -r 180 -i eth0 -m 12.34.56.78 -d


-W 3000 옵션으로 https:// 를 사용하려고 하였으나 실행시

17/Jun/2002 11:48:56 listen error.

에러가 발생하여.. 사용을 안하고 -w 3000 으로 그냥 http 에서 관리하기로 함..



인증을 하려면.. admin->user에 사용자를 하나 추가하고.. urls 에 전제 경로를 해 주면 된다..



#################################################################
부연 설명
#################################################################



ㅇ Data Rcvd/Data Sent

현재 네트워크에서 주고 받은 네트워크 트래픽을 각 호스트별, 프로토콜별로 모니터링할 수 있고 각 호스트별로 총처리량을 알 수 있다. 호스트명을 클릭하면 해당 호스트에 대한 정보가 나온다. 여기에는 트래픽 일반정보, IP 프로토콜 분포, 연결되어 있는 각 호스트 정보, ip 서비스/포트 사용 현황, IP 세션 히스토리, 활성화되어 있는 TCP 세션 등에 대한 정보를 알 수 있다.



ㅇ Stats

전반적인 네트워크에 대한 통계를 볼 수 있다. 멀티캐스트 통계, 전체 트래픽 현황, 프로토콜별 현황, IP 프로토콜 현황, 호스트별 대역폭 사용량, 최근의 네트워크 평균 처리량 등에 대한 정보를 알 수 있다.



ㅇ IP Traffic/IP Protocols

IP 트래픽은 원격에서 로컬로, 로컬에서 원격으로, 로컬에서 로컬로 IP 트래픽이 어떻게 사용되었는지에 대한 내용을 보여준다. 또한 IP 서브넷별 트래픽 현황을 보여준다. IP 프로토콜은 IP 트래픽을 개별 프로토콜별로 나누어서 상세히 보여준다. 이를 통하여 트래픽 유형이 어떻게 진행되고 있는지에 대하여 상세하게 알 수 있다. 내부 트래픽이 많은지 아니면 내부와 외부 트래픽이 많은지, 각 트래픽별로 어떠한 프로토콜을 많이 사용하고 있는지 분석할 수 있다.

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

참고로 Data Rcvd-NetFlows 에는 위의 기본설정으로 시작하면 아무런 내용도 나오지 않을 것이다. ?F 옵션을 이용하여 특정할 룰에 맞는 패킷에 대해서 볼 수가 있다. 아래 예제는 love 또는 taejun 이라는 호스트, 그리고 db 라는 호스트에 대한 트래픽 현황을 보기 위한 것이다.



# ntop -w 3000 -F "love='host love or taejun',db='host db'"



Ntop에서 사용하는 필터 옵션은 tcpdump와 유사하며 이에 대해서는 “BPF Packet Filtering Expressions”라는 내용을 참고해야 한다. Ntop에 대한 자료가 아직은 부족한 편이고 맨 페이지도 간략하게만 나와있는데 이에 대한 문서는 ntop 사이트에서 Docs메뉴에 가면 “User's guide (draft and outdated [any volunteer out there?])” 에서 다운받아 사용하면 된다. 여러가지 예제들이 많이 있고 그나마 자세하게 ntop에 대해서 설명하고 있으므로 ntop에 관심이 있다면 많은 도움이 될 것이다.

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

위에서 본바와 같이 ntop은 네트워크 전반에서 발생하고 있는 트래픽 형태를 파악할 수 있으며 네트워크에 문제가 생길 경우 이에 대한 상세한 기초자료가 될 수 있다.

Ping이나 traceroute 등의 프로그램을 이용해서는 연결과 관련된 단편적인 정보만 알 수 있을 뿐이며 MRTG는 전체적인 트래픽만 확인할 수 있다.

Ntop을 이용하면 예를 들어 특정한 호스트에 백도어나 크래킹 툴이 설치되어 있는 경우 크래킹 당한 호스트를 통해 외부 공격을 하게되고 이로 인해 네트워크의 트래픽이 증가할 수 있는데 이러한 경우 주기적으로 결과를 모니터링해서 평소와 다른 트래픽 유형을 보인다면 쉽게 문제를 파악할 수 있다.

불필요하게 사용되고 있는 프로토콜은 제한을 하여 네트워크 용량을 절약할 수 있으며 이러한 트래픽 결과를 가지고 분석하여 효율적으로 네트워크를 재설계하는데 도움이 될 수 있다.

2012-09-06

Linux]iptables 사용법


출처 : http://www.gentoo.or.kr/wiki/moin.cgi/iptables


1 응용프로그램이름

1.1 소개

2.4 커널부터 포함된 방화벽 설정 유틸리티

1.2 관련 홈페이지

2 설치

2.1 Emerge

          # emerge net-firewall/iptables 
          
커널을 컴파일할 때 iptable 관련 기능을 설정해야 합니다.
Device Driver --> Networking Support --> Networking Support --> Networking Options --> Network packet filtering

2.2 USE 플래그

  • ipv6 : ipv6 를 지원

3 사용법/팁

기본적인 사용법은 아래 내용을 참고하세요.

4 설정

4.1 부팅할 때 자동으로 시작되도록 하기

rc-update add iptables default

4.2 설정한 내용 저장하기

iptables-save 명령을 사용하면 현재 설정된 내용을 표준출력으로 내보냅니다. 이걸 파일에 리다이렉트하면 저장할 수 있습니다.

4.3 저장한 내용 불러오기

iptables-save 로 저장한 파일로 iptables-restore 명령을 실행하면 저장했던 내용이 적용됩니다.

4.4 설정한 내용 다음 부팅할 때도 적용되도록 하기

자신에게 맞게 설정한 다음 /etc/init.d/iptables save 를 실행하면 됩니다.

5 설정예제

이건 위 링크에 있는 내용을 참고로 해서 제가 대충 만들어 본 것입니다.
             iptables -N block 

             iptables -A INPUT -j block 

             iptables -A FORWARD -j block 

             iptables -A block -m state --state RELATED,ESTABLISHED -j ACCEPT 

             iptables -A block -s localhost -d localhost -j ACCEPT 

             iptables -A block -j DROP 

             
          
iptables -A block -m state --state NEW -i ! ppp0 -j ACCEPT
저는 ppp를 쓰지 않으므로 제외하였습니다.
iptables -A block -s localhost -d localhost -j ACCEPT
내부적으로 오가는 패킷은 accept 합니다. 이걸 해주지 않으면 mplayer에서 동영상 재생이 안되더군요.
참고로 저는 p2p 나 메신저 등은 쓰지 않고 웹서핑만 합니다. 일단 현재로서는 아무문제가 없네요.

6 동작 확인

자신의 컴퓨터에 열린 포트를 검사해볼 수 있는 곳입니다. http://scan.sygate.com/ "block"이라고 나오는 것이 좋습니다.

Linux] 방화벽 설정 관련 내용...


http://web.mit.edu/rhel-doc/4/RH-DOCS/rhel-sg-ko-4/ch-fw.html

2012-08-29

CentOS](리눅스) 네트워크 설정

출처 : http://blog.bagesoft.com/696
CentOS(리눅스) 네트워크 설정
/etc/sysconfig/network
/etc/host.conf
/etc/hosts
/etc/resolv.conf
/etc/sysconfig/network-scripts/ifcfg-*
/etc/sysconfig/network-scripts/route-*
/etc/services
/etc/protocols

/etc/sysconfig/network

로컬 시스템의 호스트 네임을 포함하여 네트워크의 사용 유무를 선택. 호스트 네임을 변경하고자 할 경우에는 /etc/hosts 파일을 함께 수정.

[root@localhost ~]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=localhost.localdomain
[root@localhost ~]#
NETWORKING : 네크워크의 사용 유무 결정, HOSTNAME : 호스트 네임 정의
주의할 점은 /etc/sysconfig/network에서 정의한 호스트네임은 /etc/hosts에도 정의되어야 함.

/etc/host.conf
네트워크에 연결되어 있는 호스트를 찾고자 할 경우 /etc/hosts 파일을 참고할지 네임서버에 질의를 할지의 순서를 결정. 기본적으로 /etc/hosts 파일을 먼저 검색하도록 설정되어 있음.
 [root@localhost ~]# cat /etc/host.conf
order hosts,bind
 [root@localhost ~]#
/etc/hosts
네트워크에 연결되어 있는 시스템들에 대한 IPv4 주소와 호스트 네임을 정의하고 있음.
 [root@localhost ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1  localhost.localdomain localhost
::1  localhost6.localdomain6 localhost6
 [root@localhost ~]#
IP 주소
호스트 네임
별칭
 127.0.0.1
localhost.localdomain
localhost
/etc/hosts 파일은 IP주소, 호스트 네임, 별칭으로 구성되어 있음.

/etc/resolv.conf
네임서버를 사용하도록 클라이언트 시스템을 설정할 경우에는 먼저 어느 네임서버를 사용할지, 그리고 어떻게 사용할지를 지정해 줌. domain, search, nameserver 지시자를 사용할 수 있음.
domain e-zis.co.kr
domain 지시자는 기본적으로 확인할 로컬 도메인 이름을 resolver에게 지시함. 위와 같이 지정하면 ping www라고 실행시, resolver은 www뒤에 e-zis.co.kr을 추가하여 www.e-zis.co.kr에 ping을 시도함.
search e-zis.co.kr lyzzang.co.kr rockplace.co.kr
search 지시자를 사용하여 도메인들을 목록을 지정할 수도 있음. 위의 예에서 보면 ping www실행시 resolver는 3개의 도메인을 순서대로 찾으려고 시도하게 됨.
nameserver 127.0.0.1
nameserver 192.168.100.201
nameserver 168.126.63.1
로컬 시스템이 사용할 네임서버를 nameserver 지시자를 이용하여 지정해 줌.
=======================
http://www.jopenbusiness.com/tc/oss/entry/CentOS-%EB%84%A4%ED%8A%B8%EC%9B%8C%ED%81%AC-%EC%84%A4%EC%A0%95

CentOS Network 설정

CentOS에 있는 네트워크 카드명을 확인 한다.

  • ifconfig -a : lo, eth0, eth1 등의 이름을 확인할 수 있다.
  • /etc/sysconfig/network-scripts/ifcfg-eth0 에 네트워크 카드를 위한 설정이 저장 된다.
          #--- eth0 네트워크 카드에 고정 IP 설정시

          DEVICE=eth0

          BOOTPROTO=none

          HWADDR=00:24:1D:71:21:5C

          ONBOOT=yes

          NETMASK=255.255.255.0

          IPADDR=203.261.27.22

          GATEWAY=203.261.27.1

          TYPE=Ethernet

          USERCTL=no

          IPV6INIT=no

          PEERDNS=yes

          

          #--- eth0 네트워크 카드에 DHCP 설정시

          DEVICE=eth0

          BOOTPROTO=dhcp

          HWADDR=00:24:1D:71:21:5C

          ONBOOT=yes
          

  • /etc/sysconfig/network
          NETWORKING=yes

          NETWORKING_IPV6=no

          HOSTNAME=localhost.localdomain   #--- 호스트명과 도메인명 지정

          # HOSTNAME=localhost

          # DOMAINNAME=localdomain
          

  • /etc/hosts #--- 호스트명 지정
          127.0.0.1               localhost.localdomain localhost
          

  • /etc/resolv.conf #--- DNS를 위한 네임서버를 지정 한다.
          search

          nameserver 164.124.101.2  #--- 데이콤에서 사용하는 nameserver IP

          nameserver 168.126.63.1   #--- 코넷에서 사용하는 nameserver IP
          

  • /etc/host.conf
          #--- 호스트명 찾는 우선 순위 지정, hosts. /etc/hosts, bind. DNS 서버

          order hosts,bind   #--- /etc/hosts 파일에서 찾고 없을 경우 DNS 서버에서 찾는다.
          

  • Network 설정 GUI 명령어
          system-config-network
          

  • Network 설정이 마무리 되면 network 서비스를 재기동 한다.
          service  network  restart
          
*** 참고 문헌 ***
오픈소스 비즈니스 컨설팅 - Network