However, in certain situations, you may need to set up static IP addresses on some machines that you don’t want to have random IP addresses. In many environments, static IP addresses are assigned by a router or DHCP servers using reservations. An IP reservation is a process where the same IP addresses are reserved and assigned only to computers with corresponding MAC addresses. The computer which has its MAC address reserved to a particular address will always receive that IP address. If you’re not going to be using a dedicated system for IP management, then configuring an individual system with a unique IP address may be your next option. Since the release of Ubuntu 17.10, Netplan is now the default network configuration tool to manage network settings replacing the configuration file /etc/network/interfaces that were used in previous versions. Netplan currently supports two renderers NetworkManager and Systemd-network. NetworkManager is mostly used on Desktop machines while Systemd-network is used on servers without a GUI. The new interfaces configuration file now lives in the /etc/netplan directory. There are two renderers. NetworkManager and network. When you use NetworkManager as the renderer, you will use the NetworkManager GUI to manage the interfaces. Ubuntu uses ‘Predictable Network Interface Names’ that, by default, start with en[letter][number]. Netplan configuration files are stored in the /etc/netplan directory and have the extension .yaml. You’ll probably find one or two YAML files in this directory. The network configuration file will differ from setup to setup. Some may be named 01-netcfg.yaml, 50-cloud-init.yaml, etcs. Below is a sample file for a network interface using the network as a renderer using DHCP. The network uses the command line to configure the network interfaces. You should see a similar DHCP server for servers like the one below: On Desktops, you may see something like the one below:

How to configure IP address with networkd

To configure a static IP address using the new Netplan tool on the Ubuntu server, you’ll need to edit the *.yaml file in the /etc/netplan/ directory. If your Ubuntu cloud instance is provisioned with cloud-init, you’ll need to disable it before setting a static IP address. To do so create the following file by running the commands below: With the file open, paste the line below and save. After editing the file above, run the commands below to open the network configuration file for the network interfaces. The device type can be ethernets, bonds, bridges, or VLANs. Then change the dhcp4 value to no, and configure the static IP address details, including DNS and Gateway addresses as shown below. When you’re done editing the file, save it and exit. You will want to make sure that the file meets YAML code indent standards. If not probably indented, you’ll get an error. Run the commands below to apply your changes. To validate that your changes are applied, run the commands below to view the IP address configuration details. It should display similar lines like the one below:

How to setup static IPs on Ubuntu desktop

To set up static IP addresses on Ubuntu desktops, click the network icon in the top menu, then select Wired Connected –> Wired Settings. This will open the GNOME Network configuration settings. Click on the cog icon. Then choose Manual for IPv4 Method, and set up the IP, Network, Gateway, and/or DNS addresses. Click Apply to save your changes. This show how to configure static IP addresses on Ubuntu systems. For more about Netplan, visit this site. Conclusion: This post showed you how to set up static IP addresses on Ubuntu Linux. If you find any error above or have something to add, please use the comment form below.