OpenWRT域名劫持

原文连接OPENWRT自定义挟持域名 - CSDN未验证

安装ebtables

路由器连接上网络

opkg update
opkg install kmod-ebtables-ipv4
opkg install ebtables-utils

配置防火墙

使用ebtables将OSI二层数据重定向到OSI三层

ebtables -t broute -A BROUTING -p ipv4 --ip-proto udp --ip-dport 53 -j redirect

使用iptables将所有53端口的数据都DNAT到中继器本地DNS服务器

iptables -t nat -A PREROUTING -p udp -m udp --dport 53 -j DNAT --to-destination 192.168.7.106

此时,DNS劫持已经完成。

最后添加本地域名解析到/etc/hosts,重启dns。这样就可以像市面上的中继器一样,通过域名访问中继器web了。

echo "192.168.7.106 dengxinfa.com" >> /etc/hosts
/etc/init.d/dnsmasq restart
posted @ 2022-07-18 14:23  爱弹钢琴的卡农  阅读(3843)  评论(0)    收藏  举报