On Fri, Feb 22, 2013 at 04:19:12PM +0800, Donghua Liu wrote: > Now I have such a scenario that I should write different nat rules > according to the designated locally port is open or not. > For example, if the port is listening then do the nat operation, > otherwise do not use this rule. There's nothing within Netfilter/iptables to do this. > Any help would be greatly appreciated! You could script something (sh, python, perl, whatever you like) to check the port state and enable or disable the rule as desired. -- http://rob0.nodns4.us/ -- system administration and consulting Offlist GMX mail is seen only if "/dev/rob0" is in the Subject: -- To unsubscribe from this list: send the line "unsubscribe netfilter" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html