1. Background Netplan is a new command-line network configuration utility introduced in Ubuntu 17.10 for easily managing and configuring network settings in Ubuntu systems. It allows you to configure network interfaces using the YAML abstraction. It works with NetworkManager and the systemd-networkd network daemon (called renderers, you can choose which one to use) as an interface to the kernel. It reads the network configuration described in /etc/netplan/*.ymal and can store the configuration of all network interfaces in these files. In this article. We will explain how to configure a network static or dynamic IP address for a network interface in Ubuntu 18.04 using the Netplan utility. 2. Solution List all active network interfaces on Ubuntu First, you need to determine which network interface you want to configure. You can use ifconfig command to list all connected network interfaces in your system as shown. Checking Network Interfaces in Ubuntu From the output of the above command, we have 2 interfaces connected to our Ubuntu system: 1 Ethernet interface and the loopback interface. Ubuntu sets a static IP address In this example, we will configure the ens33 Ethernet network interface with a static IP. As shown, use vim to open the netplain configuration file. Important: If the YAML file was not created by the distribution installer, you can use this command to generate the required configuration for the renderer. Additionally, the auto-generated files may have different file names on your desktop, server, cloud instance, etc. (e.g. 01-network-manager-all.ymal or 01-netcfg.yaml), but all files under /etc/netplan/*.yaml will be read by netplan. Then add the following configuration in the ethernet section. network: ethernets: ens33: addresses: - 192.168.4.254/24 dhcp4: false gateway4: 192.168.4.2 nameservers: addresses: - 8.8.8.8 search: [] version: 2 illustrate: •ens33: Network interface name Once added, your configuration file should have the following contents as shown in the following screenshot. The address property of an interface expects a sequence entry such as [192.168.4.254/24,"20001:1::1/64"] or [192.168.1.254/24,] (refer to the netplan man page for more information). Configure Static IP in Ubuntu Save the file and exit. Then apply the recent network changes using the following netplan command. Now verify all available network interfaces again. The ens33 Ethernet interface should now be connected to the local network and have an IP address as shown in the following screenshot. Verify Network Interface in Ubuntu Ubuntu sets a dynamic IP address To configure the ens33 Ethernet interface to receive an IP address dynamically via DHCP, simply use the following configuration. network: ethernets: ens33: dhcp6: true dhcp4: true version: 2 Save the file and exit. Then apply the recent network changes using the following netplan command. sudo netplan apply ifconfig -a From now on, your system will obtain an IP address dynamically from the router. You can find more information and configuration options by viewing the netplan man page. At this point, you have successfully configured a network static IP address to your Ubuntu server. Summarize The above is the method of setting static IP for Ubuntu 18.04 Server introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: Detailed explanation of Vue's caching method example
The large-screen digital scrolling effect comes f...
After the green version of mysql5.6 is decompress...
The implementation of expanding and collapsing li...
react-native installation process 1.npx react-nat...
The relevant person in charge of Baidu Input Metho...
I won’t waste any more time talking nonsense, let...
Table of contents 1. How to switch 2. Dynamically...
Using the html-webpack-plugin plug-in to start th...
Table of contents Preface Descriptors Detailed ex...
Docker is becoming more and more mature and its f...
I have been working on a project recently - Budou ...
1. HTML Overview 1.HTML: Hypertext Markup Languag...
Preface: This article refers to jackyzm's blo...
To learn content-type, you must first know what i...
Tomcat is an HTTP server that is the official ref...