The file used to configure network settings in the Ubuntu operating system may vary depending on the version of Ubuntu and the network configuration method. However, in modern Ubuntu versions (17.10 and later), the configuration tool called Netplan is used by default.
Netplan Configuration File Path
Netplan manages network settings with files in YAML format. These files are usually located in the following directory:
/etc/netplan/
The file names in this folder are usually one of the following:
50-cloud-init.yaml
01-netcfg.yaml
00-installer-config.yaml
The exact file name may vary depending on the system installation method or system image. However, all Netplan configurations are in the /etc/netplan/ folder.
Sample Netplan Configuration
A sample Netplan file is given below:
network:
version: 2
renderer: networkd
ethernets:
ens33:
dhcp4: no
addresses: [192.168.1.100/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
This configuration sets a static IP for the interface named ens33.
Applying After Changes
After making changes to the configuration file, the following command is used to apply the changes:
sudo netplan apply
To avoid errors, you can first verify with the following command:
sudo netplan try
If the connection is not established within 120 seconds, the configuration is rolled back.
You have examined the knowledge base in detail, but if you cannot find the information you need,
Create a Support Ticket