5

I've used the wpa_supplicant and changed the interface to use this and I can get the pi to connect to the network.

network {
    ssid="YOUR_NETWORK_NAME"
    psk="YOUR_NETWORK_PASSWORD"
}

I can also just use interfaces with

iface wlan0 inet dhcp
      wpa-ssid "network"
      wpa-psk "password"

and I get it to connect to wifi as well.

What is the difference between the two?

4

Raspbian uses dhcpcd to manage networks. Despite the name this does more than allocate addresses; it can actively switch between networks and interfaces, and repair broken connections. /etc/network/interfaces uses wpasupplicant to provide details of known wireless networks (and other optional settings). (dhcpcd can directly call wpasupplicant, but Raspbian Jessie omitted the hook to do this, although this is included in Stretch and Buster.)

See:- How do I set up networking/WiFi/Static IP

etc/network/interfaces is used by used by ifup and ifdown.

It can be used to provide a simple static setup, which can be managed manually. The default works with dhcpcd and wpasupplicant.

One disadvantage of putting wireless settings in interfaces (apart from lack of flexibility) is that any user can read password.

  • One disadvantage of putting wireless settings in interfaces (apart from lack of flexibility) is that any user can read password. That's actually wrong, you can use wpa_supplicant ssid password and use the generated password in the interface by setting it with wpa-psk. – eXa Sep 11 '18 at 6:59
  • @eXa you made a typo? maybe wpa_passphrase? – schemacs Sep 15 at 13:07
  • @schemacs Nope linux.die.net/man/8/wpa_supplicant – eXa Sep 16 at 20:59
3

The biggest difference is that
/etc/network/interfaces file refer to all interfaces of the network where
wpa_supplicant is focused on wireless communication.

Using interface file, you can control the interface.
wpa_supplicant, you can control the setting to connect to the wireless hub.

0

My understanding is that wpasupplicant does the WPA security and interfaces does the WiFi transport after the secure connection is made.

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.