From nobody Wed Nov 15 11:55:44 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 4SVhSj2Mx0z51SKX for ; Wed, 15 Nov 2023 11:55:49 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from ms-10.1blu.de (ms-10.1blu.de [178.254.4.101]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4SVhSh1sJQz4Xts for ; Wed, 15 Nov 2023 11:55:48 +0000 (UTC) (envelope-from guru@unixarea.de) Authentication-Results: mx1.freebsd.org; none Received: from [212.222.85.114] (helo=c720-1400094.unixarea.de) by ms-10.1blu.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1r3EUk-004Iff-2N; Wed, 15 Nov 2023 12:55:46 +0100 Received: from c720-1400094 (localhost [127.0.0.1]) by c720-1400094.unixarea.de (8.17.1/8.14.9) with ESMTP id 3AFBtjWx002204; Wed, 15 Nov 2023 12:55:45 +0100 (CET) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by c720-1400094 (8.17.1/8.14.9/Submit) id 3AFBtiNt002203; Wed, 15 Nov 2023 12:55:44 +0100 (CET) (envelope-from guru@unixarea.de) X-Authentication-Warning: c720-1400094: guru set sender to guru@unixarea.de using -f Date: Wed, 15 Nov 2023 12:55:44 +0100 From: Matthias Apitz To: Odhiambo Washington Cc: questions@freebsd.org, Arthur Chance , Alexander Burke Subject: Re: USB tethering between FreeBSD and mobile phone (Debian OS) Message-ID: Reply-To: Matthias Apitz References: <65b7ecef-b189-4350-a246-3cab934151fd@alexburke.ca> <091f7b66-ce45-4cf4-a4a9-6cd1de66c09b@qeng-ho.org> 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Operating-System: FreeBSD 14.0-CURRENT r1400094 (amd64) X-message-flag: Mails containing HTML will not be read! Please send only plain text. X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 212.222.85.114 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:42730, ipnet:178.254.0.0/19, country:DE] X-Rspamd-Queue-Id: 4SVhSh1sJQz4Xts El día miércoles, noviembre 15, 2023 a las 02:19:23p. m. +0300, Odhiambo Washington escribió: > On Wed, Nov 15, 2023 at 8:44 AM Matthias Apitz wrote: > > > > > 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; > > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > Whose IP is 10.5.5.1 ?? The phone or the FreeBSD box? > If the phone is getting an IP address from the DHCP server running on the > FreeBSD, that IP address is bound to change unless assigned statically by a > DHCP reservation! As I said: this config is just one of the examples in the file dhcp.conf. I picked this up to get an addr pair in the range 10.5.5.26 10.5.5.30. With this the FreeBSD gets assigned (static) 10.5.5.26 and the phone 10.5.5.27: FreeBSD: $ ifconfig ue0 ue0: flags=1008843 metric 0 mtu 1500 options=80000 ether 3e:07:40:6d:13:91 inet 10.5.5.26 netmask 0xffffffe0 broadcast 10.5.5.31 inet6 fe80::3c07:40ff:fe6d:1391%ue0 prefixlen 64 scopeid 0x3 media: Ethernet autoselect status: active nd6 options=23 $ netstat -rn Routing tables Internet: Destination Gateway Flags Netif Expire default 10.49.211.1 UGS wlan0 10.5.5.0/27 link#3 U ue0 10.5.5.26 link#1 UHS lo0 10.49.211.0/24 link#2 U wlan0 10.49.211.252 link#1 UHS lo0 127.0.0.1 link#1 UH lo0 the value for ue0 comes from the devd script: /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 phone: purism@pureos:~$ ifconfig usb0 usb0: flags=4163 mtu 1500 inet 10.5.5.27 netmask 255.255.255.224 broadcast 10.5.5.31 inet6 fe80::4d93:bdb7:ac4b:698 prefixlen 64 scopeid 0x20 ether 96:06:ad:58:63:9d txqueuelen 1000 (Ethernet) RX packets 1810569 bytes 112088858 (106.8 MiB) RX errors 72 dropped 0 overruns 0 frame 0 TX packets 556250 bytes 7353668068 (6.8 GiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 purism@pureos:~$ netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 10.5.5.1 0.0.0.0 UG 0 0 0 usb0 0.0.0.0 10.49.211.1 0.0.0.0 UG 0 0 0 wlan0 0.0.0.0 10.158.237.201 0.0.0.0 UG 0 0 0 wwan0 10.5.5.0 0.0.0.0 255.255.255.224 U 0 0 0 usb0 10.49.211.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0 10.158.237.192 0.0.0.0 255.255.255.240 U 0 0 0 wwan0 > This config is so in reverse that I fail to understand it. > Is this intended for the FreeBSD box to access the Internet?? No, the FreeBSD has access to Internet via wlan0. This config is just to allow SSH between the phone and FreeBSD. And the phone has access to Internet through its wwan0 (data mobile). matthias -- 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.