1

I have some Pi Wifi experience on Raspbian Jessie (just followed tutorials, though), but not an expert on networking. Anyway, I recently moved to Stretch. Thanks to new tutorials and Internet discussions, I can run Wifi repeater on Stretch again. But I am having one problem.

On Jessie, we could run a script when a network interface is up/down by adding pre-up / post-up / pre-down / post-down lines to each iface section in /etc/network/interfaces. But on Stretch, it seems we shouldn't modify it unless networking service is enabled and dhcpcd service is disabled.

So, What is a proper way to run a script by interface up/down now?

Chihaya
  • 84
  • 1
  • 1
  • 9

1 Answers1

1

There is no "proper way" BECAUSE Raspbian DOES NOT use Debian networking, although it is still possible to use this if desired.

Raspbian uses dhcpcd as its default network manager. See How to set up networking/WiFi for detail.

Why do you WANT to "interface up/down" - dhcpcd automatically manages network interfaces, and does an excellent job?

You can write hooks which are invoked by network events - see man 8 dhcpcd-run-hooks (There are a number of included hooks e.g. 10-wpa_supplicant see /lib/dhcpcd/dhcpcd-hooks

PS Using a Pi as a WiFi repeater seems a poor idea, due to the restricted network throughput - a dedicated repeater would be cheaper and perform better.

Incidentally you can still use /etc/network/interfaces if you configure dhcpcd to NOT manage an interface (discussed in linked answer).


Stretch networking is the same as Jessie.

The earlier Foundation implementation of dhcpcd (in Jessie and Wheezy) omitted the 10-wpa_supplicant hook, requiring a kludge in /etc/network/interfaces to support WiFi. (In fact I installed 10-wpa_supplicant in my Jessie, rendering /etc/network/interfaces unnecessary.)

Debian Stretch introduced predictable network interface names which are incompatible with the kludged /etc/network/interfaces so the 10-wpa_supplicant hook was included. (For some incomprehensible reason the Foundation later decided to disable predictable network interface names.)

If you want Stretch networking to work the same as Jessie all you have to do is delete 10-wpa_supplicant and restore the kludged /etc/network/interfaces. This will, of cause, suffer from the limitations of Jessie networking.

Milliways
  • 62,573
  • 32
  • 113
  • 225