-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bridging to VPN interface and en0
removes SSH access
#473
Comments
Just to clarify:
Did I understand your setup correctly? In that case I think we can an option to provide multiple interfaces for the bridged mode since Can I also ask you to provide output of |
Yes, basically. Although I think the
Will do once I have one machine ready for testing again. Currently, they are busy (hosting 1-2 VMs using tart for CI purposes), so the NAT configuration is modified as described in the initial post.
Since |
Does the standard shared network (NAT) allows access from the host for you? Or I'm misunderstanding the notion of host? The same shared network would also allow access to VPN resources, if the VPN routes are configured adequately. You can check this with |
Inspired by cirruslabs/tart#473
In the meantime I'm adding support for Bridged network to Orchard in cirruslabs/orchard#78. In case of Orchard, just having one bridged network for VPN will be enough since SSHing is done through a runnel via an agent sitting on the host. |
Yes, that works fine. However, without the added NAT rule mentioned in #384 (comment), I cannot access the VPN interface > sudo pfctl -s nat -a com.apple.internet-sharing/shared_v4
No ALTQ support in kernel
ALTQ related functions disabled
nat on en0 inet from 192.168.64.0/24 to any -> (en0:0) extfilter ei
no nat on bridge100 inet from 192.168.64.1 to 192.168.64.0/24
nat on utun0 inet from 192.168.64.0/24 to any -> 172.XX.YY.ZZ # VPN The latter rule is the one I add using that cron job, which basically adds the following rule:
This rule is translated to the syntax seen above.
I think tart should probably receive a configuration feature or CLI parameter where you can specify the VPN interface so it can automatically add that rule. I'm sure I'm not the only person in this community that depends on such a setup. |
I'm afraid that this would be too much of a hack to implement since this requires I think a more productive direction would be figure out why in your case the NAT rules are not getting added automatically. For example, when I run the Tailscale VPN, the needed PF rules are inserted automagically:
As a result, both LAN and VPN networks are accessible from the guests when running default shared (NAT) networking (no Perhaps you could provide some ways to reproduce your case? And/or share some more details on your VPN configuration, like the VPN client used, the routes installed ( |
* Support Bridged Network Inspired by cirruslabs/tart#473 * Fixed tests
We use OpenVPN (directly, via homebrew, not via Tunnelblick).
|
Thanks for the details! I've actually tried playing with OpenVPN on macOS and manually setting the default gateway to point to be the OpenVPN, and I think my statement in #384 (comment) regarding the need for the default gateway is wrong. The real cause seems to be whether the VPN client uses macOS APIs or configures the interface manually, e.g. the WireGuard seems to use the Network Extension, which results in the following And the NAT rules are added automatically, which is not the case for OpenVPN, which configures the VPN interface manually: I've checked and the Tunnelblick seems to use the same underlying OpenVPN code, so no luck here. |
Will check if allowing the |
I've just realized that Neither manually creating a bridged interface with Unfortunately, at this point I don't see any solid options besides switching to a VPN solution that uses macOS APIs (e.g. WireGuard), which will guarantee proper NAT functioning. As a side note, regarding the ability to specify multiple interfaces for a VM: it is possible to implement, but is somewhat complicated because we'd need to have more than one MAC-address for a VM. If we re-use the single MAC from the VM's config, |
Thanks! I would have never guessed that using some native macOS API to set up VPN in the UI, too, would make such a big difference...
The interface doesn't have to be a bridge to be added to a bridge, right? |
You're right, however, This definition seems to only include (1) physical interfaces like Wi-Fi and Ethernet, attachable adapters (e.g. USB to Ethernet) and (2) virtual interfaces created from the Apple's UI or using networking APIs (e.g. VPN connection). |
Unfortunately, there's nothing we can do in the current state of things to resolve your issue. Consider using a VPN solution with Network Extension support, for example, WireGuard. |
Yup, makes sense. Thanks for all the debugging, I hope this is going to help others, too. |
I have a setup on a Mac mini M1 which is connected to the Internet via LAN (
en0
) and to a VPN interface (utun0
resp.bridge100
). I am trying to set up networking without the NAT workaround mentioned here.The latter is not an option, since I permanently need access via SSH to the VM for monitoring purposes.
How do I need to run the VM to have it connect to both networks as well as make sure I can access it from the host?
The text was updated successfully, but these errors were encountered: