Date: Wed, 15 Nov 2023 07:14:53 +0100 (GMT+01:00) From: Alexander Burke <alex@alexburke.ca> To: questions@freebsd.org Cc: Matthias Apitz <guru@unixarea.de> Subject: Re: USB tethering between FreeBSD and mobile phone (Debian OS) Message-ID: <a81ca97b-018c-4591-a37d-371e366f3ab6@alexburke.ca> In-Reply-To: <ZVRavIq94cFxdAV4@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> <ZVRavIq94cFxdAV4@c720-1400094.fritz.box>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <guru@unixarea.de>: >=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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a81ca97b-018c-4591-a37d-371e366f3ab6>