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:
DHCP Service Bot
2026-07-09 17:09:23 +08:00
commit 90736253b1
18 changed files with 2192 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
{% extends "base.html" %}
{% block title %}静态绑定{% endblock %}
{% block content %}
<div class="page-head">
<h1>静态绑定(host 声明)</h1>
{% if is_admin %}<a href="{{ url_for('host_new') }}" class="btn btn-primary">+ 新增绑定</a>{% endif %}
</div>
{% if hosts %}
<table class="data-table">
<thead>
<tr>
<th>主机名</th>
<th>MAC</th>
<th>固定 IP</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{% for h in hosts %}
<tr>
<td><strong>{{ h.name }}</strong></td>
<td><code>{{ h.mac }}</code></td>
<td><code>{{ h.ip }}</code></td>
<td class="actions">
{% if is_admin %}
<a href="{{ url_for('host_edit', name=h.name) }}" class="btn btn-sm">编辑</a>
<form method="post" action="{{ url_for('host_delete', name=h.name) }}"
onsubmit="return confirm('确认删除 host {{ h.name }}');" style="display:inline">
<button type="submit" class="btn btn-sm btn-danger">删除</button>
</form>
{% else %}<span class="muted"></span>{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div class="card empty">
<p>暂无静态绑定</p>
{% if is_admin %}<a href="{{ url_for('host_new') }}" class="btn btn-primary">+ 新增第一个</a>{% endif %}
</div>
{% endif %}
{% endblock %}