0

A Raspberry Pi 3B+ is configured

  • with Raspbian
  • with a working wifi: pinned to a static LAN IP address

Per the procedure: a static IP 192.168.42.42 assigned to the rPi's USB0 interface. Append:

iface usb0 inet static
address 192.168.42.42
netmask 255.255.255.0
network 192.168.42.0
broadcast 192.168.42.255

to the file:

sudo nano /etc/network/interfaces

then save and exit (ctrl-X, Y).

After reboot, the rPi is not connected to wifi. ifconfig does not return a a wifi interface. The wifi's MAC address is pinned to a LAN IP address via DHCP Reservation: pinging the LAN IP does not return a reply.

ifconfig returns only lo: 127.0.0.1(loopback)

QUESTIONS

  1. What is the procedure & command to test that USB0 is successfully assigned 192.168.42.42?
  2. Is it not possible to have wifi configured with DHCP and USB0 configured with a static LAN IP simultaneously?
  3. Why did configuring USB0 with a static IP remove the wifi interface? How to enable both static usb0 and DHCP wifi?

Observation: I commented-out the static IP assignments and rebooting the rPi => wifi restored.

Although I would like to eventually be able to perform the exercise with Apple devices, I intend to start with Android phones to display rPi output.

UPDATES

cat /etc/network/interfaces

Returns:

# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
#  
#iface usb0 inet static
#address 192.168.42.42
#netmask 255.255.255.0
#network 192.168.42.0
#broadcast 192.168.42.25#
5
  • 1
    You probably just failed to turn USB tethering on on your phone. But I think that you should take it with the author of that tutorial. It looks quite absurd to me to a) assign a static address while a tethering android phone acts like a dhcp server and your rp will probably handle it just fine without you having to edit anything b) reboot just to add a hotplugging network interface or change its address, what is that? win3.1 for workgroups? c) assume that the hotplugged interface will be called usb0 and not eg. usb1 or enp0s18f2u4u2u4.
    – mosvy
    Dec 1, 2019 at 4:52
  • 1
    But anyways, 1. ip addr show usb0 will tell you all the addresses assigned to the usb0 interface. 2 any combo of dhcp and static addresses on separate or the same interfaces is supported in Linux.
    – mosvy
    Dec 1, 2019 at 4:52
  • USB tethering was NOT successfully turned on: with this insight it would seem that this problem should be solved first
    – gatorback
    Dec 1, 2019 at 5:15
  • I was wondering about the phone's DHCP server and assigning a static IP to USB0. If the phone's DHCP gateway 192.168.X.1, then it may be best to assign a static IP of 192.168.X.200?
    – gatorback
    Dec 1, 2019 at 5:25
  • yes, the static address should be on the same network as the dhcp server, otherwise your phone will ignore it. For your 3. point, I don't have a rp at hand, but wasn't there a comment in /etc/network/interfaces about how that file is not supposed to be used for static conf anymore?
    – mosvy
    Dec 1, 2019 at 17:23

1 Answer 1

1

The easiest way to test if the assignment is okay is to connect your tethered device, and run:

ip addr show

Your usb0 interface should show up with the indicated address.

If the usb0 interface does not show up at all, you haven't properly connected the device, or you haven't succesfully enabled USB tethering.

And yes, it is entirely possible to have WiFi configured with DHCP and usb0 configured with a static IP address at the same time.

2
  • Thanks for responding to my questions. Do you have insight to the new third question regarding why the wifi was shutdown and how to restore it?
    – gatorback
    Dec 1, 2019 at 16:02
  • The third question was added in your edit after I answered. I would suggest opening seperate questions on here, instead of just adding new questions to existing questions after the fact. The reason you WiFi disappeared is probably either (a) you edited the configuration file wrongly, now making no interfaces available from that file, or (b) the WiFi interface is not automatically enabled, and now that you have rebooted, you have to manually enable it again.
    – jksoegaard
    Dec 1, 2019 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.