<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[iptables rule to allow apcupsd traffic to APC management card]]></title><description><![CDATA[<p dir="auto">I need to allow traffic between apcupsd on the host and the APC management card. When iptables is disabled, the host can communicate with the management card. However, when iptables is active, communications no longer occur.</p>
<p dir="auto">I have tried to insert a rule as follows:</p>
<pre><code>ACCEPT   tcp   192.168.xxx.xxx/32   anywhere   tcp dpt:apcupsd state NEW
</code></pre>
<p dir="auto">as the next to last rule in the RH-Firewall-1-INPUT chain. (The IP address belongs to the APC management card.) The rule doesn't allow packets to/from apcupsd.</p>
<p dir="auto">I am no iptables expert (we use FreeBSD) and I am not familiar with how the iptables rules are structured on the xcp-ng host. It appears to be specially tailored to xcp-ng.</p>
<pre><code># iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
RH-Firewall-1-INPUT  all  --  anywhere             anywhere            

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
RH-Firewall-1-INPUT  all  --  anywhere             anywhere            

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain RH-Firewall-1-INPUT (2 references)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     icmp --  anywhere             anywhere             icmp any
ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootps
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     udp  --  anywhere             anywhere             ctstate NEW udp dpt:ha-cluster
ACCEPT     tcp  --  anywhere             anywhere             ctstate NEW tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere             ctstate NEW tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere             ctstate NEW tcp dpt:https
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:21064
ACCEPT     udp  --  anywhere             anywhere             multiport dports hpoms-dps-lstn,netsupport
ACCEPT     tcp  --  192.168.xxx.xxx/32   anywhere             tcp dpt:apcupsd state NEW
REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited
#
</code></pre>
<p dir="auto">Suggestions?</p>
]]></description><link>https://xcp-ng.org/forum/topic/6864/iptables-rule-to-allow-apcupsd-traffic-to-apc-management-card</link><generator>RSS for Node</generator><lastBuildDate>Wed, 13 May 2026 01:08:58 GMT</lastBuildDate><atom:link href="https://xcp-ng.org/forum/topic/6864.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 23 Jan 2023 23:30:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to iptables rule to allow apcupsd traffic to APC management card on Wed, 25 Jan 2023 19:10:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/ajmind-0" aria-label="Profile: Ajmind-0">@<bdi>Ajmind-0</bdi></a><br />
Well, well, I switched to the snmp connection method and it worked just fine. Um...</p>
<p dir="auto">Thank you for your pointer.</p>
]]></description><link>https://xcp-ng.org/forum/post/57833</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/57833</guid><dc:creator><![CDATA[dougs]]></dc:creator><pubDate>Wed, 25 Jan 2023 19:10:25 GMT</pubDate></item><item><title><![CDATA[Reply to iptables rule to allow apcupsd traffic to APC management card on Wed, 25 Jan 2023 16:28:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/fohdeesha" aria-label="Profile: fohdeesha">@<bdi>fohdeesha</bdi></a></p>
<p dir="auto">as already mentioned, I have not modified iptables in regard to the communication with the management nic on our APC ups. It was just working by using dom0 default settings.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/dougs" aria-label="Profile: dougs">@<bdi>dougs</bdi></a><br />
Why using "pcnet" as device instead of snmp? You need to specify a username and a pass passphrase.</p>
<p dir="auto">If you go with snmp it is quite simple to archive.</p>
<pre><code>[17:17 IT1XCP-NG-SLAVE1 apcupsd]# apcaccess
APC      : 001,046,1126
DATE     : 2023-01-25 17:17:30 +0100
HOSTNAME : IT1XCP-NG-SLAVE1
VERSION  : 3.14.14 (31 May 2016) redhat
UPSNAME  : IT1USV1
CABLE    : Ethernet Link
DRIVER   : SNMP UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2022-12-11 14:08:12 +0100
STATUS   : ONLINE
LINEV    : 231.0 Volts
LOADPCT  : 9.0 Percent
BCHARGE  : 100.0 Percent
TIMELEFT : 84.0 Minutes
MBATTCHG : 45 Percent
MINTIMEL : 25 Minutes
MAXTIME  : 0 Seconds
MAXLINEV : 233.0 Volts
MINLINEV : 226.0 Volts
OUTPUTV  : 231.0 Volts
SENSE    : Unknown
DWAKE    : 12000 Seconds
DSHUTD   : 240 Seconds
DLOWBATT : 2 Minutes
LOTRANS  : 161.0 Volts
HITRANS  : 253.0 Volts
RETPCT   : 25.0 Percent
ITEMP    : 26.0 C
ALARMDEL : 5 Seconds
BATTV    : 218.0 Volts
LINEFREQ : 50.0 Hz
LASTXFER : Automatic or explicit self test
NUMXFERS : 1
XONBATT  : 2022-12-18 16:58:19 +0100
TONBATT  : 0 Seconds
CUMONBATT: 1 Seconds
XOFFBATT : 2022-12-18 16:58:20 +0100
LASTSTEST: 2022-12-18 16:58:19 +0100
SELFTEST : OK
STESTI   : 336
STATFLAG : 0x05000008
MANDATE  : 10/11/08
BATTDATE : 02/01/13
NOMOUTV  : 230 Volts
EXTBATTS : 1
FIRMWARE : 477.18.W
END APC  : 2023-01-25 17:18:09 +0100
[17:18 IT1XCP-NG-SLAVE1 apcupsd]#

