containers / gvisor-tap-vsock

A new network stack based on gVisor
Apache License 2.0
269 stars 50 forks source link

[Question] How to run a service on a host that the guest can connect to? #361

Closed DUOLabs333 closed 6 months ago

DUOLabs333 commented 6 months ago

I was able to get gvproxy successfully running on a MacOS host, and a Linux guest to connect to the host --- ping -c1 192.168.127.1 on the guest succeeds, and I can see the corresponding connection message on the host. However, when I tried running an iperf3 server on the host so I can test the connection speed on the client, the client failed to connect. The server is running on 192.168.127.1.

cfergeau commented 6 months ago

There is this script to test gvisor-tap-vsock performance, and it's using iperf3 https://github.com/containers/gvisor-tap-vsock/blob/main/test/performance.sh so this should work somehow.

Be careful though, 192.168.127.1 is the network gateway IP, the host IP is 192.168.127.254. I just tested with netcat that if I run nc -l 5050 on the host, I have to use nc 192.168.127.254 5050 on the guest to successfully connect. Connection to port 5050 is refused if I try 192.168.127.1.

DUOLabs333 commented 6 months ago

Starting a server on localhost on the host, and connecting to 192.168.127.254 on the guest works.