Ubuntu - Networking - Wireless - Add a Wireless LAN adapter static IP that auto connects at startup
You need to manually add your wifi (wlan0) interface details to your /etc/network/interfaces file.
If you are using a WPA or WPA2 password on your wifi network you need to convert the WPA-PSK password to HEX.
To create a HEX encoded key for your wifi network configuration use the following command (remove < >) :
sudo wpa_passphrase <Your Wifi Network SSID> <Your Wifi WPA/WPA2 password>
In this example we are assigning 192.168.0.2 as the fixed IP of our wifi lan adapter with gateway and dns on 192.168.0.1.
Change the network information according to your setup.
Execute the following:
sudo vi /etc/network/interfaces
The add the following for you wifi lan adapter to create a fixed IP entry that will auto connect at startup for all users.
- /etc/network/interfaces
# The wifi network interface auto wlan0 iface wlan0 inet static address 192.168.0.2 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.1 dns-nameservers 192.168.0.1, 192.168.0.2, 8.8.8.8 wpa-ssid <Your Wifi Network SSID> wpa-psk <Your HEX encoded Wifi WPA password>
Save and reboot when done.
After reboot your wifi network should be active and connected with a fixed IP before user login.