EOP Linux: Redirect Port 515 > 8515 Fails

EveryonePrint operates its LDP server exclusively on TCP port 8515, and it's not adjustable. In this article, we'll shed light on how iptables plays a crucial role in redirecting incoming connections from LPD port 515 to port 8515.

Context:

Since EveryonePrint for Linux 4.2.1, an eop-lpd service is enabled and started by default.

4.2.1 [2017-06-13]
+ Ability to hide release link in Email Print tab
+ Allow email addresses for username when creating external guest accounts
+ Ability to allow a partial printer identifier match in subject of email
+ Add LPD server on Linux
 EveryonePrint runs its LDP server on TCP port 8515, and that cannot be changed.
iptables is used in the application to redirect incoming connection on LPD port 515 to this 8515.

Issue:

 On some systems it has been reported that the iptable redirection doesn't work, as seen below:
 $ cat /var/log/messages |grep redirect 
2017-09-21T14:49:05.349844+02:00 elps02 disable_redirect.sh[17574]: Disabling redirect for IF: eth0... 
2017-09-21T14:49:05.361589+02:00 elps02 disable_redirect.sh[17574]: iptables v1.4.21: can't initialize iptables table `nat': Permission denied (you must be root) 
2017-09-21T14:49:05.361774+02:00 elps02 disable_redirect.sh[17574]: Perhaps iptables or your kernel needs to be upgraded. 
2017-09-21T14:49:05.363727+02:00 elps02 disable_redirect.sh[17574]: iptables v1.4.21: can't initialize iptables table `nat': Permission denied (you must be root) 

Resolution:

 Open a terminal session: 
  • cd to: /opt/everyoneprint/system-init
  • enter:  sudo ./enable_redirect.sh

  • this will enable the rule, that you can verify with: sudo iptables -L -t nat |grep 8515

  • result should be:

    REDIRECT   tcp  --  anywhere             anywhere             tcp dpt:printer redir ports 8515<br />REDIRECT   udp  --  anywhere             anywhere             udp dpt:printer redir ports 8515

Warning: the change in iptables is not permanent, after a reboot of the server, the command needs to be launched again