-
Notifications
You must be signed in to change notification settings - Fork 294
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
Pick a working network interface for the bridged rd0
vmnet interface
#1125
Comments
My recommendation would be to use Lima already has the same restriction that proxy settings will not be auto-detected on older macOS version for exactly the same reason (it also uses |
Note that So maybe we also need to support the case when the host is offline and cannot create a bridged interface. In that case we should not specify the flannel interface, so Alternatively we could switch to a "shared" network, but this is more tricky because we would want to switch back to "bridged" when a network is available again, but not if the switch to "shared" was done by the user and not RD. So maybe let's not go there yet. |
To avoid getting a $ system_profiler SPNetworkDataType -json | jq -r '.SPNetworkDataType[] | select(.interface) | .interface'
en0
en1
en4
bridge0 we should add these networks in networks:
bridged_en0:
mode: bridged
interface: en0
bridged_en1:
mode: bridged
interface: en1
bridged_en4:
mode: bridged
interface: en4
bridged_bridge0:
mode: bridged
interface: bridge0 Then when we detect that networks:
- lima: bridged_en1
interface: rd0 This way the sudoers file only needs to be updated when the list of network devices changes. If we don't find any active device, we omit the |
I've changed the service order to move Wi-Fi ahead of Ethernet, and the $ system_profiler SPNetworkDataType -json | jq -r '.SPNetworkDataType[] | select(.interface) | @text "\(._name):\(.interface)"'
Wi-Fi:en1
Ethernet:en0
Bluetooth PAN:en4
Thunderbolt Bridge:bridge0 |
On my machine I need to use
It works when I manually edit the |
@manno Yes, but do the earlier entries have an IP address. I suggested this check to determine the interface to use:
However, using |
That works and returns only en8, which is the only one with an IP. (Wifi is off). |
Oddly, for me both en8 (wired ethernet) and en0 (Wifi) are DHCP clients with addresses, but I can't get DHCP acks over Wifi. I assume something odd is going on in my local network. At least en8 is also the preferred interface, so things will work given the direction we're currently going. |
Just for the record, one user on Slack could not get a DHCP address on I wonder if e.g. their Wifi setup does not allow multiple MAC addresses on a single radio (not really sure how this works). Or if the MAC addresses need to be on some kind of allow-list. |
The host interface is specified in
~/Library/Application\ Support/rancher-desktop/lima/_config/networks.yaml
:This must be set before the sudoers file is created:
So the default configuration only works if
en0
is connected to a network that provides a DHCP server.Some suggestions to find the network automatically:
Using
networksetup
This will work on older macOS versions like Mojave, but requires parsing plain text output:
This provides all network services in priority order, and the device name.
Then query each device in turn:
This shows that
en0
has no IP address, and thaten1
should be configured for the bridged network.Using
system_profiler SPNetworkDataType -json
The
-json
option is only supported on macOS Catalina and later. It is possible to parse the regular output, but feels rather brittle.I don't see this documented, but it looks like the network devices are also returned in priority order:
This means we could select the device to use like this:
Roaming
This is out-of-scope for this issue, but I wanted to mention that we'll eventually have to deal with roaming too: A laptop can travel to different networks, so the bridged network address may change. Ethernet may be plugged in and Wi-Fi disconnected. Rancher Desktop should detect these situations and prompt the user to restart the VM to adapt.
The text was updated successfully, but these errors were encountered: