Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

Ok, so I set to install a server on a laptop and had a few glitches! Like disabling laptop sleep and then connecting to Wi-Fi via CLI!

I would also Disable waiting for Eth0 Connection @ boot It waits 2 Minutes before timing out, slowing boot WAY down.

It can be a bit fussy if you have Eht0 set to static. Currently the best option is to set static IP in router and set server to DHCP.

Notes: Eth0 will work if plugged in @ boot, but if you plug it in after boot you will need to either shut down wlan0 and restart eth0 or reboot.
BUT if Eht0 is plugged in @ boot, it will not connect to Wi-Fi.

Wlan0 to connect to my home network if available first, then search for my personal hotspot and finally any open Wi-Fi.

Note: I believe it try's to connect to WiFi networks in order based upon wpa_supplicant.conf so arrange accordingly. IE: Home @ top etc etc.

To get PSK value for WPA2 AES use


Then copy the PSK and paste into conf WITHOUT QUOTES.

You basically need to modify two files

sudo nano /etc/network/interfaces 
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

##DHCP Eth0
allow-hotplug eth0
iface eth0 inet dhcp

##Wireless NIC
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

##Home Wifi Configs
iface home inet dhcp

##Personal HotSpot Configs
iface AndroidAP inet dhcp

##Open_Wifi Configs
iface open_wifi inet dhcp

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

       id_str="home"             # Refers back to iface home in /etc/network/interfaces
       psk=             # NO QUOTES ""
       key_mgmt=WPA-PSK          # This config is tested on WPA2 AES Encryption
        ssid="AndroidAP"  # This connects to SSID AndroidAP before trying ANY open Wifi 
        key_mgmt=NONE     # AndroidAP has no Wifi PWD in this Config
##Open_Wifi ##Should go @ Bottom of conf
        ssid=""                 # This connects to ANY open Wifi


sudo ifconfig wlan0 down && sudo ifconfig wlan0 up && sudo wpa_cli -i wlan0 status 

Check for


If you see that, but ifconfig shows no private ip or ping fails. Then you have a DHCP issue.

sudo dhclient wlan0 

Will fix this, but you will want to figure out your configuration error!

This will connect via wpa_supplicant.conf directly and output debug info. Very usefull.

wpa_supplicant -d -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -D wext 

-d = debug/verbose -dd == super verbose

-D = driver

wext = "catch-all driver"


I tested with phone via hotspot which is PERFECT because it tells you when a client connects. I also turned off HotSpot and it reconnected when it turned back on! Only down side is if you are in a populated area, like my testing environment, it connected to "Xfinity-Wifi" which is open and then I had to reboot then it seemed to go with my hotspot due to it being a stronger signal. But once it was on XFinity it would not leave it unless I specified the Open Network SSID inside of the wpa_supplicant.conf OR rebooted.

  • No labels

1 Comment