From nobody Wed Nov 15 06:14:53 2023 X-Original-To: questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SVXvf6DMBz510DZ for ; Wed, 15 Nov 2023 06:15:10 +0000 (UTC) (envelope-from alex@alexburke.ca) Received: from out-176.mta1.migadu.com (out-176.mta1.migadu.com [IPv6:2001:41d0:203:375::b0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4SVXvf434Bz3Ds9 for ; Wed, 15 Nov 2023 06:15:10 +0000 (UTC) (envelope-from alex@alexburke.ca) Authentication-Results: mx1.freebsd.org; none Date: Wed, 15 Nov 2023 07:14:53 +0100 (GMT+01:00) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alexburke.ca; s=key1; t=1700028901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2hVDuxwNdcvqjI8SUInZJ0SnR8tUHzzYuwamcD8LRn8=; b=hQLuV71B6qp3i2gWh8PszTPkCcy+gcz5ePD2NrYh0pZRhlGBhqthx7mxo3QAB2ONYQ40SJ fLZMj5jnt15GCyy8mSudVzabnRlphDKk1Yvx3Au7+hK7cRUW/3wG+iIxSeUsCXUNxWOGd2 rBLq/ENgyjWr/y8tzAILF4Xnp2AS1LA= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Alexander Burke To: questions@freebsd.org Cc: Matthias Apitz Message-ID: In-Reply-To: References: <65b7ecef-b189-4350-a246-3cab934151fd@alexburke.ca> <091f7b66-ce45-4cf4-a4a9-6cd1de66c09b@qeng-ho.org> Subject: Re: USB tethering between FreeBSD and mobile phone (Debian OS) List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Correlation-ID: X-Migadu-Flow: FLOW_OUT X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:16276, ipnet:2001:41d0::/32, country:FR] X-Rspamd-Queue-Id: 4SVXvf434Bz3Ds9 Hi Matthias (and anyone who comes across this later), The DHCP server should be run on the device capable of acting as an interne= t gateway (in this case, the phone) or else the setup is backwards from eve= ry 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 explain= ed. 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 : >=20 > Just to end this thread: >=20 >=20 > How to tether the mobile phone Purism Librem 5 with FreeBSD > guru@unixarea.de, November 2023 >=20 > The Purism Librem 5 (L5) runs PureOS, a Debian variant, but no DHCP serve= r. > 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. >=20 > Build and install the port net/isc-dhcp44-server. >=20 > We just use one of the existing example configuration from > /usr/local/etc/dhcpd.conf: >=20 > ... > # A slightly different configuration for an internal subnet. > subnet 10.5.5.0 netmask 255.255.255.224 { > =C2=A0 range 10.5.5.26 10.5.5.30; > =C2=A0 option domain-name-servers ns1.internal.example.org; > =C2=A0 option domain-name "internal.example.org"; > =C2=A0 option routers 10.5.5.1; > =C2=A0 option broadcast-address 10.5.5.31; > =C2=A0 default-lease-time 600; > =C2=A0 max-lease-time 7200; > } > ... >=20 > Lines for /etc/rc.conf: >=20 > ifconfig_ue0=3D"inet 10.5.5.26 netmask 255.255.255.224" > dhcpd_enable=3D"YES" > dhcpd_ifaces=3D"ue0" >=20 > And at the end we let devd(8) do its job when the USB-C connection is mad= e > with this configuration: >=20 > /usr/local/etc/devd/l5.conf: >=20 > notify 1 { > =C2=A0=C2=A0=C2=A0 match "system"=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 "IFNET"; > =C2=A0=C2=A0=C2=A0 match "subsystem"=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = "ue0"; > =C2=A0=C2=A0=C2=A0 match "type"=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 "ATTACH"; > =C2=A0=C2=A0=C2=A0 action "/usr/local/etc/devd/l5.sh"; > }; >=20 > /usr/local/etc/devd/l5.sh: >=20 > #!/bin/sh > # > ifconfig ue0 inet 10.5.5.26 netmask 255.255.255.224 > /usr/local/etc/rc.d/isc-dhcpd restart >=20 >=20 >=20 > Now you can run from the laptop >=20 > ssh purism@10.5.5.27 >=20 > and from there back: >=20 > ssh guru@10.5.5.26 >=20 >=20 >=20 > --=20 > Matthias Apitz, =E2=9C=89 guru@unixarea.de, http://www.unixarea.de/ +49-1= 76-38902045 > Public GnuPG key: http://www.unixarea.de/key.pub >=20 > I am not at war with Russia. > =D0=AF =D0=BD=D0=B5 =D0=B2=D0=BE=D1=8E=D1=8E =D1=81 =D0=A0=D0=BE=D1=81=D1= =81=D0=B8=D0=B5=D0=B9. > Ich bin nicht im Krieg mit Russland.