Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to set static IP address in Ubuntu

📅 2013-Mar-17 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ ip address, nm-tool, static, ubuntu ⬩ 📚 Archive

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.

  1. 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.

  2. 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.

  3. 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

© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘📧