Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Nov 2023 06:44:28 +0100
From:      Matthias Apitz <guru@unixarea.de>
To:        questions@freebsd.org
Cc:        Arthur Chance <freebsd@qeng-ho.org>, Alexander Burke <alex@alexburke.ca>
Subject:   Re: USB tethering between FreeBSD and mobile phone (Debian OS)
Message-ID:  <ZVRavIq94cFxdAV4@c720-1400094.fritz.box>
In-Reply-To: <ZVOm1vDEYf9HUril@c720-1400094.fritz.box>
References:  <ZVMO/8ord7UwUxnz@pureos> <65b7ecef-b189-4350-a246-3cab934151fd@alexburke.ca> <091f7b66-ce45-4cf4-a4a9-6cd1de66c09b@qeng-ho.org> <ZVOm1vDEYf9HUril@c720-1400094.fritz.box>

next in thread | previous in thread | raw e-mail | index | archive | help

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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ZVRavIq94cFxdAV4>