• Contact
  • About Me
  • Privacy Policy
  • Disclaimer
DefenceDev
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
    • Bash Scripts
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
  • Web Tools
No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
    • Bash Scripts
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
  • Web Tools
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
28
VIEWS
Share on FacebookShare on LinkedIn

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:

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

Related Posts

Linux Networking: Display Open Ports and Listening Services
Networking

Linux Networking: Display Open Ports and Listening Services

netstat example on Ubuntu
Networking

Linux Networking: netstat (Network Statistics) Examples on Linux

Linux Networking: route, Mastering Routing in Ubuntu
Networking

Linux Networking: route, Mastering Routing in Ubuntu

Linux Networking: ping, Troubleshooting Network Connectivity
Networking

Linux Networking: ping, Troubleshooting Network Connectivity

Linux Networking: Add Multiple Network Gateways (Redundancy) on Ubuntu with netplan
Networking

Linux Networking: Add Multiple Network Gateways (Redundancy) on Ubuntu with netplan

Linux Networking: ifconfig, Managing Network Interfaces on Ubuntu
Networking

Linux Networking: ifconfig, Managing Network Interfaces on Ubuntu

Next Post
Immich Example

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

Recommended

Lesson 8: Working with Bash Strings

Lesson 8: Working with Bash Strings

Immich: Installation on Ubuntu 22.04

Immich: Installation on Ubuntu 22.04

Install Portainer on Ubuntu 24.04 Using Docker Compose

Install Portainer on Ubuntu 24.04 Using Docker Compose

FortiGate Country Address Object Generator – Block or Allow Access by Country

FortiGate Country Address Object Generator – Block or Allow Access by Country

View & Copy Image Metadata Online – Camera & GPS Info

View & Copy Image Metadata Online – Camera & GPS Info

Categories

  • 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
  • Web Tools
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

Recent News

Install Portainer on Ubuntu 24.04 Using Docker Compose

Install Portainer on Ubuntu 24.04 Using Docker Compose

FortiGate Country Address Object Generator – Block or Allow Access by Country

FortiGate Country Address Object Generator – Block or Allow Access by Country

  • 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
    • Bash Scripts
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
  • Web Tools

© 2025 defencedev.com - All rights reserved.