Description
Current implementation only acts as DHCP server. Need adaptive behavior to support macOS Internet Sharing where the host becomes the DHCP server.
Problem
When macOS Internet Sharing is enabled, macOS acts as DHCP server (typically 192.168.2.x range). The device needs to detect this and act as DHCP client instead of server.
Requirements
- Try DHCP client first (5 second timeout)
- If no DHCP server found, become DHCP server
- Support macOS Internet Sharing (192.168.2.x range)
- Maintain compatibility with direct connections
Proposed systemd-networkd Configuration
[Network]
DHCP=yes
LinkLocalAddressing=yes
Address=192.168.7.1/24
DHCPServer=yes
ConfigureWithoutCarrier=yes
[DHCP]
UseDNS=yes
UseRoutes=yes
RequestTimeout=5
[DHCPServer]
PoolOffset=100
PoolSize=20
Alternative Approach
Create a script that:
- Attempts DHCP client with timeout
- Checks if lease obtained
- If yes: Acts as client
- If no: Configures static IP and starts DHCP server
Use Cases
- Direct connection: Device provides DHCP (192.168.7.x)
- macOS Internet Sharing OFF: Device provides DHCP
- macOS Internet Sharing ON: Device gets IP from macOS, has internet access
Acceptance Criteria
Description
Current implementation only acts as DHCP server. Need adaptive behavior to support macOS Internet Sharing where the host becomes the DHCP server.
Problem
When macOS Internet Sharing is enabled, macOS acts as DHCP server (typically 192.168.2.x range). The device needs to detect this and act as DHCP client instead of server.
Requirements
Proposed systemd-networkd Configuration
Alternative Approach
Create a script that:
Use Cases
Acceptance Criteria