Datai.Net Datai.Net

  • Home
  • Webmail
Home / Ubuntu Server / Ubuntu 20.x ~ DHCP Server Setup

Ubuntu 20.x ~ DHCP Server Setup

Netplan.IO Interface Configuration

network:
  ethernets:
    ens3:
      dhcp4: false
      dhcp-identifier: mac

      addresses: [ 10.0.1.10/24 ]
      gateway4: 10.0.1.1
      nameservers:
        addresses: [ 1.1.1.1, 8.8.8.8 ]

  version: 2

Install isc-dhcp-server services

apt -y install isc-dhcp-server

Configure isc-dhcp-server

/etc/default/isc-dhcp-server

# Defaults for isc-dhcp-server (sourced by /etc/init.d/isc-dhcp-server)

# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
DHCPDv4_CONF=/etc/dhcp/dhcpd.conf
DHCPDv6_CONF=/etc/dhcp/dhcpd6.conf

# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPDv4_PID=/var/run/dhcpd.pid
#DHCPDv6_PID=/var/run/dhcpd6.pid

# Additional options to start dhcpd with.
# Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACESv4="ens3"
INTERFACESv6="ens3"

Example configuration for multiple VLANs using DHCP Relay via the router

/etc/dhcp/dhcpd.conf

# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#
# Attention: If /etc/ltsp/dhcpd.conf exists, that will be used as
# configuration file instead of this file.
#

# option definitions common to all supported networks...
option domain-name "lab.lan";
option domain-name-servers 1.1.1.1 8.8.8.8;

default-lease-time 600;
max-lease-time 7200;

# The ddns-updates-style parameter controls whether or not the server will
# attempt to do a DNS update when a lease is confirmed. We default to the
# behavior of the version 2 packages ('none', since DHCP v2 didn't
# have support for DDNS.)
ddns-update-style none;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
#log-facility local7;

## Local LAN Subnet
subnet 10.0.1.0 netmask 255.255.255.0 {
   
}

## VLAN-10
subnet 10.0.10.0 netmask 255.255.255.0 {

    option domain-name "vlan10.lab.lan";
    option routers 10.0.10.1;
    option subnet-mask 255.255.255.0;
    option broadcast-address 10.0.10.255;
    range 10.0.10.50 10.0.10.100;
  
}

## VLAN-20
subnet 10.0.20.0 netmask 255.255.255.0 {

    option domain-name "vlan20.lab.lan";
    option routers 10.0.20.1;
    option subnet-mask 255.255.255.0;
    option broadcast-address 10.0.20.255;
    range 10.0.20.50 10.0.20.100;

}

Restart isc-dhcp-server services

systemctl restart isc-dhcp-server

Juniper vQFX DHCP Relay Configuration Example

set forwarding-options dhcp-relay overrides
set forwarding-options dhcp-relay relay-option
set forwarding-options dhcp-relay relay-option-82
set forwarding-options dhcp-relay server-group DHCP_SERVERS 10.0.1.10
set forwarding-options dhcp-relay active-server-group DHCP_SERVERS

set forwarding-options dhcp-relay group VLAN-10 active-server-group DHCP_SERVERS
set forwarding-options dhcp-relay group VLAN-10 interface irb.10

set forwarding-options dhcp-relay group VLAN-20 active-server-group DHCP_SERVERS
set forwarding-options dhcp-relay group VLAN-20 interface irb.20

 

 

 

dhcpdhcp-relayjuniperlablinuxubuntu Ubuntu Server

Related Articles

  • TACACS+ ~ Linux TACACS+ Authentication using Active Directory
  • Ubuntu 14.04 ~ Setting up a Complete Mail Server
  • Ubuntu ~ GRE Tunnel to Cisco Router
  • 7Networking
  • 4VyOS Router
  • 3Cisco
  • 3Juniper
  • 1BGP
  • 0FRRouting
  • 1IPv6
  • 2Cisco CCNA R&S : 200-125
  • 0Programming
  • 0Python
  • 1PHP
  • 0Bash
  • 0Server Administration
  • 2Linux
  • 0Microsoft Windows
  • 1MySQL Server
  • 4Ubuntu Server
  • 2CentOS Server
  • 2Server 2016
  • 0Server 2019
  Copyright © 2020 | Datai.Net | All Rights Reserved