OpenWRT dnsmasq-full配置

此配置dnsmasq的主要作用是ipset需要代理的域名,传递给iptables使用。

dnsmasq-full安装

openwrt的默认dnsmasq并不支持ipset,需要安装dnsmasq-full版本。ipset是为了支持对域名的转发代理,而chinadns是对ip进行转发代理。所以如果你选择域名匹配的方式走代理,则需要安装dnsmasq-full版本。这里就有了一个问题,当卸载dnsmasq之后,无法解析域名,也就无法安装dnsmasq-full了。这里需要卸载和安装同步进行以避免此类问题。代码如下:

opkg remove dnsmasq && opkg install dnsmasq-full

OpenWRT dnsmasq-full配置

mkdir -p /etc/dnsmasq.d

uci add_list dhcp.@dnsmasq[0].confdir=/etc/dnsmasq.d
uci commit dhcp
uci get dhcp.@dnsmasq[0].confdir

dnsmasq-full配置文件下载

cd /etc/dnsmasq.d && wget https://cokebar.github.io/gfwlist2dnsmasq/dnsmasq_gfwlist_ipset.conf

#若下载错误,请安装
opkg install libustream-mbedtls coreutils-base64 ca-certificates ca-bundle

dnsmasq_gfwlist_ipset.conf的每条命令是这样

server=/hp.com/127.0.0.1#5353
ipset=/hp.com/gfwlist

如果使用DNS-Forwarder转发,请填写相应端口,比如#5353

ipset后面的gfwlist要和下面的防火墙iptables命令行相对应。

by itgeeker.net
# 重启dnsmasq
/etc/init.d/dnsmasq restart

评论

《“OpenWRT dnsmasq-full配置”》 有 1 条评论

回复 树莓派刷原生OpenWRT 安装V2ray作为旁路由(网关或透明代理)让全屋免配置走代理 – ITGeeker技术奇客 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

奇客罗方公众号 奇客罗方小程序 奇客罗方客服 ITGeeker Telegram

网站由ITGeeker技术奇客开发并管理;隶属于GeekerCloud奇客罗方智能科技
Site designed and developed by ITGeekerwhich is a sub-website of GeekerCloud
网站地图 | 沪ICP备2021031434号-4