I will state this right out of the gate: The process of setting a static wireless connection on Ubuntu Touch should be much easier. Yes, you can add a static IP address through the Ubuntu Touch GUI, but it only allows you to enter the address (no DNS, no gateway). Thankfully, this is Linux, so even though there isn’t a handy entry in the GUI configuration for setting up a complete static wireless network connection, it can still be done.
Why all the build up? What does this mean? The bad news is you’re going to have to use the command line. The good news is that you don’t have to root the device to pull this off.
What you’ll need
Out of the box, Ubuntu Touch has everything it needs, minus the Terminal application. You will, however, need the information required to set the static IP address (DNS, available IP address, netmask, gateway address).
Before we continue, let’s install the Terminal app.
- Open the Scopes app.
- Swipe to the left until you see the Apps scope.
- Locate and tap the Ubuntu Store launcher.
- Search for Terminal.
- Locate and tap the entry by Ubuntu Core App Developers.
- Tap Install.
- Allow the installation to complete.
You should now see a launcher for Terminal in the Apps scope. Tap that launcher and, when prompted, enter your user PIN (the same PIN you use for your lock screen). You’re ready to work.
Editing the connection
As you’ve probably surmised at this point, you have to manually edit the wireless connection information. From the Terminal app, change into the correct folder with the command cd /etc/NetworkManager/system-connections folder. Issue the command ls, and you should see a listing for the wireless connection you wish to modify. In order to modify this connection, you first need to change to the root user by issuing the command sudo su. Enter your lock screen PIN to continue.
To edit the file, issue the command nano NAME_OF_CONNECTION (where NAME_OF_CONNECTION is the actual name of the connection you want to edit). This file should look something like this (I X’d out the secret bits of information for my wireless connection):
Move your cursor down to the [ipv4] section and change that to reflect the following:
Make sure to plug in the information specific to your network in the form. In the above example I used both OpenDNS and Google servers for DNS. Once you’ve edited the file, save it with [Ctrl+[x] and then click y and hit Enter to save.
You can attempt to disconnect and reconnect to wireless, but I’ve found it doesn’t always work; instead, reboot the device. Once the Ubuntu Touch device has rebooted, you can open the terminal and issue the command ifconfig to see your newly configured IP address in action (Figure A).
Your Ubuntu Touch device can now enjoy a static IP address. If something changes on your network, you’ll have to manually edit the connection to make a change.
Hopefully, the developers will very soon add the ability to fully configure a static IP address on the platform. Until then, you’ll have to settle for the manual option.