openwrt 23.05 nftables dnsmasq一点点配置

前段又买了间屋,没钱了,还消费个毛啊。把旧的netgear 3700拿出来用。当时openwrt是15.0几的固件,下了个23.05直接刷,死了。

根据https://openwrt.org/toh/netgear/wndr3700 讲得救砖说明下载
factory 固件。电脑连着路由器,设固定ip,开两个cmd,一个ping 192.168.1.1 -t ,另一个准备tftp put 固件。按着reset开机,等到ping那个窗口稳定输出了,松开reset,就按第二个窗口的回车,一秒钟就传进去了,等几分钟路由器就回来了。

23.05全新界面,设置也没什么,ssh 进去iptable没有?查了下改成nftable了。研究了两天,比iptable简单一点点。

1、先把nft相关的ipk都装上。

2、dnsmasq升级到2.89

wget https://downloads.openwrt.org/snapshots/packages/mips_24kc/base/libubox20230523_2023-05-23-75a3b870-1_mips_24kc.ipk
wget https://downloads.openwrt.org/snapshots/packages/mips_24kc/base/libubus20230605_2023-06-05-f787c97b-1_mips_24kc.ipk
wget https://downloads.openwrt.org/snapshots/packages/mips_24kc/base/dnsmasq-full_2.89-4_mips_24kc.ipk

nano /etc/dnsmasq.d/xbox.conf 这里要改成这样

server=/xb1.mixer.com/127.0.0.1#1053
nftset=/xb1.mixer.com/4#inet#fw4#xboxlist

nano /etc/config/dhcp 由于dnsmasq.conf里写dnsmasq.d会出错就放到这里

config dnsmasq
option localise_queries '1'
option rebind_protection '1'
option rebind_localhost '1'
option local '/lan/'
option domain 'lan'
option expandhosts '1'
option readethers '1'
option leasefile '/tmp/dhcp.leases'
option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
option localservice '1'
option ednspacket_max '1232'
option confdir '/etc/dnsmasq.d'
option boguspriv '0'

 

3、nano /usr/share/nftables.d/table-pre/20-gfwset.nft 没有这个文件夹建一个,有啥用wiki里有,添加

set xboxlist {
type ipv4_addr;
timeout 24h;
size 65536;
}

nano /etc/nftables.d/10-custom-filter-chains.nft 这个文件本来就有,最后添加

chain xboxchain {
type nat hook prerouting priority -100; policy accept;
ip daddr @xboxlist meta l4proto tcp redirect to :1080
}

 

重启下路由器就行了

发表评论