Discussion:
snmpget returns Unknown host
Reza Salehi
18 years ago
Permalink
Hi All,

I am having problem with snmpget or set on query from local host.
When I type : snmpget -d -v 2c -c TC localhost sysUpTime
snmpget : Unknown host

But if I use the real IP address of machine it will work:

snmpget -v 2c -c TC 192.168.0.12 sysUpTime
SNMPv2-MIB::sysUpTime.0=................09:01

I appreciate it if someone can help me with that.

Regards,
Reza


---------------------------------
Moody friends. Drama queens. Your life? Nope! - their life, your story.
Play Sims Stories at Yahoo! Games.
Mike Ayers
18 years ago
Permalink
Behalf Of Reza Salehi
Sent: Thursday, August 30, 2007 3:01 PM
I am having problem with snmpget or set on query from local host.
When I type : snmpget -d -v 2c -c TC localhost sysUpTime
snmpget : Unknown host
snmpget -v 2c -c TC 192.168.0.12 sysUpTime
SNMPv2-MIB::sysUpTime.0=................09:01
Most likely, you don't have "localhost" defined in your hosts file. Try getting from "127.0.0.1" instead of "localhost".


HTH,

Mike
Reza Salehi
18 years ago
Permalink
Thanks Mike for your response.

When I use 127.0.0.1 it works fine but I can also so do < ping localhost > and that works fine too.It seems snmpget doesn't like the localhost name.
Any suggestion in this matter would be appreciated.

Regards,
Reza

Note: forwarded message attached.


---------------------------------
Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on, when.
Mike Ayers
18 years ago
Permalink
Behalf Of Reza Salehi
When I use 127.0.0.1 it works fine but I can also so do <
ping localhost > and that works fine too.
I doubt that means anything, since I would expect ping to have the value of "localhost" compiled in.
It seems snmpget
doesn't like the localhost name.
Just look at your /etc/hosts file. If it doesn't define "localhost", you can't use it. Many current distros don't, for reasons I cannot fathom.


HTH,

Mike
Mike Ayers
18 years ago
Permalink
Behalf Of Reza Salehi
When I use 127.0.0.1 it works fine but I can also so do <
ping localhost > and that works fine too.
I doubt that means anything, since I would expect ping to have the value of "localhost" compiled in.
It seems snmpget
doesn't like the localhost name.
Just look at your /etc/hosts file. If it doesn't define "localhost", you can't use it. Many current distros don't, for reasons I cannot fathom.


HTH,

Mike

--0-952496257-1188603783=:56845--
Mike Ayers
18 years ago
Permalink
Behalf Of Reza Salehi
Sent: Thursday, August 30, 2007 3:01 PM
I am having problem with snmpget or set on query from local host.
When I type : snmpget -d -v 2c -c TC localhost sysUpTime
snmpget : Unknown host
snmpget -v 2c -c TC 192.168.0.12 sysUpTime
SNMPv2-MIB::sysUpTime.0=................09:01
Most likely, you don't have "localhost" defined in your hosts file. Try getting from "127.0.0.1" instead of "localhost".


HTH,

Mike

--0-1089352702-1188585106=:41073--
Reza Salehi
18 years ago
Permalink
Thanks Mike.

The following line is in that file:

127.0.0.1 localhost.localhostdomain localhost


It seems it defined fine.Is there any other place that might be changed?

Regards,
Reza



Note: forwarded message attached.


---------------------------------
Got a little couch potato?
Check out fun summer activities for kids.
Mike Ayers
18 years ago
Permalink
Behalf Of Reza Salehi
Sent: Friday, August 31, 2007 4:43 PM
127.0.0.1 localhost.localhostdomain localhost
Next step is to look in /etc/nsswitch.conf. The "hosts:" line should have "files" in front.

Before that, you may want to try telnet to localhost just to see if it can resolve the name.


HTH,

Mike
Mike Ayers
18 years ago
Permalink
Behalf Of Reza Salehi
Sent: Friday, August 31, 2007 4:43 PM
127.0.0.1 localhost.localhostdomain localhost
Next step is to look in /etc/nsswitch.conf. The "hosts:" line should have "files" in front.

Before that, you may want to try telnet to localhost just to see if it can resolve the name.


HTH,

Mike

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Net-snmp-users mailing list
Net-snmp-***@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

--0-1435435755-1188941045=:80282--
Reza Salehi
18 years ago
Permalink
Mike,

I check that file and that line is there(hosts: files dns).
I also can do telnet localhost.

But still when I do "snmpget ....localhost ....." I get the Unknown Host error.

Any other suggestion?
I appreciate your help.

Regards,
Reza


Note: forwarded message attached.


---------------------------------
Need a vacation? Get great deals to amazing places on Yahoo! Travel.
Mike Ayers
18 years ago
Permalink
Behalf Of Reza Salehi
Sent: Tuesday, September 04, 2007 2:24 PM
I check that file and that line is there(hosts: files dns).
I also can do telnet localhost.
But still when I do "snmpget ....localhost ....." I get
the Unknown Host error.
Any other suggestion?
Nope. You've got a major problem here - either net-snmp is miscompiled (or compiled for the wrong target), or your networking is misconfigured. I'd suggest calling your IT to have a look, and if they can't find a problem, you might want to build the latest net-snmp from scratch.


Sorry,

Mike
Mike Ayers
18 years ago
Permalink
Behalf Of Reza Salehi
Sent: Tuesday, September 04, 2007 2:24 PM
I check that file and that line is there(hosts: files dns).
I also can do telnet localhost.
But still when I do "snmpget ....localhost ....." I get
the Unknown Host error.
Any other suggestion?
Nope. You've got a major problem here - either net-snmp is miscompiled (or compiled for the wrong target), or your networking is misconfigured. I'd suggest calling your IT to have a look, and if they can't find a problem, you might want to build the latest net-snmp from scratch.


Sorry,

Mike

--0-635395158-1188945401=:94892--

Reza Salehi
18 years ago
Permalink
Mike,

The good thing is I can run the commands using 127.0.0.1 instead of localhost but As you mentioned I might need to rebuild again the net-snmp.

Thanks for your help.
Regards,
Reza

Note: forwarded message attached.

---------------------------------
Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool.
Loading...