Files
win-dhcpd/dhcpd.yaml.example
Your Name ea8eb2b5f9 feat: WinDHCPD — Windows-native DHCP server
Python 3 + Scapy DHCP server with:
- Full DORA handshake (DISCOVER/OFFER/REQUEST/ACK)
- Multi-scope support with DHCP relay
- Static MAC-to-IP bindings
- Lease persistence (JSON) with auto-prune
- NACK for invalid requests
- Flask web management panel (dark theme, live refresh)
- Admin-privileged scapy sniff on UDP 67
2026-07-13 16:22:19 +08:00

78 lines
3.3 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# =============================================================================
# WinDHCPD 配置文件
# =============================================================================
# 用法: 将此文件保存为 dhcpd.yaml,修改后运行 python run.py dhcpd.yaml
#
# 注意:
# - 本服务器通过 scapy 以混杂模式捕获并发送以太网帧,需要管理员权限。
# - Windows 上需安装 Npcap (带 "WinPcap API-compatible" 选项) 供 scapy 使用。
# - 同一网段只能有一个 DHCP 服务器,否则客户端可能获取到错误 IP。
# - 不要与 Windows 内置 DHCP Server 服务共用网段。
# =============================================================================
# ── 服务器基本设置 ────────────────────────────────────────────────────────
server:
# DHCP 服务器本身的 IP 地址(响应包中的 siaddr / server_id
ip: "192.168.1.1"
# ── 作用域 (Scopes) ──────────────────────────────────────────────────────
# 每个作用域 = 一个网段 + 一个 IP 地址池
# 多个作用域可以实现多网段 DHCP(需配置 relay)
scopes:
- name: "Office-LAN"
# 网段,格式 network/prefix
network: "192.168.1.0/24"
# 地址池起止
start_ip: "192.168.1.100"
end_ip: "192.168.1.200"
# 子网掩码
subnet_mask: "255.255.255.0"
# 默认网关
router: "192.168.1.1"
# DNS 服务器(可填多个)
dns_servers:
- "8.8.8.8"
- "114.114.114.114"
# 租期(秒)
lease_seconds: 86400 # 24 小时
# 域名
domain: "local"
# 启用/禁用
enable: true
# # 示例:第二个作用域
# - name: "Guest-LAN"
# network: "192.168.2.0/24"
# start_ip: "192.168.2.50"
# end_ip: "192.168.2.150"
# subnet_mask: "255.255.255.0"
# router: "192.168.2.1"
# dns_servers: ["8.8.8.8"]
# lease_seconds: 3600
# domain: "guest"
# enable: true
# ── 静态绑定 ─────────────────────────────────────────────────────────────
# 为特定 MAC 地址固定分配指定 IP
bindings:
- mac: "aa:bb:cc:dd:ee:01"
ip: "192.168.1.10"
scope: "Office-LAN"
hostname: "printer"
- mac: "aa:bb:cc:dd:ee:02"
ip: "192.168.1.11"
scope: "Office-LAN"
hostname: "nas"
# ── 日志 ─────────────────────────────────────────────────────────────────
log_file: "dhcpd.log"
log_level: "INFO" # DEBUG / INFO / WARNING / ERROR
# ── Web 管理面板 ─────────────────────────────────────────────────────────
web_host: "0.0.0.0"
web_port: 8080
# ── 网络接口 ─────────────────────────────────────────────────────────────
# 留空则 scapy 自动选择; 指定则只监听该网卡
# interface: "Ethernet"