简体   繁体   中英

Any alternatives to socat and netcat for port forwarding?

I need to forward an exposed port of a Docker container to a remote port of a remote server. There are two approaches. One is with IP tables, but this wouldn't work for me since I'm not able to give.NET_ADMIN access to my containers, which will be running on a cloud provider's Kube.nete hosting platform. The second approach would be to utilize SOCAT, but that has it's own problems since it forks a process for each connection, reaching the maximum allowed open files in no time since I have thousands of concurrent connections.

Are there any alternatives, which can forward a port like iptables does, but without.NET_ADMIN requirements, and without needing to create a process for each connection?

Check below options:

1)If you want to connect to a port on a specific IP address without the use of.netcat.

Try this te.net host.example.com port (eg te.net www.example.com 80 ).

Another possibility is /dev/tcp:

$ echo "HEAD / HTTP/1.0" >/dev/tcp/[www.example.com/80][1] .

2)There's a tiny, light resources program called redir which is pretty configurable.

apt-get install redir to install on Debian-based distributions.

redir:SRC:DEST will run in the background as a daemon.

3) R.netd , It's a daemon that redirects TCP connections. Have a look at the man page to see if it suits your needs: https://manpages.debian.org/unstable/r.netd/r.netd.8.en.html

4) portfwd , (TCP and UDP forwarding) https:// portfwd.sourceforge.net /, (it latest release is 2007, and it works on 2.6 kernel).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM