Skip to content

lcajigasm/NetworkServices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

NetworkServices

Overview

NetworkServices is a Bash script designed to automate the installation and configuration of network services (DHCP and DNS) on Ubuntu servers. The script provides an interactive menu (in Spanish) to manage network interfaces, DHCP scopes, static IP assignments, DNS zones, and more.

This script has been updated for Ubuntu 18.04 and later, including Ubuntu 24.04 LTS.

Features

  • Configure network interfaces using Netplan (modern Ubuntu network configuration).
  • Install and manage ISC DHCP server (isc-dhcp-server).
  • Install and manage Bind9 DNS server (bind9).
  • Interactive configuration of DHCP scopes and static IPs.
  • Interactive configuration of DNS zones, forwarders, and records.
  • View and reset configuration files for DHCP and DNS.
  • All service management uses systemctl for compatibility with modern Ubuntu.

Requirements

  • Ubuntu 18.04 LTS or newer (tested on Ubuntu 24.04 LTS).
  • Run the script as root (administrator privileges required).
  • Internet connection for package installation.

Usage

  1. Run as root:
    sudo bash NetworkServices.sh
  2. Follow the interactive menu:
    • The menu and prompts are in Spanish.
    • You can configure network interfaces, install/uninstall DHCP and DNS, define scopes/zones, and view configuration files.

Main Menu Options

Option Description
1 View network interfaces
2 Reset persistent network interface names and reboot
3 Configure network interfaces (Netplan)
4 Install DHCP server
5 Uninstall DHCP server
6 Configure DHCP interfaces
7 Reset DHCP scope/static file
8 Add DHCP scope
9 Add static IP to DHCP
10 Install DNS server
11 Uninstall DNS server
12 Configure DNS forwarders
13 Define DNS zones
14 View configuration files
0 Exit

Network Configuration (Netplan)

The script generates /etc/netplan/01-network-services.yaml for static IP configuration. You will be prompted for interface name, IP address (with CIDR), gateway, and DNS servers. The configuration is applied using netplan apply.

DHCP Server

  • Installs isc-dhcp-server and allows interactive configuration of scopes and static IPs.
  • Configuration files:
    • /etc/default/isc-dhcp-server (interfaces)
    • /etc/dhcp/dhcpd.conf (scopes and statics)

DNS Server

  • Installs bind9 and allows interactive configuration of zones, forwarders, and records.
  • Configuration files:
    • /etc/bind/named.conf.options (forwarders)
    • /etc/bind/named.conf.local (zones)
    • /etc/bind/zonas/ (zone files)

Notes

  • The script is interactive and intended for manual use by system administrators.
  • All prompts and menu options are in Spanish.
  • For automation or scripting, consider adapting the functions to accept arguments.

Author & License

Changelog

  • 2025: Updated for Ubuntu 24.04 LTS, Netplan support, systemctl usage, improved documentation.

About

Shell script for install and configure DHCP and DNS services on a Ubuntu server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages