japanese site
온라인강좌책메일다운로드동아리쇼핑기술지원기업정보갤러리동영상 블로그
『신개념 4단계 리눅스기술지원 시스템 공개』

※ 『무료 리눅스 배포판 배송서비스』 ※

 
SNMP관련 명령어 사용예
조회 : 5,517  


 

경고 : 이 명령어를 완전히 습득하지않은 채로 따라하지 마십시오. 시스템의 설정값이 바뀔수도 있습니다. 필자는 어떠한 경우라도 책임지지않습니다.

snmptrapd

snmp agent로부터 trap메시지를 수신하는 데몬프로그램

UDP 162번을 사용함.

snmpd.conf 파일에서 snmptrapd가 실행된 서버의 주소를 설정해야한다.

snmptrapd는 root권한으로 실행이 되어야함.

 

 

 

snmpget

[root@kebia_2 /root]# snmpget localhost public system.1.0
system.sysDescr.0 = Linux kebia_2 2.2.16-22smp #1 SMP Tue Aug 22 16:39:21 EDT 2000 i686
[root@kebia_2 /root]#
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpget www.kornet.net public system.1.0
Timeout: No Response from www.kornet.net.
[root@kebia_2 /root]# snmpget hosting.kornet.net public system.1.0
Timeout: No Response from hosting.kornet.net.
[root@kebia_2 /root]#
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpget -v 2c localhost public system.sysUpTime.0
system.sysUpTime.0 = Timeticks: (34070929) 3 days, 22:38:29.29
[root@kebia_2 /root]#
[root@kebia_2 /root]#
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpget -v 2c localhost public system.sysUpTime.0
system.sysUpTime.0 = Timeticks: (34083939) 3 days, 22:40:39.39
[root@kebia_2 /root]#
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpget -v 2c ucd-snmp.ucdavis.edu demopublic sysUpTime.0
Timeout: No Response from ucd-snmp.ucdavis.edu.
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpget localhost public system.sysDescr.0
system.sysDescr.0 = Linux kebia_2 2.2.16-22smp #1 SMP Tue Aug 22 16:39:21 EDT 2000 i686
[root@kebia_2 /root]#

 

 

 

 

snmpset

경고 : 이 명령어를 완전히 습득하지않은 채로 따라하지 마십시오. 시스템의 설정값이 바뀔수도 있습니다. 필자는 어떠한 경우라도 책임지지않습니다.

snmpset으로 system.4.0의 값을 변경한 예
변경전 snmpget으로 값을 확인하고 변경후에 다시 snmpget으로 확인하였다.

[root@kebia_2 /root]#
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpget localhost public system.4.0
system.sysContact.0 = Me me@somewhere.org
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpset localhost public system.4.0 s myid@test.co.kr
system.sysContact.0 = myid@test.co.kr
[root@kebia_2 /root]#
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpget localhost public system.4.0
system.sysContact.0 = myid@test.co.kr
[root@kebia_2 /root]#

 

 

 

snmpwalk

 

 

[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpwalk localhost public system
system.sysDescr.0 = Linux kebia_2 2.2.16-22smp #1 SMP Tue Aug 22 16:39:21 EDT 2000 i686
system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.linux
system.sysUpTime.0 = Timeticks: (34361418) 3 days, 23:26:54.18
system.sysContact.0 = Me me@somewhere.org
system.sysName.0 = kebia_2
system.sysLocation.0 = Right here, right now.
system.sysORLastChange.0 = Timeticks: (0) 0:00:00.00
system.sysORTable.sysOREntry.sysORID.1 = OID: ifMIB
system.sysORTable.sysOREntry.sysORID.2 =
ID: .iso.org.dod.internet.snmpV2.snmpModules.snmpMIB
system.sysORTable.sysOREntry.sysORID.3 = OID: tcpMIB
system.sysORTable.sysOREntry.sysORID.4 = OID: ip
system.sysORTable.sysOREntry.sysORID.5 = OID: udpMIB
system.sysORTable.sysOREntry.sysORID.6 =
ID: .iso.org.dod.internet.snmpV2.snmpModules.snmpVacmMIB.vacmMIBConformance.
vacmMIBGroups.vacmBasicGroup
system.sysORTable.sysOREntry.sysORID.7 = OID: .iso.org.dod.internet.snmpV2.snmpModules.snmpFrameworkMIB.snmpFrameworkMIBConformance.
snmpFrameworkMIBCompliances.snmpFrameworkMIBCompliance
system.sysORTable.sysOREntry.sysORID.8 = OID: .iso.org.dod.internet.snmpV2.snmpModules.snmpMPDMIB.snmpMPDMIBConformance.
snmpMPDMIBCompliances.snmpMPDCompliance

system.sysORTable.sysOREntry.sysORID.9 = OID: .iso.org.dod.internet.snmpV2.snmpModules.snmpUsmMIB.
usmMIBConformance.usmMIBCompliances.usmMIBCompliance

system.sysORTable.sysOREntry.sysORDescr.1 =
The MIB module to describe generic objects for network interface sub-layers

system.sysORTable.sysOREntry.sysORDescr.2 = The MIB module for SNMPv2 entities

system.sysORTable.sysOREntry.sysORDescr.3 = The MIB module for managing TCP implementations

system.sysORTable.sysOREntry.sysORDescr.4 = The MIB module for managing IP and ICMP implementations

system.sysORTable.sysOREntry.sysORDescr.5 = The MIB module for managing UDP implementations

system.sysORTable.sysOREntry.sysORDescr.6 = View-based Access Control Model for SNMP.

system.sysORTable.sysOREntry.sysORDescr.7 = The SNMP Management Architecture MIB.

system.sysORTable.sysOREntry.sysORDescr.8 = The MIB for Message Processing and Dispatching.

system.sysORTable.sysOREntry.sysORDescr.9 = The management information definitions for the
SNMP User-based Security Model.

system.sysORTable.sysOREntry.sysORUpTime.1 = Timeticks: (0) 0:00:00.00
system.sysORTable.sysOREntry.sysORUpTime.2 = Timeticks: (0) 0:00:00.00
system.sysORTable.sysOREntry.sysORUpTime.3 = Timeticks: (0) 0:00:00.00
system.sysORTable.sysOREntry.sysORUpTime.4 = Timeticks: (0) 0:00:00.00
system.sysORTable.sysOREntry.sysORUpTime.5 = Timeticks: (0) 0:00:00.00
system.sysORTable.sysOREntry.sysORUpTime.6 = Timeticks: (0) 0:00:00.00
system.sysORTable.sysOREntry.sysORUpTime.7 = Timeticks: (0) 0:00:00.00
system.sysORTable.sysOREntry.sysORUpTime.8 = Timeticks: (0) 0:00:00.00
system.sysORTable.sysOREntry.sysORUpTime.9 = Timeticks: (0) 0:00:00.00
[root@kebia_2 /root]#
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpwalk ns.test.co.kr public if
End of MIB
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpwalk localhost public if
[root@kebia_2 /root]#
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpwalk ns.test.co.kr public udp
End of MIB
[root@kebia_2 /root]#
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpwalk localhost public udp
udp.udpInDatagrams.0 = 30884
udp.udpNoPorts.0 = 523831
udp.udpInErrors.0 = 3
udp.udpOutDatagrams.0 = 31287
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.111 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.161 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.3891 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.111 = 111
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.161 = 161
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.3891 = 3891
[root@kebia_2 /root]#
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpwalk 211.220.193.130 public if
[root@kebia_2 /root]# snmpwalk 211.220.193.130 public udp
udp.udpInDatagrams.0 = 595648
udp.udpNoPorts.0 = 15143
udp.udpInErrors.0 = 0
udp.udpOutDatagrams.0 = 593690
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.0 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.13 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.94 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.111 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.161 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.162 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.163 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.164 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.177 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.512 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.1670 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.6500 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.9494 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.32771 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.32772 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.32773 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.32774 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.32775 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.32776 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.32777 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.32778 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.32779 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.32781 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.32783 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.32784 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.32785 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.32792 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.32793 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.32794 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.33938 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.33952 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.0 = 0
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.13 = 13
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.94 = 94
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.111 = 111
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.161 = 161
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.162 = 162
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.163 = 163
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.164 = 164
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.177 = 177
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.512 = 512
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.1670 = 1670
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.6500 = 6500
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.9494 = 9494
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.32771 = 32771
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.32772 = 32772

udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.32773 = 32773

중략….

 [root@kebia_2 /root]#
[root@kebia_2 /root]#
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpwalk 211.220.193.130 public iso
system.sysDescr.0 = Sun SNMP Agent, Ultra-Enterprise
system.sysObjectID.0 = OID: enterprises.42.2.1.1
system.sysUpTime.0 = Timeticks: (87184248) 10 days, 2:10:42.48
system.sysContact.0 = System administrator
system.sysName.0 = sms
system.sysLocation.0 = System administrators office
system.sysServices.0 = 72
interfaces.ifNumber.0 = 2
interfaces.ifTable.ifEntry.ifIndex.1 = 1
interfaces.ifTable.ifEntry.ifIndex.2 = 2
interfaces.ifTable.ifEntry.ifDescr.1 = lo0
interfaces.ifTable.ifEntry.ifDescr.2 = hme0



 

 

 

snmpbulkwalk

 

반드시 SNMPv2c이상에서만 사용하는 GetBulk-Request를 사용하여 snmpwalk를 수행함.
따라서 옵션부분에 반드시 -v 2c를 적어줘야함.

[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpbulkwalk -v 2c localhost public udpTable
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.111 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.161 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.3891 = IpAddress:
.0.0.0
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.111 = 111
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.161 = 161
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.3891 = 3891
[root@kebia_2 /root]#

 

 

 

 

snmpgetnext

[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpgetnext localhost public system.1
system.sysDescr.0 = Linux kebia_2 2.2.16-22smp #1 SMP Tue Aug 22 16:39:21 EDT 2000 i686
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpgetnext test.co.kr public system.1
system.sysDescr.0 = Linux kebia_1 2.2.16-22smp #1 SMP Tue Aug 22 16:39:21 EDT 2000 i686
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpgetnext bsidc.co.kr public system.1
Timeout: No Response from bsidc.co.kr.
[root@kebia_2 /root]#
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpgetnext www.kornet.net public system.1
Timeout: No Response from www.kornet.net.
[root@kebia_2 /root]#
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpgetnext localhost public system.1.0
system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.linux
[root@kebia_2 /root]#
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpgetnext 211.220.193.181 public system.1.0

system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.linux
[root@kebia_2 /root]#

 

 

snmptable

[root@kebia_2 /root]#
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmptable localhost public udpTable
SNMP table: udp.udpTable

udpLocalAddress udpLocalPort

         0.0.0.0          111
         0.0.0.0          161
         0.0.0.0         3891
[root@kebia_2 /root]#
[root@kebia_2 /root]#
[root@kebia_2 /root]# snmpwalk localhost public udpTable
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.111 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.161 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalAddress.0.0.0.0.3891 = IpAddress: 0.0.0.0
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.111 = 111
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.161 = 161
udp.udpTable.udpEntry.udpLocalPort.0.0.0.0.3891 = 3891
[root@kebia_2 /root]#



 

 

 

[root@kebia_2 /root]# snmptest localhost public    
Variable: system.sysDescr.0
Variable:
Received Get Response from 127.0.0.1
requestid 0x1CE3691A errstat 0x0 errindex 0x0
system.sysDescr.0 = Linux kebia_2 2.2.16-22smp #1 SMP Tue Aug 22 16:39:21 EDT 2000 i686
Variable:
Resending last PDU.
Received Get Response from 127.0.0.1
requestid 0x1CE3691A errstat 0x0 errindex 0x0
system.sysDescr.0 = Linux kebia_2 2.2.16-22smp #1 SMP Tue Aug 22 16:39:21 EDT 2000 i686
Variable: system.sysContact.0
Variable:
Received Get Response from 127.0.0.1
requestid 0x1CE3691B errstat 0x0 errindex 0x0
system.sysContact.0 = Me me@somewhere.org
Variable:
Resending last PDU.
Received Get Response from 127.0.0.1
requestid 0x1CE3691B errstat 0x0 errindex 0x0
system.sysContact.0 = Me me@somewhere.org
Variable:
Resending last PDU.
Received Get Response from 127.0.0.1
requestid 0x1CE3691B errstat 0x0 errindex 0x0
system.sysContact.0 = Me me@somewhere.org
Variable:
[root@kebia_2 /root]#


[원글링크] : https://www.linux.co.kr/home2/board/subbs/board.php?bo_table=lecture&wr_id=527


이 글을 트위터로 보내기 이 글을 페이스북으로 보내기 이 글을 미투데이로 보내기

 
박성수
파파
헐렁고수

 
   
 


『신개념 4단계 리눅스기술지원 시스템 공개』

CentOS 리눅스 전문서적 국내최초출시

 
회사소개 | 보도기사 | 채용안내 | 광고안내 | 이용약관 | 개인정보취급방침 | 책임한계와 법적고지 | 불편사항 신고하기 | 사이트맵
ㅇ 서울 : 서울특별시 강남구 노현로79길 66, 402호(역삼동,청송빌딩)  ㅇ 부산 : 부산광역시 해운대구 우동 1470 에이스하이테크21 914호
ㅇ 대표 : 1544-8128 ㅇ부산직통 : 051-744-0077 ㅇ서울직통 : 02-856-0055 ㅇ FAX : 02-6280-2663
ㅇ 사업자번호 : 128-86-68239 ㅇ 통신판매업 신고번호 : 2013-부산금정-0035호 ㅇ 개인정보책임자 : 이재석
ㅇ 상호명 : (주) 수퍼유저 ㅇ 대표자 : 박성수
Copyright ⓒ (주)수퍼유저. All rights reserved.

 아 이 디
 비밀번호
회원 가입 | 비밀번호 찾기

블로그~
 
▷ 네트웍
SMS
MRTG
개념및 프로토콜
네트웍 장비
ACL
책제목
리눅스서버관리실무바이블v3.0


저자 박성수
페이지수 2,032 pages
펴낸곳(주)수퍼유저

리눅스 서버 구축 및 관리에 필요한 거의 모든 부분과 전반적인 실무 기법들을 다루고 있음
책제목
리눅스보안관리실무(2/E)


저자홍석범
페이지수 820 pages
펴낸곳(주)수퍼유저

리눅스 보안에 관련된 내용을 종합적으로 쓴 책. 저자의 명성 그대로 보안관련의 모든 내용이 그대로 담겨져 있다.