From the place of work of, “If it truly is not broken do not deal with it” comes this: In Ubuntu Server, you can find a model new approach of location IP addresses. Gone are the times of manually modifying the flat text /and so on/network/interfaces file. In its put is netplan. That is ideal, Ubuntu followers, the approach you’ve identified for decades is now a factor of the past. In its place of a extremely basic text file, Ubuntu Server involves modifying a .yaml file (entire with suitable adherence to right code indent for just about every line of the block), in buy to configure your IP addressing.
Prior to you stress, it truly is not all that tough. In fact, it truly is seriously just a make a difference of comprehension the format of these .yaml documents and how networking is now restarted. I’m likely to show you just that, this sort of that you can configure a static IP tackle in Ubuntu Server 18.04 as conveniently as you could in 16.04.
The new approach
Open up up a terminal window on your Ubuntu 18.04 server (or log in by using protected shell). Transform into the /and so on/netplan listing with the command cd /and so on/netplan. Problem the command ls and you should really see a file named fifty-cloud-init.yaml. If you do not also see a file named 01-netcfg.yaml, build it with the command sudo contact 01-netcfg.yaml. Prior to we edit that file, we need to have to know the name of our networking interface. Problem the command ip a and you should really see your process network interface stated by name (Determine A).
Now we are likely to build a new netplan configuration file. If you do not see the 01-netcfg.yaml file, build 1 with the command sudo nano 01-netcfg.yaml. Our file is likely to look like that which you see in Determine B.
What’s vital about the format of this file is not working with the exact same spacing as my illustration, but that you are reliable. If you are not reliable with your indents, the file will not work. What you see in that sample file is all you need to have to configure that static IP tackle. Do detect, you usually are not location the tackle is the same manner as you did with Ubuntu 16.04. With the previous approach, you set IP tackle and netmask like so:
tackle = 192.168.1.206 netmask = 255.255.255.
With netplan, these are set with a solitary line:
addresses : [192.168.1.206/24]
With the new approach, you need to restart networking working with netplan. So when you’ve configured your interface, problem the command:
sudo netplan utilize
The higher than command will restart networking and utilize the new configuration. You should not see any output. If networking fails to functionality correctly, you can problem the command:
sudo netplan --debug utilize
The output of the command (Determine C) should really give you some indication as to what’s likely wrong.
That is all there is to it
There ya go. That is all there is to configuring a static IP tackle in Ubuntu Server 18.04. Recall, you can expect to have to do this for just about every interface you have on your server. Make positive to name the documents a thing like 01-netcfg.yaml and 02-netcfg-yaml. It truly is not terribly difficult, when you are employed to not working with that previous-faculty interfaces file.