I'm running a python script to configure the wifi interface, but I'm having a problem with the ifdown and ifup command. It looks like this command has been replaced by:

sudo ip link set wlan0 down
sudo ip link set wlan0 up

But I can not use this command since I'm using wifi library to interact with these files and programs. The file /etc/network/interfaces:

source-directory /etc/network/interfaces.d

iface wlan0-kenta inet dhcp
    wpa-ssid kenta
    wireless-channel auto
    wpa-psk #here has code apparently in hexadecimal representing the password,
            #I have already tried to switch to the character password.

How can I fix this problem?

  • Why are you using these bizarre commands? None of these are used in current Raspbian.
    – Milliways
    Commented Mar 5, 2019 at 6:25
  • I'm using a python library that when trying to connect to a network, uses this command to disable and enable network interface.
    – kenta
    Commented Mar 5, 2019 at 14:14

1 Answer 1


I saw this thread on stack overflow which seems to use the wifi library. Maybe it will work for you.

Stack overflow link to using wifi library

  • Thanks, but this did not work for me, now I wrote my own wifi network configuration library that did not need this command.
    – kenta
    Commented Mar 5, 2019 at 23:12
  • @kenta And does it work now? If so, please make an answer to tell that your problem is solved. This will also finish your question.
    – Ingo
    Commented Mar 6, 2019 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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