USB tethering: FreeBSD laptop with L5

Yes, NAT too:


I disconnected my laptop from any red and only used the USB-C
tethering to connect to Internet:

before tethering:

# ifconfig wlan0
wlan0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=0
	ether 90:48:9a:92:9e:43
	groups: wlan
	ssid "" channel 1 (2412 MHz 11b)
	regdomain 108 indoor ecm authmode OPEN privacy OFF txpower 20 bmiss 7
	scanvalid 60 wme burst bintval 0
	parent interface: ath0
	media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
	status: no carrier
	nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>

after tethering (IP addr to ue0 comes down via dhclient ue0):

# ifconfig -a
lo0: flags=1008049<UP,LOOPBACK,RUNNING,MULTICAST,LOWER_UP> metric 0 mtu 16384
	options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
	inet 127.0.0.1 netmask 0xff000000
	inet6 ::1 prefixlen 128
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
	groups: lo
	nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
wlan0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=0
	ether 90:48:9a:92:9e:43
	groups: wlan
	ssid "" channel 1 (2412 MHz 11b)
	regdomain 108 indoor ecm authmode OPEN privacy OFF txpower 20 bmiss 7
	scanvalid 60 wme burst bintval 0
	parent interface: ath0
	media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
	status: no carrier
	nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
ue0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
	options=80000<LINKSTATE>
	ether 3e:07:40:6d:13:91
	inet 10.42.0.18 netmask 0xffffff00 broadcast 10.42.0.255
	inet6 fe80::3c07:40ff:fe6d:1391%ue0 prefixlen 64 scopeid 0x3
	media: Ethernet autoselect
	status: active
	nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>

# netstat -rn

Routing tables in the laptop, default is the tethering link
to the L5:

Internet:
Destination        Gateway            Flags     Netif Expire
default            10.42.0.1          UGS         ue0
10.42.0.0/24       link#3             U           ue0
10.42.0.18         link#1             UHS         lo0
127.0.0.1          link#1             UH          lo0


SSH from the laptop to the L5 works fine:

$ ssh purism@10.41.0.1
Linux pureos 6.4.0-1-librem5 #1 SMP PREEMPT Fri Oct  6 00:42:44 UTC 2023 aarch64

You have mail.
Last login: Mon Nov 20 07:42:11 2023 from 10.42.0.18
inhibiting suspend ...
...
logout

DNS in the laptop:

$ cat /etc/resolv.conf

# Generated by resolvconf
nameserver 10.42.0.1

PING in the laptop to some Internet site:

$ ping www.muc.de
PING www.muc.de (193.149.48.8): 56 data bytes
64 bytes from 193.149.48.8: icmp_seq=0 ttl=56 time=29.705 ms
64 bytes from 193.149.48.8: icmp_seq=1 ttl=56 time=27.737 ms
64 bytes from 193.149.48.8: icmp_seq=2 ttl=56 time=31.455 ms
64 bytes from 193.149.48.8: icmp_seq=3 ttl=56 time=28.204 ms
...

running in the L5 a tcpdump for the above PING from the laptop
shows the NAT for the packages behind the wwan0 addr: 

tcpdump -n -i wwan0

17:53:39.269033 IP 10.137.136.208 > 193.149.48.8: ICMP echo request, id 13573, seq 78, length 64
17:53:39.361920 IP 193.149.48.8 > 10.137.136.208: ICMP echo reply, id 13573, seq 78, length 64
1 Like