The issue with Wireless Networks is that they are not managed correctly by
/etc/network/interfaces unless you configure all the WPA2 items. This poses a problem - it will always try and configure itself then for that Wireless Network, and then you won't have a working wifi if you need to do another network, until you reconfigure the item in
/etc/network/interfaces, and then reboot or restart the wifi card.
The correct way to handle Wireless Networks is to use Network Manager, on a default Ubuntu installation, and then have all the configuration done in the network profile that is stored inside Network Manager.
In a typical setup of Ubuntu 14.04, you will have to configure Network Manager to connect to a wireless network. Inside Network Manager, it will have different connection profiles for each Wireless network. Start by connecting to the network as you normally would - this will then give you a dynamically-assigned Wireless address, and create the profile.
Click the network manager icon in the indicator bar. Hit "Edit Connections", and select the network you want to edit. Then hit "Edit"; this type of screen shows up:
You can then go to the IPv4 tab, and hit "Manual". In the box for IP addresses, network data, etc. you will then put your configuration items there, such that
192.168.1.151 is the address,
24 is the NetMask you enter (you can also put
255.255.255.0 if you want, but
24 is identified the same way), and
192.168.1.1 is the gateway.
Another box is for DNS servers - there you would put
It'd look something like this when you're done:
Hit "Save". Then, tell Network Manager to disconnect and then connect to the network again. You then have static-IP addressing for that wireless network.
You can also configure different settings for different Wireless networks in this way, if multiple networks need different static IP addresses or network settings set on your device.