</code></pre>
]]></description><link>https://xcp-ng.org/forum/post/57825</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/57825</guid><dc:creator><![CDATA[Ajmind 0]]></dc:creator><pubDate>Wed, 25 Jan 2023 16:28:11 GMT</pubDate></item><item><title><![CDATA[Reply to iptables rule to allow apcupsd traffic to APC management card on Wed, 25 Jan 2023 11:57:18 GMT]]></title><description><![CDATA[<p dir="auto">Indeed, to properly edit iptables rules on xcp-ng, you need to add rules to <code>/etc/sysconfig/iptables</code>. I would copy something like the ssh allow line to another line directly below it, and change the port to 161 for example (and change protocol to udp, which I'm pretty sure your card uses, if it's just doing plain snmp). After verifying that fixes it, you can lock the rule down further by allowing this traffic only from the IP of the management card.</p>
<p dir="auto">Example of added line below ssh line:</p>
<pre><code>-A RH-Firewall-1-INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m conntrack --ctstate NEW -m udp --dport 694 -j ACCEPT
##UPS rule
-A RH-Firewall-1-INPUT -p tcp -m conntrack --ctstate NEW -m udp --dport 161 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m conntrack --ctstate NEW -m tcp --dport 80 -j ACCEPT
etc
etc
</code></pre>
<p dir="auto">Note that anytime you edit this file, you must restart iptables for it to take effect with <code>service iptables restart</code></p>
<p dir="auto">Thinking about this further though I don't think this should be necessary, as the ups daemon in dom0 is reaching out to the UPS card, not the other way around, so an explicit open port shouldn't be necessary with the default iptables in dom0 (which allows outbound conns)</p>
]]></description><link>https://xcp-ng.org/forum/post/57807</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/57807</guid><dc:creator><![CDATA[fohdeesha]]></dc:creator><pubDate>Wed, 25 Jan 2023 11:57:18 GMT</pubDate></item><item><title><![CDATA[Reply to iptables rule to allow apcupsd traffic to APC management card on Wed, 25 Jan 2023 09:56:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/dougs" aria-label="Profile: dougs">@<bdi>dougs</bdi></a></p>
<p dir="auto">my settings are:</p>
<pre><code>Chain INPUT (policy ACCEPT)
target     prot opt source               destination
xapi_nbd_input_chain  tcp  --  anywhere             anywhere             tcp dpt:nbd
ACCEPT     gre  --  anywhere             anywhere
RH-Firewall-1-INPUT  all  --  anywhere             anywhere

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
RH-Firewall-1-INPUT  all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
xapi_nbd_output_chain  tcp  --  anywhere             anywhere             tcp spt:nbd

