多个snmp开放端口 [英] Multiple snmp open port

查看:518
本文介绍了多个snmp开放端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对SNMP有问题.我使用以下代码通过PHP连接到SNMP:

I have a problem with SNMP. I connect to SNMP with PHP using this code:

<?php
 $session = new SNMP(SNMP::VERSION_1, "xxx.xxx.xxx.xxx", "public");
 $fulltree = $session->walk(".");
 print_r($fulltree);
 echo "<br>";
 $session->close();
?>

代码完美运行,这不是问题.问题是我可以使用SNMP连接更多IP吗.我有一个防火墙(ZyWALL),可以有4台打印机.发生此问题是因为我只能在一台打印机上设置161端口,而根本无法设置.

The code works perfectly, it isn't the problem. The problem is can I have more IPs that I need connect with SNMP. I have a firewall (ZyWALL), and can have 4 printers. The problem occurs because I can set the 161 port only at one printer, and not at all.

如何为所有打印机添加端口161?现在我只能看到一台使用SNMP的打印机,但是我需要查看全部.

How I can add the port 161 for all printers? Now i can see only one printers with the SNMP, but i need see all.

推荐答案

选项1是如果不是默认的161,则显式地通过端口

$sessionA = new SNMP(SNMP::VERSION_1, "192.168.1.204", "public"); //for port 161
$sessionB = new SNMP(SNMP::VERSION_1, "192.168.1.204:162", "public"); //for port 162

选项2(取决于您的网络设置)是为每台打印机分配不同的IP,以便您可以轮询每台打印机的端口161

option 2, depending on your network set-up, is to assign different IPs to each printer so you can poll port 161 for each printer

您需要根据访问打印机的规则正确设置防火墙规则.

you need to set up your firewall rules properly and according to the rules you access the printers.

因此,如果您直接在防火墙后面有4台打印机,每台打印机都有其自己的IP地址,则可以在防火墙上映射不同的传入端口,以指向每台打印机的161端口.

so you if you have 4 printers all directly behind the firewall, each printer with it's own IP address, you map different incoming ports on the firewall to point to each respective printer's 161 port.

然后您将像这样打开SNMP会话

you would then open SNMP sessions like this

$sessionA = new SNMP(SNMP::VERSION_1, "public.firewall.ip.address:port1", "public"); 

对于打印机A,其中port1是防火墙上指向打印机161的传入端口

for printer A, where port1 is the incoming port on the firewall that points to 161 on the printer

冲洗并重复使用尽可能多的打印机.

rinse and repeat for as many printers you have.

这篇关于多个snmp开放端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