I want to make iptables redirect internally from one port to another only if a service is listening to that port. Is it possible?
Tell me more
×
Server Fault is a question and answer site for
professional system and network administrators. It's 100% free, no registration required.
|
AFAIK IPtables doesn't have enough information to do that effectively. You would probably need to write a script that uses netcat or data from netstat to decide if the port is listening, and if so do the redirect. Run that script from cron. |
|||
|
Sure, you can do it:
|
|||
|
