<?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[Modbus Publisher on Port 502]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I tried to publish Modbus IP on port 502, however I get this error:<br />
<img src="https://camo.nodebb.org/5af6a903042406150bab3e8f3073acb247099d67?url=https%3A%2F%2Fi.imgur.com%2FDEWBdDR.png" alt="0_1597816225690_7d37aacd-d2d9-46c3-aeed-2d3cf01f2b71-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">It works with any other ports greater than 1000, but port 502 is standard for Modbus. If I stop the Mango service and start it again with Sudo it accepts the port 502 as well. So definitely it's about system's permission level to use port 502.<br />
Now my question is how I can make the Mango service to run as Sudo on the start-up, FYI I am using Mango GT. Any solution??</p>
<p dir="auto">Thanks,<br />
Saeed</p>
]]></description><link>https://forum.mango-os.com/topic/4912/modbus-publisher-on-port-502</link><generator>RSS for Node</generator><lastBuildDate>Tue, 19 May 2026 22:32:32 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/4912.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 19 Aug 2020 05:29:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Modbus Publisher on Port 502 on Fri, 21 Aug 2020 02:00:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/craigweb" aria-label="Profile: craigweb">@<bdi>craigweb</bdi></a><br />
Thanks Craig for your help, it worked :-)</p>
]]></description><link>https://forum.mango-os.com/post/25658</link><guid isPermaLink="true">https://forum.mango-os.com/post/25658</guid><dc:creator><![CDATA[skazemi]]></dc:creator><pubDate>Fri, 21 Aug 2020 02:00:17 GMT</pubDate></item><item><title><![CDATA[Reply to Modbus Publisher on Port 502 on Thu, 20 Aug 2020 07:26:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/skazemi" aria-label="Profile: skazemi">@<bdi>skazemi</bdi></a> said in <a href="/post/25656">Modbus Publisher on Port 502</a>:</p>
<blockquote>
<p dir="auto">t's why in rasb</p>
</blockquote>
<p dir="auto">What I was trying to say is that this is a rasbian issue and that I have found multiple threads where people have failed when putting rules in rc.local. <a href="https://blog.mxard.com/persistent-iptables-on-raspberry-pi-raspbian" rel="nofollow ugc">https://blog.mxard.com/persistent-iptables-on-raspberry-pi-raspbian</a></p>
<p dir="auto">Iptables-persistent is safe to use and will not interfere with the mango service. I have used it on several servers that use cloud connect.  CC does not use iptable it does port forwarding with sshd</p>
]]></description><link>https://forum.mango-os.com/post/25657</link><guid isPermaLink="true">https://forum.mango-os.com/post/25657</guid><dc:creator><![CDATA[CraigWeb]]></dc:creator><pubDate>Thu, 20 Aug 2020 07:26:18 GMT</pubDate></item><item><title><![CDATA[Reply to Modbus Publisher on Port 502 on Thu, 20 Aug 2020 07:14:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/craigweb" aria-label="Profile: craigweb">@<bdi>craigweb</bdi></a> said in <a href="/post/25655">Modbus Publisher on Port 502</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dave-frazier" aria-label="Profile: Dave-Frazier">@<bdi>Dave-Frazier</bdi></a> Can you take a look at this.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/skazemi" aria-label="Profile: skazemi">@<bdi>skazemi</bdi></a> I have found a number of forum threads on the rasbian forum stating that the iptables do not persist.  Most responces recommend using <code>apt-get install iptables-persistent</code></p>
</blockquote>
<p dir="auto">Yes, iptables does not persis, that's why in rasbian I put the rules in rc.local, so every time they are added to the iptables after restarting OS. I can try iptables-persistent but I'm afraid that it interferes Mango service, because I saw this section in the ui and it means Mango also is working with iptables, is it the case??</p>
<p dir="auto"><img src="https://camo.nodebb.org/e54e29c1d67c4d67c897702bb2c24c9765d2bc75?url=https%3A%2F%2Fi.imgur.com%2F4ejHbNT.png" alt="0_1597908933587_913afcac-8895-4aef-bfac-c6f18332483c-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.mango-os.com/post/25656</link><guid isPermaLink="true">https://forum.mango-os.com/post/25656</guid><dc:creator><![CDATA[skazemi]]></dc:creator><pubDate>Thu, 20 Aug 2020 07:14:07 GMT</pubDate></item><item><title><![CDATA[Reply to Modbus Publisher on Port 502 on Thu, 20 Aug 2020 06:21:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dave-frazier" aria-label="Profile: Dave-Frazier">@<bdi>Dave-Frazier</bdi></a> Can you take a look at this.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/skazemi" aria-label="Profile: skazemi">@<bdi>skazemi</bdi></a> I have found a number of forum threads on the rasbian forum stating that the iptables do not persist.  Most responces recommend using <code>apt-get install iptables-persistent</code></p>
]]></description><link>https://forum.mango-os.com/post/25655</link><guid isPermaLink="true">https://forum.mango-os.com/post/25655</guid><dc:creator><![CDATA[CraigWeb]]></dc:creator><pubDate>Thu, 20 Aug 2020 06:21:38 GMT</pubDate></item><item><title><![CDATA[Reply to Modbus Publisher on Port 502 on Thu, 20 Aug 2020 06:02:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/craigweb" aria-label="Profile: craigweb">@<bdi>craigweb</bdi></a> said in <a href="/post/25648">Modbus Publisher on Port 502</a>:</p>
<blockquote>
<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/skazemi" aria-label="Profile: skazemi">@<bdi>skazemi</bdi></a></p>
<p dir="auto">Do you have a Modbus data source that is bound to 502 as well?</p>
</blockquote>
<p dir="auto">Yes, actually all my data sources are Modbus/TCP on port 502 which I don't have any issue to pull data from them. The only issue is publishing on Mango port 502.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terrypacker" aria-label="Profile: terrypacker">@<bdi>terrypacker</bdi></a> said in <a href="/post/25650">Modbus Publisher on Port 502</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/skazemi" aria-label="Profile: skazemi">@<bdi>skazemi</bdi></a> you have a few options, by default linux restricts access to ports below 1000 (which you have figured out).</p>
<p dir="auto">I suggest you follow this procedure which will allow Mango to safely run with the proper privileges to access port 502: <a href="https://help.infiniteautomation.com/linux-installation" rel="nofollow ugc">https://help.infiniteautomation.com/linux-installation</a></p>
</blockquote>
<p dir="auto">The service is already installed and running on Mango GT and I couldn't find anything which can help with that, except this that I didn't know!!<br />
"<strong>Note: Never</strong> run Mango as root, this is a security risk and will also result in files in /opt/mango having the incorrect owner."</p>
<blockquote>
<p dir="auto">But for general reference you have other options:</p>
<ol>
<li>
<p dir="auto">You could use iptables to route traffic between ports.  Here is an example of how we route traffic between 8080 &lt;--&gt; 80 <a href="https://help.infiniteautomation.com/linux-security" rel="nofollow ugc">https://help.infiniteautomation.com/linux-security</a></p>
</li>
<li>
<p dir="auto">I can't remember if the GT support ipchains but you could try those with something like this<br />
<code>/sbin/ipchains -I input --proto TCP --dport 502 -j REDIRECT 5020</code></p>
</li>
</ol>
</blockquote>
<p dir="auto">For these two solutions, I need to put the rule somewhere like rc.local to run in startup, however it didn'twork! looks like Mango or something else overwritten the iptables after bootup. I already asked about this in another post, no answer yet:<br />
<a href="https://forum.infiniteautomation.com/topic/4908/port-forwarding-issue-with-mango-gt" rel="nofollow ugc">https://forum.infiniteautomation.com/topic/4908/port-forwarding-issue-with-mango-gt</a></p>
<blockquote>
<ol start="3">
<li>You could try <code>setuid</code> to allow the Mango process to access port 502</li>
</ol>
<p dir="auto">Hope that helps.</p>
</blockquote>
<p dir="auto">I'll try this!</p>
]]></description><link>https://forum.mango-os.com/post/25654</link><guid isPermaLink="true">https://forum.mango-os.com/post/25654</guid><dc:creator><![CDATA[skazemi]]></dc:creator><pubDate>Thu, 20 Aug 2020 06:02:58 GMT</pubDate></item><item><title><![CDATA[Reply to Modbus Publisher on Port 502 on Wed, 19 Aug 2020 14:09:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/skazemi" aria-label="Profile: skazemi">@<bdi>skazemi</bdi></a> you have a few options, by default linux restricts access to ports below 1000 (which you have figured out).</p>
<p dir="auto">I suggest you follow this procedure which will allow Mango to safely run with the proper privileges to access port 502: <a href="https://help.infiniteautomation.com/linux-installation" rel="nofollow ugc">https://help.infiniteautomation.com/linux-installation</a></p>
<p dir="auto">But for general reference you have other options:</p>
<ol>
<li>
<p dir="auto">You could use iptables to route traffic between ports.  Here is an example of how we route traffic between 8080 &lt;--&gt; 80 <a href="https://help.infiniteautomation.com/linux-security" rel="nofollow ugc">https://help.infiniteautomation.com/linux-security</a></p>
</li>
<li>
<p dir="auto">I can't remember if the GT support ipchains but you could try those with something like this<br />
<code>/sbin/ipchains -I input --proto TCP --dport 502 -j REDIRECT 5020</code></p>
</li>
<li>
<p dir="auto">You could try <code>setuid</code> to allow the Mango process to access port 502</p>
</li>
</ol>
<p dir="auto">Hope that helps.</p>
]]></description><link>https://forum.mango-os.com/post/25650</link><guid isPermaLink="true">https://forum.mango-os.com/post/25650</guid><dc:creator><![CDATA[terrypacker]]></dc:creator><pubDate>Wed, 19 Aug 2020 14:09:48 GMT</pubDate></item><item><title><![CDATA[Reply to Modbus Publisher on Port 502 on Wed, 19 Aug 2020 07:39:59 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/skazemi" aria-label="Profile: skazemi">@<bdi>skazemi</bdi></a></p>
<p dir="auto">Do you have a Modbus data source that is bound to 502 as well?</p>
]]></description><link>https://forum.mango-os.com/post/25648</link><guid isPermaLink="true">https://forum.mango-os.com/post/25648</guid><dc:creator><![CDATA[CraigWeb]]></dc:creator><pubDate>Wed, 19 Aug 2020 07:39:59 GMT</pubDate></item></channel></rss>