Skip to content

Correct way to create a podman-network that can only communicate to services bound on localhost. #22570

Answered by sbrivio-rh
arizvisa asked this question in Q&A
Discussion options

You must be logged in to vote

There are many ways to do this :) I just happened to post an overview at #22653 (comment).

In your specific case, the -T / --tcp-ns option for pasta would probably be the best fit: that will map a localhost-bound port inside the container to a local port on the host. At that point, you could drop the non-loopback interface in the container.

With pasta alone (without the --config-net option, that Podman passes by default), you can already try that out:

$ nc -l 5555

and in another terminal (pasta will detach the network namespace):

$ pasta -T 5555
# echo x | nc -N localhost 5555

Inside the network namespace, there are no addresses other than loopback ones:

# ip address show
1: lo: <LOOPBA…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@arizvisa
Comment options

Answer selected by arizvisa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
network Networking related issue or feature pasta pasta(1) bugs or features
2 participants