If it succeeds, you will see Configuration accepted. The above command will validate the configuration before applying it. To do that, issue the command: sudo netplan try Testing the Configurationīefore we apply the change, let’s test the configuration. Instead, the netmask is added to the IP address. Notice the netmask is no longer configured in the form 255.255.255.0. yaml file: network: version: 2 renderer: networkd ethernets: ens5: dhcp4: no addresses: gateway4: 192.168.1.254 nameservers: addresses: Įdit the above to fit your networking needs. NAMESERVER is the comma-separated list of DNS nameservers. NETMASK is the netmask for the IP address. Yes/no is an option to enable or disable dhcp4. yaml file for editing with the command: sudo nano /etc/netplan/01-netcfg.yamlĭEVICE_NAME is the actual device name to be configured. I’ll be configuring ens5 for a static IP address. To do that, you can issue the command ip a and find out which device is to be used ( Figure 1 ).įigure 1: Finding our device name with the ip a command. Network Device Nameīefore you configure your static IP address, you’ll need to know the name of device to be configured. With your backup in place, you’re ready to configure. If you opt to edit the default, I suggest making a copy with the command: sudo cp /etc/netplan/01-netcfg.yaml /etc/netplan/ You can create a new file or edit the default. Once in that directory, you will probably only see a single file: 01-netcfg.yaml Change into that directory with the command cd /etc/netplan. You will find the new configuration files for Netplan in the /etc/netplan directory. Open a terminal window (or log into your Ubuntu Server via SSH). You don’t have to use a specific spacing for each line, it just has to remain consistent. yaml files you create for Netplan must be consistent in spacing, otherwise they’ll fail to work. I will give you one word of warning, the. I’ll be demonstrating on Ubuntu Server 18.04. I want to show you how to use Netplan on Linux, to configure a static IP address and a DHCP address. Netplan uses YAML description files to configure network interfaces and, from those descriptions, will generate the necessary configuration options for any given renderer tool. Netplan is a command line utility for the configuration of networking on certain Linux distributions. Instead of that interfaces file and using the /etc/init.d/networking script, we now turn to Netplan. With certain distributions (such as Ubuntu Linux 18.04), the configuration and control of networking has changed considerably. Your network will restart and the newly configured interface is good to go. Or, if you’re not using a non-systemd distribution, you could restart networking the old fashioned way like so: sudo /etc/init.d/networking restart Restart networking with the command: sudo systemctl restart networking The configuration was incredibly easy and never failed to work. For instance, if you’re an Ubuntu user, you could either configure the network connection via the desktop GUI or from within the /etc/network/interfaces file. For years Linux admins and users have configured their network interfaces in the same way.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |