Setting up the network interface in Ubuntu 18.04

Many people were surprised by the network interface setup in . Despite the presence of the well-known configuration file /etc/network/interfaces, reads:

Translation.

Netplan configuration via /etc/netplan has taken the position of configuration using ifupdown. Install ifupdown using the following command if you wish to go back to it:

sudo apt install ifupdown

Nothing else will be installed by us. Set up what we have first. Let’s first have a look at what is in the /etc/netplan directory.

Check out the contents of this file.

In YAML, the configuration file is written. The settings in the aforementioned example were established during the operating system installation process. Let’s look more closely.

  • network is the first block in the network configuration;
  • Ethernets – this parameter indicates the next configuration step will be the same-named protocol;
  • The configured network interface’s name is enp0s3. In your situation, the name probably won’t be the same. The command ifconfig -a can be used to view a list of all interfaces;
  • addresses is the group of IP addresses that the network prefix has assigned to the interface. As in the example, one IP address is shown, followed by multiple addresses enclosed in square brackets “[and]” and separated by commas;
  • gateway4 – IPv4 network gateway;
  • nameservers – nameserver configuration block.
  • addresses – they specify which to contact in the nameservers block. without a network prefix specified. Indicated addresses are separated by commas and enclosed in square brackets, “[and]”.
  • version is the version language YAML.

Use this command to make the current settings active:

netplan apply

We’ve covered the main options. More configuration examples are on the official website .

What happens if the system is not Netplan-based? here using traditional methods. We first receive a list of the accessible interfaces:

ifconfig -a

There are 2 network interfaces in this scenario that lack IP addresses (yet). DHCP configuration is used. Now let’s talk about the settings.

sudo nano /etc/network/interfaces

Obtaining an IP address from a DHCP server is not a recommended course of action. Let’s examine the document:

What does this mean.

  • auto enp0s3 – automatic launch of a specific interface;
  • iface enp0s3 inet static – reports static configuration;
  • address 10.10.2.6 – actually, the IPv4 address for this interface;
  • netmask 255.255.255.0 – netmask
  • gateway 10.10.2.1 – IPv4 gateway
  • dns-nameservers 8.8.8.8 – specify DNS servers

The remaining interfaces are setup either via a DHCP server or in the same manner as the second interface.

Apply settings:

sudo /etc/init.d/ restart

If everything is done correctly, we are now awaiting the service restart procedure. Important. The settings file may be accurate, but the server’s IP address may not be updated. Restarting the server in this instance with the following command:

sudo reboot

 

Welcome to the world of DomainRooster, where roosters (and hens) rule the roost! We're a one-stop shop for all your entrepreneurial needs, bringing together domain names and website hosting, and all the tools you need to bring your ideas to life. With our help, you'll soar to new heights and hatch great success. Think of us as your trusty sidekick, always there to lend a wing and help you navigate the sometimes-complex world of domain names and web hosting. Our team of roosters are experts in their fields and are always on hand to answer any questions and provide guidance. So why wait? Sign up today and join the ranks of the world's greatest entrepreneurs. With DomainRooster, the sky's the limit! And remember, as the saying goes, "Successful people do what unsuccessful people are not willing to do." So don't be afraid to take that leap of faith - DomainRooster is here to help you reach for the stars. Caw on!