Posts Tagged ‘ Iptables ’

iptables: Port Redirection

Syntax

The syntax is as follows to redirect tcp $srcPortNumber port to $dstPortNumber:

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport $srcPortNumber -j REDIRECT --to-port $dstPortNumber

Example:

The following example redirects TCP port 25 to port 2525:

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 25 -j REDIRECT --to-port 2525

VPS iptables rule limit

We installed csf firewall in main node and we have following error when try to start firewall

[root@csf]# csf -s
Error: The VPS iptables rule limit (numiptent) is too low (400/400) – stopping firewall to prevent iptables blocking all connections, at line 123

Solution:

vzctl set veid –numipt 400 –save