| Crates.io | netns-proxy |
| lib.rs | netns-proxy |
| version | 0.2.1 |
| created_at | 2025-05-19 20:57:38.39784+00 |
| updated_at | 2025-06-20 11:40:52.19074+00 |
| description | Forwards incoming requests to a given target while outgoing connections are created from different namespace |
| homepage | |
| repository | https://github.com/fooker/netns-proxy |
| max_upload_size | |
| id | 1680406 |
| size | 36,520 |
A simple and slim proxy to forward ports from and into linux network namespaces.
netns-proxy is a plain and simple proxy for TCP, UDP and SCTP that allows to
accept connections in one network namespace and forwards them into another.
This allows to expose ports that are only accessible in one namespace to a
second one. This provides a lightweight alternative to connecting namespace with
veth interfaces which require address management and firewall rules for
forwarding.
netns-proxy does its job by opening a socket when it is started and switches
to the target namespace before opening connections to the exposed server. This
allows the accepting socket to exist in the original namespace while forwarded
connection happen in the specified namespace.
You can install the latest released version directly from [crates.io]:
cargo install netns-proxy
# Clone the source
git clone https://github.com/fooker/netns-proxy.git
cd netns-proxy
cargo build --release
The binary will be in target/release/netns-proxy.
Requires nix.
# Clone the source
git clone https://github.com/fooker/netns-proxy.git
cd netns-proxy
nix-build
netns-proxy [OPTIONS] <netns> <target>
<netns> is the name of the network namespace from which forwarded connections
are created.<target> the target host and port to forward connections to.See netns-proxy --help for full details and options.
Feel free to open an Issue or write me a Mail.
:+1: Thanks for your help to improve the project! Pleas don't hesitate to create an Issue if you find something is off or even consider creating a patch and propose a Pull-Request.
The project is licensed under the MIT license.