The English version will be available after the Chinese version:
uinetd:更現代的 rinetd 替代品
uinetd 是一個輕量、現代的端口轉發服務,目標是成為 rinetd 的即插即用替代品,同時提供 rinetd 缺失的 UDP 轉發能力,(比如 支持 IPv4 與 IPv6 互相端口轉發)。並在 IPv6、可觀測性與易用性方面做了增強。它保持了與 rinetd 相近的配置格式,遷移成本很低。
為什麼替換 rinetd
- UDP 支持 :傳統 rinetd 通常只做 TCP 轉發,uinetd 同時支持 TCP/UDP/雙協議。
- IPv6 友好 :原生支持 IPv4 與 IPv6 互相端口轉發。
- 更易用的发行 :单一二进制、支持打包为 deb/rpm。
- 低改动迁移 :配置格式与 rinetd 接近,仅新增“协议”一列。
主要特性
- 协议支持 :
tcp
、udp
、both
/all
(同时启两个监听) - IPv4/IPv6 :靈活的地址格式,IPv6 使用
2001:db8::1
、[2001:db8::1]
- 轻量单文件 :无外部依赖,部署简单
- 清晰日志 :可配置
loglevel
,便于排障
最小可用配置
编辑 /etc/uinetd.conf
(与 rinetd 类似,结尾多一列“协议”):
# bindaddr bindport connectaddr connectport protocol
0.0.0.0 8080 127.0.0.1 80 tcp
0.0.0.0 53 1.1.1.1 53 udp
[::] 443 [2001:db8::1] 8443 both
# 日志等级:1=错误,2=简要,3=阻止日志+错误,4=连接明细+错误
loglevel 1
启动:
uinetd -c /etc/uinetd.conf
可选 systemd
(简化示例):
[Unit]
Description=uinetd - internet redirection server
After=network.target
[Service]
ExecStart=/usr/local/bin/uinetd -c /etc/uinetd.conf
Restart=on-failure
[Install]
WantedBy=multi-user.target
從 rinetd 平滑遷移
新增協議列 :rinetd 的四列規則,遷移到 uinetd 時在末尾加上協議即可。
- 例:
0.0.0.0 8080 127.0.0.1 80
→0.0.0.0 8080 127.0.0.1 80 tcp
- 例:
- 同時轉發 TCP+UDP :把協議寫為
both
或all
。 - IPv6 :使用方括號,如
[::]
、[2001:db8::1]
。 - 域名 :目標地址可直接使用域名。
常見用例
- DNS 代理(UDP) :
0.0.0.0 53 1.1.1.1 53 udp
- Web 反向轉發(TCP) :
0.0.0.0 8080 127.0.0.1 80 tcp
- IPv6→IPv6(both) :
[::] 443 [2001:db8::1] 8443 both
總結
如果你在尋找一個與 rinetd 體驗相近、卻能原生支持 UDP/IPv6、並具備更好包發行與可觀測性的工具,uinetd 是一個穩妥的現代替代方案。歡迎試用並在生產環境中逐步替換現有 rinetd 配置。
- 項目地址 :GitHub 倉庫
uinetd: A More Modern Alternative to rinetd
uinetd is a lightweight, modern port forwarding service designed to be a plug-and-play replacement for rinetd, while also providing UDP forwarding capabilities that rinetd lacks (such as native IPv4 and IPv6 mutual port forwarding). It enhances IPv6 support, observability, and usability. It maintains a similar configuration format to rinetd, making migration easy and low-cost.
Why Replace rinetd
- UDP Support : Traditional rinetd typically only forwards TCP. uinetd supports TCP, UDP, and dual-protocol forwarding.
- IPv6 Friendly : Native support for IPv4 to IPv6 port forwarding and vice versa.
- Easier Distribution : Single binary, supports packaging as deb/rpm.
- Low Migration Effort : Configuration format remains close to rinetd, only adding a "protocol" column.
Key Features
- Protocol Support :
tcp
,udp
,both
/all
(starts two listeners simultaneously) - IPv4/IPv6 : Flexible address formats; IPv6 can be specified as
2001:db8::1
or[2001:db8::1]
- Lightweight Single File : No external dependencies, straightforward deployment
- Clear Logging : Configurable
loglevel
for easy troubleshooting
Minimal Working Configuration
Edit /etc/uinetd.conf
(similar to rinetd but with an extra protocol column):
# bindaddr bindport connectaddr connectport protocol
0.0.0.0 8080 127.0.0.1 80 tcp
0.0.0.0 53 1.1.1.1 53 udp
[::] 443 [2001:db8::1] 8443 both
# 日志等级:1=错误,2=简要,3=阻止日志+错误,4=连接明细+错误
loglevel 1
Start:
[Unit]
Description=uinetd - internet redirection server
After=network.target
[Service]
ExecStart=/usr/local/bin/uinetd -c /etc/uinetd.conf
Restart=on-failure
[Install]
WantedBy=multi-user.target
Smooth Migration from rinetd
Add Protocol Column : rinetd’s four-column rules become five columns by adding protocol.
- Example:
0.0.0.0 8080 127.0.0.1 80
→0.0.0.0 8080 127.0.0.1 80 tcp
- Example:
- TCP+UDP Forwarding : Use
both
orall
as the protocol. - IPv6 Support : Use brackets for IPv6 addresses like
[::]
or[2001:db8::1]
. - Hostnames : Destination address can use domain names directly.
Common Use Cases
- DNS Proxy (UDP) :
0.0.0.0 53 1.1.1.1 53 udp
- Web Reverse Proxy (TCP) :
0.0.0.0 8080 127.0.0.1 80 tcp
- IPv6 to IPv6 (both) :
[::] 443 [2001:db8::1] 8443 both
Conclusion
If looking for a tool that provides a rinetd-like experience with native UDP and IPv6 support, improved packaging, and better observability, uinetd is a reliable modern replacement. It is recommended to try it and gradually migrate existing rinetd configurations in production environments.
- Project URL : GitHub Repository