From 5d9e10b57cb930c09192c1f3c016c356865b29be Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Mon, 20 Jan 2025 15:33:05 +0400 Subject: [PATCH 1/6] docs(FAQ): document unsupported DHCP client identifiers --- docs/faq.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/docs/faq.md b/docs/faq.md index 8c5d616f..28341b2e 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -77,6 +77,37 @@ sudo rm /var/db/dhcpd_leases And no worries, this file will be re-created on the next `tart run`. +## Unsupported DHCP client identifiers + +Due to the limitations of the macOS built-in DHCP server, `tart ip` is unable to correctly report the IP addresses for VMs using DHCP client identifiers that are not based on VMs link-layer addresses (MAC addresses). + +One notorious example of this is Ubuntu, using [DUID-EN](https://metebalci.com/blog/a-note-on-dhcpv6-duid-and-prefix-delegation#duid-types) identifier by default on new versions, which results in the `/var/db/dhcpd_leases` entry for Ubuntu appearing as follows: + +```ini +{ + name=ubuntu + ip_address=192.168.64.14 + hw_address=ff,f1:f5:dd:7f:0:2:0:0:ab:11:cb:fb:30:b0:97:b6:3a:67 + identifier=ff,f1:f5:dd:7f:0:2:0:0:ab:11:cb:fb:30:b0:97:b6:3a:67 + lease=0x678e2ce7 +} +``` + +Because the macOS built-in DHCP server overwrites the `hw_address` with the `identifier`, it leaves no information about the VM's MAC address to the `tart ip`, which relies on this file to determine the IP address associated with the VM's MAC address. + +To avoid this issue, make sure that your VM only sends a DHCP client identifier (option 61) with link-layer address (MAC address) or that it doesn't send this option at all. + +For the aforementioned Ubuntu, the solution is outlined in the section [How to integrate with Windows DHCP Server](https://netplan.readthedocs.io/en/stable/examples/#how-to-integrate-with-windows-dhcp-server) of Canonical Netplan's documentation: + +```yaml +network: + version: 2 + ethernets: + enp3s0: + dhcp4: yes + dhcp-identifier: mac +``` + ## Running login/clone/pull/push commands over SSH When invoking the Tart in an SSH session, you might get error like this: From 98ba3675c006e542aca1b4218afbe867d8d40697 Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Mon, 20 Jan 2025 16:20:45 +0400 Subject: [PATCH 2/6] New section "Resolving the VMs IP with bridged networking" And a more clearer explanation of what "tart ip" does. --- docs/faq.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/faq.md b/docs/faq.md index 28341b2e..7730e7d3 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -81,19 +81,21 @@ And no worries, this file will be re-created on the next `tart run`. Due to the limitations of the macOS built-in DHCP server, `tart ip` is unable to correctly report the IP addresses for VMs using DHCP client identifiers that are not based on VMs link-layer addresses (MAC addresses). -One notorious example of this is Ubuntu, using [DUID-EN](https://metebalci.com/blog/a-note-on-dhcpv6-duid-and-prefix-delegation#duid-types) identifier by default on new versions, which results in the `/var/db/dhcpd_leases` entry for Ubuntu appearing as follows: +By default, when [no ` --resolver=arp` is specified](#resolving-the-vms-ip-with-bridged-networking), `tart ip` reads the `/var/db/dhcpd_leases` file and tries to find the freshest entry that matches the VM's MAC address (based on the `hw_address` field). + +However, things starts to break when the VM uses a [DUID-EN](https://metebalci.com/blog/a-note-on-dhcpv6-duid-and-prefix-delegation#duid-types) identifier, for example. One of the notorious examples of this being Ubuntu, using this type of identifier by default on latest versions. This results in the `/var/db/dhcpd_leases` entry for Ubuntu appearing as follows: ```ini { name=ubuntu - ip_address=192.168.64.14 + ip_address=192.168.64.3 hw_address=ff,f1:f5:dd:7f:0:2:0:0:ab:11:cb:fb:30:b0:97:b6:3a:67 identifier=ff,f1:f5:dd:7f:0:2:0:0:ab:11:cb:fb:30:b0:97:b6:3a:67 lease=0x678e2ce7 } ``` -Because the macOS built-in DHCP server overwrites the `hw_address` with the `identifier`, it leaves no information about the VM's MAC address to the `tart ip`, which relies on this file to determine the IP address associated with the VM's MAC address. +Because the macOS built-in DHCP server overwrites the `hw_address` with the `identifier`, it leaves no information about the VM's MAC address to the `tart ip`. To avoid this issue, make sure that your VM only sends a DHCP client identifier (option 61) with link-layer address (MAC address) or that it doesn't send this option at all. @@ -108,6 +110,16 @@ network: dhcp-identifier: mac ``` +## Resolving the VMs IP with bridged networking + +When running `tart run` with `--net-bridged`, you need to invoke `tart ip` differently, because the macOS built-in DHCP server won't have any information about the VM's IP-address: + +```shell +tart ip --resolver=arp +``` + +This causes the `tart ip` to consult the host's ARP table instead of the `/var/db/dhcpd_leases` file. + ## Running login/clone/pull/push commands over SSH When invoking the Tart in an SSH session, you might get error like this: From b7d1a40f1e940c620b9fdce0bee6853a816860ec Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Mon, 20 Jan 2025 16:22:08 +0400 Subject: [PATCH 3/6] Remove extraneous space in ` --resolver=arp` --- docs/faq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/faq.md b/docs/faq.md index 7730e7d3..e0a9b917 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -81,7 +81,7 @@ And no worries, this file will be re-created on the next `tart run`. Due to the limitations of the macOS built-in DHCP server, `tart ip` is unable to correctly report the IP addresses for VMs using DHCP client identifiers that are not based on VMs link-layer addresses (MAC addresses). -By default, when [no ` --resolver=arp` is specified](#resolving-the-vms-ip-with-bridged-networking), `tart ip` reads the `/var/db/dhcpd_leases` file and tries to find the freshest entry that matches the VM's MAC address (based on the `hw_address` field). +By default, when [no `--resolver=arp` is specified](#resolving-the-vms-ip-with-bridged-networking), `tart ip` reads the `/var/db/dhcpd_leases` file and tries to find the freshest entry that matches the VM's MAC address (based on the `hw_address` field). However, things starts to break when the VM uses a [DUID-EN](https://metebalci.com/blog/a-note-on-dhcpv6-duid-and-prefix-delegation#duid-types) identifier, for example. One of the notorious examples of this being Ubuntu, using this type of identifier by default on latest versions. This results in the `/var/db/dhcpd_leases` entry for Ubuntu appearing as follows: From 3cad4a54d784e07138d18b80645b20f1807863de Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Mon, 20 Jan 2025 16:30:17 +0400 Subject: [PATCH 4/6] Better section name --- docs/faq.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/faq.md b/docs/faq.md index e0a9b917..d855538c 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -81,7 +81,7 @@ And no worries, this file will be re-created on the next `tart run`. Due to the limitations of the macOS built-in DHCP server, `tart ip` is unable to correctly report the IP addresses for VMs using DHCP client identifiers that are not based on VMs link-layer addresses (MAC addresses). -By default, when [no `--resolver=arp` is specified](#resolving-the-vms-ip-with-bridged-networking), `tart ip` reads the `/var/db/dhcpd_leases` file and tries to find the freshest entry that matches the VM's MAC address (based on the `hw_address` field). +By default, when [no `--resolver=arp` is specified](#resolving-the-vms-ip-when-using-bridged-networking), `tart ip` reads the `/var/db/dhcpd_leases` file and tries to find the freshest entry that matches the VM's MAC address (based on the `hw_address` field). However, things starts to break when the VM uses a [DUID-EN](https://metebalci.com/blog/a-note-on-dhcpv6-duid-and-prefix-delegation#duid-types) identifier, for example. One of the notorious examples of this being Ubuntu, using this type of identifier by default on latest versions. This results in the `/var/db/dhcpd_leases` entry for Ubuntu appearing as follows: @@ -110,7 +110,7 @@ network: dhcp-identifier: mac ``` -## Resolving the VMs IP with bridged networking +## Resolving the VM's IP when using bridged networking When running `tart run` with `--net-bridged`, you need to invoke `tart ip` differently, because the macOS built-in DHCP server won't have any information about the VM's IP-address: From c21cebfb2d029e6ab45b244e82b87d3935d797b2 Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Mon, 20 Jan 2025 17:12:21 +0400 Subject: [PATCH 5/6] Add a note about Linux talkativeness --- docs/faq.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/faq.md b/docs/faq.md index d855538c..e6dc9c42 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -120,6 +120,12 @@ tart ip --resolver=arp This causes the `tart ip` to consult the host's ARP table instead of the `/var/db/dhcpd_leases` file. +Note that this method of resolving the IP heavily relies on the level of VM's talkativeness on the network. This is normally not an issue for macOS VMs, but on Linux VMs you might need to install Samba, which includes a [NetBIOS name server](https://www.samba.org/samba/docs/current/man-html/nmbd.8.html) that exhibits the same behavior as macOS and populates the ARP table of the host OS: + +```shell +sudo apt-get install samba +``` + ## Running login/clone/pull/push commands over SSH When invoking the Tart in an SSH session, you might get error like this: From 2e52d9547fc1d7e65770291499b27dd93e57ab59 Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Mon, 20 Jan 2025 17:27:24 +0400 Subject: [PATCH 6/6] Explain "talkativeness" a bit better --- docs/faq.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/faq.md b/docs/faq.md index e6dc9c42..b502d796 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -120,7 +120,9 @@ tart ip --resolver=arp This causes the `tart ip` to consult the host's ARP table instead of the `/var/db/dhcpd_leases` file. -Note that this method of resolving the IP heavily relies on the level of VM's talkativeness on the network. This is normally not an issue for macOS VMs, but on Linux VMs you might need to install Samba, which includes a [NetBIOS name server](https://www.samba.org/samba/docs/current/man-html/nmbd.8.html) that exhibits the same behavior as macOS and populates the ARP table of the host OS: +Note that this method of resolving the IP heavily relies on the level of VM's activity on the network, namely, exchanging ARP requests between the guest and the host. + +This is normally not an issue for macOS VMs, but on Linux VMs you might need to install Samba, which includes a [NetBIOS name server](https://www.samba.org/samba/docs/current/man-html/nmbd.8.html) and exhibits the same behavior as macOS, resulting in the population of the ARP table of the host OS: ```shell sudo apt-get install samba