Giter Site home page Giter Site logo

Help: Port forwarding problem about vpnkit HOT 2 CLOSED

moby avatar moby commented on September 27, 2024
Help: Port forwarding problem

from vpnkit.

Comments (2)

djs55 avatar djs55 commented on September 27, 2024

Hi -- I think I can spot 2 problems:

  • as you suspected, port forwarding is done over virtio-vsock. There are 2 parts to this: the control interface is currently a 9P filesystem mount manipulated by vpnkit-expose-port (although we'll probably replace this with GRPC or similar at some point). Once the port is "exposed" and vpnkit is listening on the host, incoming connections are forwarded over AF_VSOCK connections to a server process called vpnkit-forwarder -- I suspect this will fail to start if the kernel doesn't support the address family.

  • secondly, I think there's a minor problem in the vpnkit-expose-port command line. When incoming connections are forwarded, vpnkit writes a short header telling vpnkit-forwarder the final destination to connect to which is the container-ip on the vpnkit-expose-port command line. So I think you to give it an IP bound inside the VM instead of 0.0.0.0:

~/vpnkit-expose-port.linux -i -host-ip 127.0.0.1 -host-port 8000 -container-ip 127.0.0.1 -container-port 8000 -no-local-ip

At one point in the past we did support using the internal network for port forwarding but unfortunately that code was removed :(

Another way you could set up access would be a reverse port forward with ssh -- inside the VM you should be able to ssh <vpnkit gateway IP> -R localhost:8000:127.0.0.1:8000 (if I've remembered the syntax properly). This will connect to the host's sshd and tell it to listen on localhost:8000 (on the host) and forward connections back to 127.0.0.1:8000 in the VM.

In case it's helpful, recent versions of vpnkit should respond to DNS queries for docker.for.mac.localhost with the vpnkit IP. (Although we'll probably have to change the DNS name used since we shouldn't have used localhost)

Hope this helps a little!

from vpnkit.

gerboland avatar gerboland commented on September 27, 2024

Hey djs55,
thank you so much for the info, you've cleared up a lot of for me. Reverse port forwarding sounds like a more flexible solution for my needs.
Thanks again!
-G

from vpnkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.