'use client' import fs from 'fs'; import { exec } from 'child_process'; const dhcpConfigPath = '/etc/dhcp/dhcpd.conf'; // Path to the DHCP server configuration file export function readDhcpConfig() { try { const config = fs.readFileSync(dhcpConfigPath, 'utf8'); return config; } catch (error) { throw new Error('Error reading DHCP configuration file: ' + error.message); } } export function writeDhcpConfig(newConfig) { try { fs.writeFileSync(dhcpConfigPath, newConfig, 'utf8'); } catch (error) { throw new Error('Error writing to DHCP configuration file: ' + error.message); } } export function restartDhcpServer() { exec('sudo systemctl restart isc-dhcp-server', (error, stdout, stderr) => { if (error) { throw new Error(`Error restarting DHCP server: ${stderr}`); } }); }