How to add a Wireless LAN adaptor static IP to Ubuntu 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 as the fixed IP of our wifi lan adaptor with gateway and dns on
  • Change the network information according to your setup.
  • Open a terminal window and enter:
sudo gedit /etc/network/interfaces
  • The add the following for you wifi lan adaptor to create a fixed IP entry that will auto connect at startup for all users.
  • Save and reboot when done.
# The wifi network interface
auto wlan0
iface wlan0 inet static
    wpa-ssid <Your Wifi Network SSID>
    wpa-psk <Your HEX encoded Wifi WPA password>
  • After reboot your wifi network should be active and connected with a fixed IP before user login.