Linux/Wireless: Difference between revisions
From charlesreid1
| Line 6: | Line 6: | ||
* How to connect to encrypted vs. unencrypted wifi | * How to connect to encrypted vs. unencrypted wifi | ||
=Use etc network interfaces= | =Use /etc/network/interfaces= | ||
==Joining network with WPA encryption== | |||
NOTE: This method is working on Raspberry Pi platform as of April 2017. | NOTE: This method is working on Raspberry Pi platform as of April 2017. | ||
Main Page: [[Linux/Wireless/2]] | Main Page: [[Linux/Wireless/2]] | ||
To set the wireless network you want a Linux box to join, you can add the network name and passphrase to <code>/etc/network/interfaces</code>. Better yet, you can create one file for each network you want to have ready to go, and swap them in and out by sourcing them or not from the /etc/network/interfaces file. | To set the wireless network you want a Linux box to join, you can add the network name and passphrase to <code>/etc/network/interfaces</code>. Better yet, you can create one file for each network you want to have ready to go, and swap them in and out by sourcing them or not from the /etc/network/interfaces file. | ||
| Line 33: | Line 33: | ||
The <code>/etc/network/interfaces.d/</code> folder would contain credentials for several networks, and could be swapped out by editing <code>/etc/network/interfaces</code>. | The <code>/etc/network/interfaces.d/</code> folder would contain credentials for several networks, and could be swapped out by editing <code>/etc/network/interfaces</code>. | ||
==Joining an open network== | |||
Repeat the above steps, but this time your wifi network's config file will look a little different for the open network: | |||
<pre> | |||
auto wlan0 | |||
allow-hotplug wlan0 | |||
iface wlan0 inet dhcp | |||
wpa-ssid LocalCoffeeShop | |||
</pre> | |||
=WPA Supplicant Method= | =WPA Supplicant Method= | ||
Revision as of 06:20, 15 April 2017
This page covers methods of connecting to wifi from Linux.
The methods break down as follows:
- Use
/etc/network/interfaces - Use wpa supplicant
- How to connect to encrypted vs. unencrypted wifi
Use /etc/network/interfaces
Joining network with WPA encryption
NOTE: This method is working on Raspberry Pi platform as of April 2017.
Main Page: Linux/Wireless/2
To set the wireless network you want a Linux box to join, you can add the network name and passphrase to /etc/network/interfaces. Better yet, you can create one file for each network you want to have ready to go, and swap them in and out by sourcing them or not from the /etc/network/interfaces file.
First, put the wifi configuration information into a file. This will be called mynetwork.cfg, and will be stored in /etc/network/interfaces.d/mynetwork.cfg.
auto wlan0 allow-hotplug wlan0 iface wlan0 inet dhcp wpa-ssid NetName wpa-psk NetPassword
The next step is to reference this configuration file from the /etc/network/interfaces file. Here is what that file looks like:
source /etc/network/interfaces.d/mynetwork.cfg
The /etc/network/interfaces.d/ folder would contain credentials for several networks, and could be swapped out by editing /etc/network/interfaces.
Joining an open network
Repeat the above steps, but this time your wifi network's config file will look a little different for the open network:
auto wlan0 allow-hotplug wlan0 iface wlan0 inet dhcp wpa-ssid LocalCoffeeShop
WPA Supplicant Method
Main Page: Linux/Wireless/1
This method uses wpa_supplicant, and has been tested and works on a Rasbperry Pi.