• Contact
  • About Me
  • Privacy Policy
DefenceDev
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
No Result
View All Result
DefenceDev
No Result
View All Result
ADVERTISEMENT
Home Linux Tutorials Networking

Linux Networking: netplan DHCP Configuration on Ubuntu

neo by neo
May 27, 2025
in Networking
0
Linux Networking: netplan DHCP Configuration on Ubuntu

Linux Networking: netplan DHCP Configuration on Ubuntu

0
SHARES
10
VIEWS
Share on FacebookShare on Twitter
ADVERTISEMENT

Linux Networking: DHCP Configuration on Ubuntu

In this post, Linux Networking: netplan DHCP Configuration on Ubuntu, we will explore how to configure DHCP (Dynamic Host Configuration Protocol) on Ubuntu using netplan, the default network configuration tool. DHCP simplifies the process of assigning IP addresses to devices on a network, making it essential for efficient network management. Specifically, you’ll learn how to set up a DHCP server, configure it through netplan, and ensure your Ubuntu system can automatically acquire an IP address. By following along, you’ll develop a solid understanding of managing DHCP settings on your Ubuntu server. So, let’s dive in and get started with netplan DHCP configuration!

Netplan DHCP Explanation

You can use DHCP (Dynamic Host Configuration Protocol) in Netplan configurations on Ubuntu when you want the network interface to automatically receive its IP address, subnet mask, default gateway, and DNS servers from a DHCP server. This approach is common in environments where network settings are centrally managed and may change dynamically.

DHCP netplan Configuration

Configuration file is located under the folder: /etc/netplan

List files in the folder:

ls /etc/netplan

Open and edit configuration file:

ADVERTISEMENT
sudo nano 00-installer-config.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s3:
      dhcp4: yes

Breakdown:

  • network:
    • This serves as the root element for the network configuration in netplan.
  • version: 2
    • This defines the version of the netplan configuration syntax, with Version 2 being the current and supported version.
  • renderer: networkd
    • This defines the backend used for managing the network configuration. networkd refers to systemd-networkd, which is a lightweight network management tool provided by systemd. It is typically used for managing network configurations on servers.
  • ethernets:
    • This section specifies Ethernet interfaces. In this case, it indicates that the configuration will apply to a physical or virtual Ethernet interface.
  • enp0s3:
    • This is the name of the Ethernet interface being configured. In this case, it’s enp0s3, which is a common name for a network interface on modern systems using predictable network interface names.
  • dhcp4: yes
    • This enables DHCP (Dynamic Host Configuration Protocol) for IPv4. Setting it to yes means the interface (enp0s3) will automatically obtain an IP address from a DHCP server on the network. DHCP4 is specifically for IPv4 addressing.

Summary

This configuration tells netplan to use systemd-networkd to manage the enp0s3 network interface. The interface will automatically obtain an IPv4 address from a DHCP server, simplifying network configuration for systems that don’t require static IP addresses.

Test netplan Configuration

The netplan try -timeout 120 command lets you test network settings temporarily. It applies changes for 120 seconds, allowing you to verify if the new configuration works. If something goes wrong, the configuration automatically reverts after the timeout, preventing network disruptions.

# Try the configuration before applying
netplan try -timeout 120 

Apply netplan Configuration

After verifying the changes, use netplan apply to make the configuration permanent. This command saves the modifications, applying the updated settings to your system’s network permanently.

ADVERTISEMENT
# Apply network configuration
netplan apply

defencedev.com

ADVERTISEMENT

About The Author

neo

See author's posts

ADVERTISEMENT
Previous Post

Solutions: Repeat Command in Ubuntu Terminal

Next Post

Immich: Generate Let’s Encrypt Certificate on Ubuntu 22.04 Server

neo

neo

Next Post
Immich Example

Immich: Generate Let's Encrypt Certificate on Ubuntu 22.04 Server

Follow Us

  • Trending
  • Comments
  • Latest
MikroTik: Export Configuration in Text File

MikroTik: Export Configuration in Text File

Fortinet FortiGate: Static Route Configuration via GUI and CLI

Fortinet FortiGate: Static Route Configuration via GUI and CLI

Immich: Installation on Ubuntu 22.04

Immich: Installation on Ubuntu 22.04

Fortinet FortiGate Upgrade Path Tool

Fortinet FortiGate Upgrade Path Tool

NextCloud: Port Forwarding - Essential Ports for Smooth Functionality

NextCloud: Port Forwarding – Essential Ports for Smooth Functionality and Remote Access

Organizing and Managing Photos with Immich: Features I Use

Organizing and Managing Photos with Immich: Features I Use

Install Ubuntu 22.04 on Oracle VM Virtual Box

Install Ubuntu 22.04 on Oracle VM Virtual Box

Linux Directories: cd (Change Directory), pwd (Print Working Directory), mkdir (Make Directory)

Linux Directories: cd (Change Directory), pwd (Print Working Directory), mkdir (Make Directory)

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

Recent News

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

MikroTik: Check Your Wireless Password

MikroTik: Check Your Wireless Password

ADVERTISEMENT

DefenceDev Tutorials

defencedev Logo

Whether you’re just starting or looking to expand your skills, I hope you find useful information and engaging discussions here. Let me take you through my journey and the goals behind this space!

Follow Us

Browse by Category

  • Blog
  • Cloud
    • Private
  • Linux Tutorials
    • Bash Scripting Tutorials
    • Commands
    • Networking
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Solutions
    • Docker
  • Video Tutorials
    • MikroTik Videos

Recent News

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

  • Site Map
  • Privacy Policy
  • Facebook Page
  • Disclaimer
  • Contact
  • About Me

© 2025 defencedev.com - All rights reserved.

No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos

© 2025 defencedev.com - All rights reserved.