Re: USB tethering between FreeBSD and mobile phone (Debian OS)
Date: Wed, 15 Nov 2023 06:14:53 UTC
Hi Matthias (and anyone who comes across this later), The DHCP server should be run on the device capable of acting as an internet gateway (in this case, the phone) or else the setup is backwards from every setup I've come across in 25 years in IT. (In fact, your phone probably already had dhcpd installed for exactly that reason.) As an added benefit, nothing needs to be built or installed on the FreeBSD side, and one line needs to be added to /etc/rc.conf, as previously explained. Why swim against the current and make things more complex than they need to be? Cheers, Alex ---------------------------------------- Nov 15, 2023 06:44:34 Matthias Apitz <guru@unixarea.de>: > > Just to end this thread: > > > How to tether the mobile phone Purism Librem 5 with FreeBSD > guru@unixarea.de, November 2023 > > The Purism Librem 5 (L5) runs PureOS, a Debian variant, but no DHCP server. > When an USB-C cable connection between the laptop and the L5 is made, the > NetworkManager in the L5 sees the carrier in the network interface 'usb0' > and launches a DHCP client on the interface. All we have to do, or what > can be done, is launching a DHCP server on the interface 'ue0'. Here is > it's configuration. > > Build and install the port net/isc-dhcp44-server. > > We just use one of the existing example configuration from > /usr/local/etc/dhcpd.conf: > > ... > # A slightly different configuration for an internal subnet. > subnet 10.5.5.0 netmask 255.255.255.224 { > range 10.5.5.26 10.5.5.30; > option domain-name-servers ns1.internal.example.org; > option domain-name "internal.example.org"; > option routers 10.5.5.1; > option broadcast-address 10.5.5.31; > default-lease-time 600; > max-lease-time 7200; > } > ... > > Lines for /etc/rc.conf: > > ifconfig_ue0="inet 10.5.5.26 netmask 255.255.255.224" > dhcpd_enable="YES" > dhcpd_ifaces="ue0" > > And at the end we let devd(8) do its job when the USB-C connection is made > with this configuration: > > /usr/local/etc/devd/l5.conf: > > notify 1 { > match "system" "IFNET"; > match "subsystem" "ue0"; > match "type" "ATTACH"; > action "/usr/local/etc/devd/l5.sh"; > }; > > /usr/local/etc/devd/l5.sh: > > #!/bin/sh > # > ifconfig ue0 inet 10.5.5.26 netmask 255.255.255.224 > /usr/local/etc/rc.d/isc-dhcpd restart > > > > Now you can run from the laptop > > ssh purism@10.5.5.27 > > and from there back: > > ssh guru@10.5.5.26 > > > > -- > Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 > Public GnuPG key: http://www.unixarea.de/key.pub > > I am not at war with Russia. > Я не воюю с Россией. > Ich bin nicht im Krieg mit Russland.