Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Nov 2023 07:09:03 +0100
From:      Matthias Apitz <guru@unixarea.de>
To:        freebsd-questions@freebsd.org
Subject:   USB tethering between FreeBSD and mobile phone (Debian OS)
Message-ID:  <ZVMO/8ord7UwUxnz@pureos>

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

Hello,

When I connect my Debian mobile phone Purism L5 to my beloved FreeBSD
laptop with an USB-C cable, on both ends exists (L5: usb0) or come
up (FreeBSD: ue0) a network interface:

mobile phone:

ifconfig usb0
usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 96:06:ad:58:63:9d  txqueuelen 1000  (Ethernet)
        RX packets 448488  bytes 31739673 (30.2 MiB)
        RX errors 6  dropped 0  overruns 0  frame 0
        TX packets 306592  bytes 3677180864 (3.4 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

FreeBSD 14.0-CURRENT:

ifconfig ue0
ue0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
	options=80000<LINKSTATE>
	ether 3e:07:40:6d:13:91
	inet6 fe80::3c07:40ff:fe6d:1391%ue0 prefixlen 64 scopeid 0x3
	media: Ethernet autoselect
	status: active
	nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>

but nothing else happens in the sense of DHCP; a dhcpclient seems to be
started on FreeBSD for this interface ue0.

I can use "ifconfig ue0 10.0.1.1" on FreeBSD and on the L5 "ifconfig 10.0.1.2"
and can run fine "ssh purism@10.0.1.2" from FreeBSD to the L5.

What could I do that the IP addrs get assigned automatically?

In the past I did the same with an Ubuntu mobile the IP addr was
assigned as 10.42.0.2 to FreeBSD and the phone has 10.42.0.1 which let
me think that the DHCP service came from the mobile.

When I do the same USB-C connection using my MacBook Pro, IP addresses
get assigned automatically as:

purism@pureos:~$ ifconfig usb0
usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.33.2  netmask 255.255.255.0  broadcast 192.168.33.255
        inet6 fe80::4d93:bdb7:ac4b:698  prefixlen 64  scopeid 0x20<link>
        ether 96:06:ad:58:63:9d  txqueuelen 1000  (Ethernet)
        RX packets 1799784  bytes 111111162 (105.9 MiB)
        RX errors 18  dropped 0  overruns 0  frame 0
        TX packets 548389  bytes 7352130824 (6.8 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

~ apitzm$ ifconfig en7
en7: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=404<VLAN_MTU,CHANNEL_IO>
	ether 3e:07:40:6d:13:91
	inet6 fe80::18de:caef:aa2d:3bd6%en7 prefixlen 64 secured scopeid 0x13
	inet 192.168.33.1 netmask 0xffffff00 broadcast 192.168.33.255
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect (100baseTX <full-duplex>)
	status: active

This is because in the MacOS some DHCP services is started with

   #!/bin/sh
   #
   # start the DHCP server in MacOS
   # see also:
   # https://www.swissns.ch/site/2014/05/running-mac-os-xs-built-in-dhcp-server/
   # config file: /etc/bootpd.plist
   #
   # guru@unixarea.de, March 2023

   # start:
   #
   sudo /bin/launchctl load -w /System/Library/LaunchDaemons/bootps.plist

-- 
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub



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