question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pick a working network interface for the bridged `rd0` vmnet interface

See original GitHub issue

The host interface is specified in ~/Library/Application\ Support/rancher-desktop/lima/_config/networks.yaml:

networks:
  bridged:
    mode: bridged
    interface: en0

This must be set before the sudoers file is created:

$ grep en0 /etc/sudoers.d/rancher-desktop-lima
    /opt/rancher-desktop/bin/vde_vmnet --pidfile=/private/var/run/rancher-desktop-lima/bridged_vmnet.pid --vde-group=staff --vmnet-mode=bridged --vmnet-interface=en0 /private/var/run/rancher-desktop-lima/bridged.ctl, \

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:

$ networksetup -listnetworkserviceorder
An asterisk (*) denotes that a network service is disabled.
(1) Ethernet
(Hardware Port: Ethernet, Device: en0)

(2) Wi-Fi
(Hardware Port: Wi-Fi, Device: en1)

(3) Bluetooth PAN
(Hardware Port: Bluetooth PAN, Device: en4)
[...]

This provides all network services in priority order, and the device name.

Then query each device in turn:

$ networksetup -getinfo "Ethernet"
DHCP Configuration
Client ID:
IPv6: Automatic
IPv6 IP address: none
IPv6 Router: none
Ethernet Address: 38:c9:86:21:6d:c1
$ networksetup -getinfo "Wi-Fi"
DHCP Configuration
IP address: 192.168.17.21
Subnet mask: 255.255.0.0
Router: 192.168.17.1
Client ID:
IPv6: Automatic
IPv6 IP address: none
IPv6 Router: none
Wi-Fi ID: 28:f0:76:12:69:14

This shows that en0 has no IP address, and that en1 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:

$ system_profiler SPNetworkDataType -json | jq '.SPNetworkDataType[] | [._name, .interface, .ip_address]'
[
  "Ethernet",
  "en0",
  null
]
[
  "Wi-Fi",
  "en1",
  [
    "192.168.17.21"
  ]
]
[
  "Bluetooth PAN",
  "en4",
  null
]
...

This means we could select the device to use like this:

$ system_profiler SPNetworkDataType -json | jq -r 'first(.SPNetworkDataType[] | select(.ip_address) | .interface)'
en1

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.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
janduboiscommented, Dec 17, 2021

However system_profiler reports:

@manno Yes, but do the earlier entries have an IP address. I suggested this check to determine the interface to use:

system_profiler SPNetworkDataType -json | jq -r 'first(.SPNetworkDataType[] | select(.ip_address) | .interface)'

However, using route get default may be a better option indeed.

0reactions
janduboiscommented, Dec 17, 2021

Just for the record, one user on Slack could not get a DHCP address on en0, even though it was the active (and only) network connection they had. This happened on their office network, but not on their home network. We could not figure out what was causing this, and switched to a “shared” network to make RD useable for them.

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change VMnet0 Bridged Networking Settings - VMware Docs
Select the host network adapter from the Bridge to drop-down menu.
Read more >
How to Fix VMware Bridged Network on VMnet0 ... - YouTube
How to Fix a VMware Bridged Network on VMnet0 have no Internet Access! ... MikroTik(using VMware) - Setup: Interface, Address, DNS, Route, ...
Read more >
How to fix bridged networking in VMware player - YouTube
A quick tutorial on how to fix bridged networking in VMware player. You need to extract the vmnetcfg.exe utility from the VMware player ......
Read more >
Host Network Configuration - Fedora Docs
For an interactive install this allows the user to populate networking configuration in a variety of ways before doing the install: using the...
Read more >
vmware replicate physical network connection state
Select VMkernel Network Adapter as the connection … ... I noticed that, before I installed VM Tools, my bridged networking seemed to work...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found