Converting an iptables rule to a firewall-cmd rule

2.2k Views Asked by At

I've been working to implement a monitoring software named "logalyze" for a central rsyslog system. For that purpose, I installed a Centos7 server which runs firewalld.

I need to convert below iptables command into a Centos7 firewalld command.

iptables -t nat -A PREROUTING -p udp --destination-port 514 -j REDIRECT --to-ports 1670

This rule is part of a configuration of the central syslog server monitoring specified here.

1

There are 1 best solutions below

0
VIGNESH RS On BEST ANSWER

There are two options you can try,

  1. One disable firewalld and start using iptables for some still you get familiar with firewalld. To do so,

    • systemctl disable firewalld
    • systemctl enable iptables (after installing iptables)

You can use iptables commands itself.

  1. Second option - Firewalld command

firewall-cmd --permenent --direct --add-rule ipv4 nat PREROUTING 0 -p udp --dport 514 -j REDIRECT --to-ports 1670

Above firewalld cmd will do you the purpose.