Chain RH-Firewall-1-INPUT (2 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     icmp --  anywhere             anywhere             icmp any
ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootps
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     udp  --  anywhere             anywhere             ctstate NEW udp dpt:ha-cluster
ACCEPT     tcp  --  anywhere             anywhere             ctstate NEW tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere             ctstate NEW tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere             ctstate NEW tcp dpt:https
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:21064
ACCEPT     udp  --  anywhere             anywhere             multiport dports hpoms-dps-lstn,netsupport
ACCEPT     all  --  10.10.10.0/24        anywhere
REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited

Chain xapi_nbd_input_chain (1 references)
target     prot opt source               destination
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable

Chain xapi_nbd_output_chain (1 references)
target     prot opt source               destination
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable
</code></pre>
<p dir="auto">I have some old notes from  <a href="flurweg.net" target="_blank" rel="noopener noreferrer nofollow ugc">flurweg.net</a> about a Xenserver 6.2 setting:</p>
<pre><code>Xenserver firewall, enable port:
If you want to read the values of the UPS connected to the Xenserver from another Linux host with installed CGI-Multimon connected to the Xenserver (NISIP), the Xenserver firewall blocks communication. Tcp port
3551 must be opened, for this the file "/etc/sysconfig/iptables" must be edited, the line: 

"-A RH-Firewall-1-INPUT -p tcp -m tcp -dport 631 -j ACCEPT" 
and paste it below again. In this copied line, change the port to 3551:
</code></pre>
<p dir="auto">May this is what you need to do?</p>
]]></description><link>https://xcp-ng.org/forum/post/57793</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/57793</guid><dc:creator><![CDATA[Ajmind 0]]></dc:creator><pubDate>Wed, 25 Jan 2023 09:56:01 GMT</pubDate></item><item><title><![CDATA[Reply to iptables rule to allow apcupsd traffic to APC management card on Tue, 24 Jan 2023 23:41:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/ajmind-0" aria-label="Profile: Ajmind-0">@<bdi>Ajmind-0</bdi></a><br />
Strange. I'm using UPSTYPE pcnet and the corresponding DEVICE ipaddr:username:password statement. I'm using the exact syntax on all of our FreeBSD servers and they're communicating with the APC management card.</p>
<p dir="auto">What is your iptables configuration like?</p>
]]></description><link>https://xcp-ng.org/forum/post/57778</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/57778</guid><dc:creator><![CDATA[dougs]]></dc:creator><pubDate>Tue, 24 Jan 2023 23:41:15 GMT</pubDate></item><item><title><![CDATA[Reply to iptables rule to allow apcupsd traffic to APC management card on Tue, 24 Jan 2023 11:30:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/olivierlambert" aria-label="Profile: olivierlambert">@<bdi>olivierlambert</bdi></a></p>
<p dir="auto">sorry, I was not detailed enough.</p>
<p dir="auto">In order to use your APC ups via management NIC or usb cable you have to install the "apcupsd" package.</p>
<p dir="auto">In the config file  <em>apcupsd.conf</em> for apcupsd located in</p>
<pre><code>/etc/apcupsd

</code></pre>
<p dir="auto">you could set /define how your ups is communicating with your host(s). The possible parameters are well documented in this file.</p>
<p dir="auto">I have not modified any iptables entry to work with my systems.</p>
]]></description><link>https://xcp-ng.org/forum/post/57717</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/57717</guid><dc:creator><![CDATA[Ajmind 0]]></dc:creator><pubDate>Tue, 24 Jan 2023 11:30:31 GMT</pubDate></item><item><title><![CDATA[Reply to iptables rule to allow apcupsd traffic to APC management card on Tue, 24 Jan 2023 10:31:09 GMT]]></title><description><![CDATA[<p dir="auto">Where do you put this config <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/ajmind-0" aria-label="Profile: Ajmind-0">@<bdi>Ajmind-0</bdi></a> ?</p>
]]></description><link>https://xcp-ng.org/forum/post/57710</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/57710</guid><dc:creator><![CDATA[olivierlambert]]></dc:creator><pubDate>Tue, 24 Jan 2023 10:31:09 GMT</pubDate></item><item><title><![CDATA[Reply to iptables rule to allow apcupsd traffic to APC management card on Tue, 24 Jan 2023 09:59:21 GMT]]></title><description><![CDATA[<p dir="auto">I am using</p>
<pre><code>UPSTYPE snmp
DEVICE 192.168.x.xxx:161:APC:private
</code></pre>
<p dir="auto">This works fine without touching iptables.</p>
]]></description><link>https://xcp-ng.org/forum/post/57703</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/57703</guid><dc:creator><![CDATA[Ajmind 0]]></dc:creator><pubDate>Tue, 24 Jan 2023 09:59:21 GMT</pubDate></item><item><title><![CDATA[Reply to iptables rule to allow apcupsd traffic to APC management card on Tue, 24 Jan 2023 08:02:56 GMT]]></title><description><![CDATA[<p dir="auto">Adding <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/fohdeesha" aria-label="Profile: fohdeesha">@<bdi>fohdeesha</bdi></a> or <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/stormi" aria-label="Profile: stormi">@<bdi>stormi</bdi></a> here</p>
]]></description><link>https://xcp-ng.org/forum/post/57691</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/57691</guid><dc:creator><![CDATA[olivierlambert]]></dc:creator><pubDate>Tue, 24 Jan 2023 08:02:56 GMT</pubDate></item></channel></rss>