[英]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.我需要将 Docker 容器的公开端口转发到远程服务器的远程端口。 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.
一个是 IP 表,但这对我不起作用,因为我无法授予 .NET_ADMIN 对我的容器的访问权限,这些容器将在云提供商的 Kube.nete 托管平台上运行。 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.
第二种方法是使用 SOCAT,但这有它自己的问题,因为它为每个连接分叉一个进程,由于我有数千个并发连接,所以很快就会达到允许打开的文件的最大值。
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?是否有任何替代方案可以像 iptables 一样转发端口,但没有 .NET_ADMIN 要求,也不需要为每个连接创建一个进程?
Check below options:检查以下选项:
1)If you want to connect to a port on a specific IP address without the use of.netcat. 1)如果你想连接到特定IP地址上的端口而不使用.netcat。
Try this te.net host.example.com port
(eg te.net www.example.com 80
).试试这个
te.net host.example.com port
(例如te.net www.example.com 80
)。
Another possibility is /dev/tcp:
另一种可能性是
/dev/tcp:
$ echo "HEAD / HTTP/1.0" >/dev/tcp/[www.example.com/80][1]
. $ 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. 2) 有一个名为
redir
的小型、轻型资源程序,它是非常可配置的。
apt-get install redir
to install on Debian-based distributions. apt-get install redir
安装在基于 Debian 的发行版上。
redir:SRC:DEST
will run in the background as a daemon. redir:SRC:DEST
将作为守护进程在后台运行。
3) R.netd
, It's a daemon that redirects TCP connections. 3)
R.netd
,它是一个重定向 TCP 连接的守护进程。 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查看手册页,看看它是否适合您的需要: 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). 4)
portfwd
, (TCP and UDP forwarding) https:// portfwd.sourceforge.net /, (最新版本是2007, 适用于2.6内核)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.