Firewall – Linux – opened port, but still fail to connect to it using telnet

firewallfirewalldporttelnet

I'm currently working on CentOS 7.3.

In order to activate SNMP, I installed it, configured it and successfully started the service using the firewall-cmd command.

Now, I realized that I need to open the port 161 to make the SNMP start communicating. therefore I ran the following commands below.

$sudo firewall-cmd --permanent --add-port=161/udp --zone-public
Success
$sudo firewall-cmd --reload
Success

After that I checked if the new options are successfully added, and everything turned out to be fine.

But, while trying to check if I had no problem connecting to the port 161 using telnet, I got the following error message.

Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
Trying ::1...
telnet: connect to address ::1: No route to host

Is there any part I'm missing in this step?

Best Answer

You cannot telnet snmp port because its not TCP, is UDP;

Try to test it with snmpget command from the net-snmp package :

http://net-snmp.sourceforge.net/tutorial/tutorial-5/commands/snmpget.html