Is it possible to re-bind already opened listening socket from localhost to 0.0.0.0 (all interfaces) in linux? I have an app that listens only on localhost and does not provide an option to listen on all interfaces. I need to connect to this program from another interface, but I don't want to patch the program. So I need to turn this:
netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:port 0.0.0.0:* LISTEN pid/name
Into this:
netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:port 0.0.0.0:* LISTEN pid/name
Transparently for the program itself. It would be also acceptable if I could somehow make the kernel accept connections from external interfaces to 127.0.0.1 without rebinding the socket.
Is it possible? Thanks!