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.
- 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
systemctlfor compatibility with modern Ubuntu.
- 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.
- Run as root:
sudo bash NetworkServices.sh
- 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.
| 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 |
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.
- Installs
isc-dhcp-serverand allows interactive configuration of scopes and static IPs. - Configuration files:
/etc/default/isc-dhcp-server(interfaces)/etc/dhcp/dhcpd.conf(scopes and statics)
- Installs
bind9and 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)
- 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: lcajigasm
- License: MIT
- 2025: Updated for Ubuntu 24.04 LTS, Netplan support, systemctl usage, improved documentation.