I like to have a static IP address for my Ubuntu notebook computer when it is connected to the home network. This is useful because with a static IP address other devices on the home network know how to talk to my notebook. Setting up a static IP address for a specific network is easy in Ubuntu.
By default, my notebook is connected to my home wireless router using DHCP. I would like to use the same settings but with a static IP address. First, I decide what static IP address to use. Then I note down the network mask (check
ifconfig output), the network gateway (check
route -n output) and DNS servers (Google or OpenDNS). One way to do this is by running nm-tool. You can see these details at the end of its output.
Click the network icon in the Panel and choose Edit connections. Here pick the network connection you are using (wired or wireless) and click Edit. Under IPv4 settings, change Automatic (DHCP) to Manual and enter the static IP address you want, the netmask, gateway and DNS servers. If you want to provide two DNS server addresses, separate them with a comma.
Disconnect from the network and connect back again. If everything is working fine, you have configured your static IP address.
Tried with: Ubuntu 16.04