2025年7月13日星期日

Replace OpenWrt DHCP and DNS Servers with Kea DHCP4 and BIND9

This guide explains how to replace the default OpenWrt DHCP and DNS servers with Kea DHCP4 and BIND9.


1. Install BIND and Kea DHCP4

opkg update
opkg install bind-server bind-check bind-dnssec bind-tools kea-dhcp4

2. Remove OpenWrt's default dnsmasq and odhcpd-ipv6only

opkg remove dnsmasq odhcpd-ipv6only
uci -q delete dhcp.@dnsmasq[0]
uci commit dhcp

3. Install and Configure Kea DHCP4

Copy init script and configuration file:

cp ./kea-dhcp4/etc/init/kea-dhcp4 /etc/init/
cp ./kea-dhcp4/etc/kea/kea-dhcp4.conf /etc/kea/

Edit the DHCP server configuration:

vim /etc/kea/kea-dhcp4.conf

Start and enable Kea DHCP4 service:

/etc/init.d/kea-dhcp4 start
/etc/init.d/kea-dhcp4 enable

4. Configure BIND9 DNS Server

Edit the main configuration:

cp ./bind/etc/bind/named.conf /etc/bind/
vim /etc/bind/named.conf

(Optional) Edit zone files:

vim /etc/bind/db.liuyu.dns
vim /etc/bind/db.192.168.1

5. Configure OpenWrt to use local BIND DNS Server

Set WAN DNS to localhost:

uci set network.wan.dns='127.0.0.1'
uci commit network

6. Start and enable BIND service

/etc/init.d/named start
/etc/init.d/named enable

7. Other useful commands

Restart services if needed:

service kea-dhcp4 restart
service named restart

This setup replaces the default dnsmasq with a more flexible and robust Kea DHCP4 and BIND9 combination.

GitHub Repository: https://github.com/liuyuf78fk/isc-openwrt

没有评论:

发表评论

TL-XDR5480 WPA2/WPA3混合模式存在WPA3 SAE认证异常

平时经常遇到手机一开始连接正常,但是用了一段时间,比如用了2天,iphone会提示无法加入网络。 重启iPhone无法恢复 修改iPhone私有Wi-Fi地址(更换一个MAC地址)后立即恢复 终端 iphone8 iphone15pro ipad9代都遇到过。 无线...