처음으로

 

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

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]#

 



Copyright(c) 2001, 수퍼유저코리아 All Rights Reserved.
서버구축(운용)상담 : e-mail : webmaster@superuser.co.kr