1

I followed this guide to set up networking over systemd:

Use systemd-networkd for general networking

After rebooting I can't connect to my Raspi again using USB cable (with RNDIS). Also, I somehow screwed up my wifi credentials so the raspi doesn't connect to my router again... and to top it of, for some reason it doesn't help when I put a fresh wpa_supplicant.conf into the boot partition of the sd card.

I used Advanced IP scanner to test if the raspi is present within the network, but apparently it isn't. So it is fully secluded. Is there a way to connect to it again without reinstalling the operating system?

EDIT: Turns out I was on the wrong path all along. I put my wpa_supplicant credentials without quotation marks "". This would lead to the Raspi not connecting to the router as it should. For some reason Bonjour decided to resolve raspberry.local to route over the WLAN IP instead of the RNDIS direct connection. So naturally, when that option was not available anymore it just didn't work anymore.

This doesn't solve the issue though. I would still want to be able to connect over RNDIS, even more so because the LAN connection could break anytime. But how can I tell Bonjour then that raspberrypi.local should be looked up over the RNDIS ethernet interface? I would like to skip mDNS and directly assign the IP addresses of each interface (host and device), but I don't know how this is possible.

glades
  • 165
  • 1
  • 7
  • did you create an interface file for usb interface? that guide creates interface for wired connection - e* and wifi connection - wl* ... but the interface name will be usb0 which doesn't match those - at least, I think that's happening :p – Jaromanda X Jan 14 '21 at 23:16
  • Thank you @JaromandaX! I can remember to have set it up once without configuring a usb interface and it still worked for some time. Only now it doesn't anymore. I'm really confused. However, I suspect the removal of ahavi-daemon could have impaired the ability to find my raspi over RNDIS using just the hostname. I'm using Bonjour on my Windows PC. – glades Jan 15 '21 at 07:14
  • well, yeah, without avahi-daemon there will be no mDNS – Jaromanda X Jan 15 '21 at 08:54
  • What is RNDIS? Usually there is an ethernet cable used for network connections. How do you use an USB-cable for a network connection? What Raspberry Pi version do you use? Do you use USB-gadget mode? – Ingo Jan 16 '21 at 14:03
  • @JaromandaX It's not true don't having mDNS without avahi. Have a look at my answer. – Ingo Jan 16 '21 at 14:05
  • @Ingo - I didn't mean avahi was the only mDNS solution :p – Jaromanda X Jan 17 '21 at 03:22
  • Thanks for commenting @Ingo. RNDIS is afaik an ethernet over usb specification from microsoft. It allows you interract with a device over usb like you would over an ethernet cable. When I install the driver I have an "USB Ethernet/RNDIS Gadget" showing up in device manager. I don't know however how to interract with the device without using mDNS. To me it appears that mDNS (Bonjour on Windows) is crucial to be able to address my device (if you know better please let me know). This being said, when mDNS breaks I lose all possibilities to reconnect which is what happened. – glades Jan 17 '21 at 07:29
  • It seems your problem with using the correct link is only an issue on the MS Windows PC now and actually not relevant for Raspberry Pi. – Ingo Jan 17 '21 at 19:01

2 Answers2

2

Not a complete solution because lack of detailed information what you exactly have tried. But here are some clarifications to questions from comments that may help.

As noted in the guide:

But you have to do a complete switch. There is no way to mix up with Debian networking and/or dhcpcd.

In the past I have tried to just disable that services but run into problems with it having side effects with software that silently expected availability of traditional networking. To have clear conditions and clear error messages I decided to remove them completely. If you need them, it's no problem to install them again, having in mind that you know what you are doing.

It is not true that there is no mDNS name resolution when removing the avahi-daemon. This is one of the examples where we have serious conflicts with systemd-resolved that is used instead. Because the guide is about systemd-networkd I of course use the latter and enable it by installing libnss-resolve. To enable mDNS with systemd-resolved just set option MulticastDNS=yes in the /etc/systemd/network/*.network files.

There is only one restriction that systemd-reolved cannot do with mDNS. It is not able to propagate services as for example used by the print service cups. You will not find printers in your network. This is the only situation I know, where you need avahi.

You wrote in a comment:

I suspect the removal of ahavi-daemon could have impaired the ability to find my raspi over RNDIS using just the hostname. I'm using Bonjour on my Windows PC.

Here you are mixing up two things. Using just the hostname isn't supported by mDNS and therefore also not by Bonjour. For this you always have to use domain .local, e.g. ping hostname.local. Only using the hostname is a service supported by Microsoft, called Link-Local Multicast Name Resolution (LLMNR) and has nothing to do with mDNS. Fortunately systemd also supports it. To enable it with systemd-resolved just set option LLMNR=yes in the /etc/systemd/network/*.network files.

To check name resolution use command resolvectl, e.g.:

rpi ~$ resolvectl   # status of interface configuration
rpi ~$ resolvectl query mylaptop.local   # mDNS
rpi ~$ resolvectl query mylaptop         # LLMNR
rpi ~$ resolvectl --help

If you are open to use new technologies let me know about your problem details and I will have a look at it.

Ingo
  • 42,107
  • 20
  • 85
  • 197
  • Thanks a lot for your elaborate answer and clarification! I found a solution to part of the problem, because I was accidentally missing the quotation marks in wpa_supplicant. Still, the problem with RNDIS persists (See EDIT of original post), but it doesn't seem to be related to systemd. – glades Jan 17 '21 at 15:12
0

If you ACTUALLY followed the linked tutorial it should work although I find it rather confusing and it contains some poor advice (removing dhcpcd5 and other networking tools).

I have a simpler tutorial See https://raspberrypi.stackexchange.com/a/117843/8697 but there is no advantage over the default networking method for simple networking and it is more complex to setup.

If you have not deleted networking tools it is simple to revert to default setup. "put(ing) a fresh wpa_supplicant.conf into the boot partition" will DO NOTHING as you have disabled to tools to use it.

Milliways
  • 59,890
  • 31
  • 101
  • 209
  • Thanks, I will follow your tutorial as soon as I get to it. What I just noticed is that I removed ahavi daemon which is (afaik) a tool that allows hostname resolution somehow? Could that be a problem? – glades Jan 15 '21 at 07:12
  • @glades I can't comment on avahi. I do not specifically use it but dhcpcd also provides Zero-conf and this is provided by other tools e.g. netatalk. I don't understand removing things - if you don't want them, or they cause problems disable them, but unless you are really short of space leave them alone. – Milliways Jan 15 '21 at 07:33