Re: USB tethering between FreeBSD and mobile phone (Debian OS)

From: Alexander Burke <alex_at_alexburke.ca>
Date: Tue, 14 Nov 2023 17:40:17 UTC
Hi again Matthias,

When tethering a laptop to a mobile phone, the phone is generally the 
DHCP server and the laptop is the DHCP client.

Is there a specific reason you want to run it the other way around, or 
have I misunderstood something?

You said there is indeed a DHCP server running on the phone; have you 
tried what I suggested?

Cheers,
Alex


On 2023-11-14 17:56, Matthias Apitz wrote:
> El día martes, noviembre 14, 2023 a las 11:20:05a. m. -0100, Arthur Chance escribió:
> 
>> On 14/11/2023 08:27, Alexander Burke wrote:
>>> Hi Mathias,
>>>
>>> I added a single line in `/etc/rc.conf` to take care of this
>>> automagically when I need to tether via USB to my Pixel running
>>> GrapheneOS (which also produces a `ue0` interface on the FreeBSD side):
>>>
>>> ifconfig_ue0="up SYNCDHCP"
>>>
>>> IIRC, I found this solution here:
>>> https://forums.freebsd.org/threads/wireless-setup-and-syncdhcp.41488/
>>>
>>> I'm usually not tethering so it thus causes a slight delay at boot
>>> because the interface isn't up at that point and boot is paused until
>>> this times out, but it causes `dhclient` to remain running and fetch an
>>> address whenever it does come up.
>>>
>>> It's possible this isn't the best way to do it; perhaps others can chime
>>> in to improve further on this implementation.
>>
>> I've never used tethering so this is just a suggestion, but isn't this
>> the sort of thing that ought to be handled by devfs with a conf file in
>> /etc/devd. Have a rule that notices when ue0 attaches (and possibly on
>> detaching as well) and Do The Right Thing at that point.
> 
> I've checked the log file on the mobile phone in /var/log/syslog. The
> phone's NetworkManager sees the carrier on usb0 and waits 45 secs for
> DHCP requests being fulfilled. This way it works also fine with the
> MacBook as laptop. There is running some DHCP server on interface en7
> and the mobile gets it IP addr from it.
> 
> I will start my poudriere oven to compile the port net/isc-dhcp44-server.
> 
> 	matthias
>