Initial commit: DHCP Web Manager
Flask-based web UI for managing ISC DHCP server (dhcpd). Features: - subnet / static host binding CRUD via web - listen interface configuration (INTERFACESv4) - active lease query + pool utilization stats - service status, reload/restart, syntax check - user auth + operation logs - automatic backup before each config change - safe change pipeline: write file → dhcpd -t → systemctl restart + is-active verify - error messages include journalctl tail for diagnosis
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}服务配置{% endblock %}
|
||||
{% block content %}
|
||||
<div class="page-head">
|
||||
<h1>服务配置</h1>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>服务状态</h2>
|
||||
<p>
|
||||
状态:
|
||||
{% if svc.active %}
|
||||
<span class="badge badge-ok">● 运行中</span>
|
||||
{% else %}
|
||||
<span class="badge badge-warn">○ 未运行</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
{% if svc.status_text %}
|
||||
<pre class="code-block small">{{ svc.status_text }}</pre>
|
||||
{% endif %}
|
||||
<form method="post" style="display:inline">
|
||||
<input type="hidden" name="action" value="reload">
|
||||
<button type="submit" class="btn">reload(不丢连接)</button>
|
||||
</form>
|
||||
<form method="post" style="display:inline"
|
||||
onsubmit="return confirm('重启 dhcpd 会中断当前所有租约续约,确定?');">
|
||||
<input type="hidden" name="action" value="restart">
|
||||
<button type="submit" class="btn btn-warn">restart</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>语法检查</h2>
|
||||
{% if syntax_ok %}
|
||||
<p class="ok-text">✓ 配置语法 OK</p>
|
||||
{% else %}
|
||||
<p class="error-text">✗ 配置语法错误</p>
|
||||
{% endif %}
|
||||
{% if syntax_msg %}
|
||||
<pre class="code-block small">{{ syntax_msg }}</pre>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>监听接口</h2>
|
||||
<p class="muted small">空格分隔多个接口,留空表示监听所有(生产环境强烈建议指定具体接口)</p>
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="save_interfaces">
|
||||
<label>INTERFACESv4
|
||||
<input type="text" name="interfaces" value="{{ ifaces|join(' ') }}"
|
||||
placeholder="例如: enp0s31f6 或留空">
|
||||
</label>
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-primary">保存(将重启 dhcpd)</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>当前 dhcpd.conf</h2>
|
||||
<pre class="code-block">{{ conf }}</pre>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user