Loading... # dnsmasq 高级配置 # 一、标签系统 ## 1. 标签工作原理 ```bash # 设置标签 dhcp-range=set:tag1,192.168.1.100,192.168.1.150 dhcp-option=tag:tag1,3,192.168.1.1 # 条件标签 dhcp-option=tag:known,3,192.168.1.1 ``` ## 2. 动态标签 ```bash # 基于厂商的标签 dhcp-vendorclass=set:pxeclient,PXEClient dhcp-option=tag:pxeclient,17,/var/tftpboot ``` # 二、脚本事件 ## 1. DHCP 事件脚本 ```bash # 配置脚本 dhcp-script=/usr/local/bin/dhcp-event.sh # 脚本内容 #!/bin/bash case "$1" in add) logger "New device: $2 ($3)" ;; del) logger "Device left: $2 ($3)" ;; esac ``` # 三、实战案例 ## 1. 多 VLAN 部署 ```bash # VLAN 10 - 办公网络 interface=eth0.10 dhcp-range=eth0.10,192.168.10.100,192.168.10.200,12h dhcp-option=eth0.10,3,192.168.10.1 # VLAN 20 - 客人网络 interface=eth0.20 dhcp-range=eth0.20,192.168.20.100,192.168.20.200,2h dhcp-option=eth0.20,3,192.168.20.1 ``` *** **标签**:dnsmasq、网络技术 最后修改:2026 年 01 月 30 日 © 允许规范转载 赞 如果觉得我的文章对你有用,请随意赞赏