Files
dhcp-service/templates/subnet_form.html
T
DHCP Service Bot 90736253b1 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
2026-07-09 17:09:23 +08:00

60 lines
3.0 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ subnet.name|default('新增') }} · 子网{% endblock %}
{% block content %}
<div class="page-head">
<h1>{% if subnet.network %}编辑子网 {{ subnet.network }}/{{ subnet.netmask }}{% else %}新增子网{% endif %}</h1>
<a href="{{ url_for('subnet_list') }}" class="btn btn-muted">← 返回</a>
</div>
<form method="post" class="card form">
<div class="grid-2">
<label>网络号
<input type="text" name="network" value="{{ form.network or subnet.network }}"
placeholder="192.168.1.0" required pattern="\d{1,3}(\.\d{1,3}){3}">
</label>
<label>子网掩码
<input type="text" name="netmask" value="{{ form.netmask or subnet.netmask }}"
placeholder="255.255.255.0" required pattern="(\d{1,3}(\.\d{1,3}){3})|(\d{1,2})">
<small class="muted">支持 255.255.255.0 或 /24 写法</small>
</label>
<label>默认网关
<input type="text" name="routers" value="{{ form.routers or subnet.routers }}"
placeholder="192.168.1.1" required>
</label>
<label>DNS 服务器
<input type="text" name="dns" value="{{ form.dns or subnet.dns }}"
placeholder="8.8.8.8, 8.8.4.4" required>
<small class="muted">多个用逗号分隔</small>
</label>
<label>地址池起始
<input type="text" name="range_start" value="{{ form.range_start or subnet.range_start }}"
placeholder="192.168.1.100" required>
</label>
<label>地址池结束
<input type="text" name="range_end" value="{{ form.range_end or subnet.range_end }}"
placeholder="192.168.1.200" required>
</label>
<label>默认租期(秒)
<input type="number" name="default_lease" min="60" value="{{ form.default_lease or subnet.default_lease or 600 }}" required>
</label>
<label>最大租期(秒)
<input type="number" name="max_lease" min="60" value="{{ form.max_lease or subnet.max_lease or 7200 }}" required>
</label>
<label>域名(可选)
<input type="text" name="domain_name" value="{{ form.domain_name or subnet.domain_name }}"
placeholder="lan.local">
</label>
<label class="checkbox-row">
<input type="checkbox" name="authoritative"
{% if form.authoritative is defined and form.authoritative %}checked{% endif %}
{% if not form and subnet.authoritative %}checked{% endif %}>
authoritative(本网络唯一 DHCP 服务器)
</label>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">保存并应用</button>
<a href="{{ url_for('subnet_list') }}" class="btn btn-muted">取消</a>
</div>
<p class="muted small">保存将自动校验语法并 reload 服务。</p>
</form>
{% endblock %}