|
|
本帖最后由 99010 于 2024-9-24 18:18 编辑
下载中国IP段- wget http://www.ipdeny.com/ipblocks/data/countries/cn.zone
复制代码 创建IP集- uci add firewall ipset
- uci set firewall.@ipset[-1].name='CN_ip'
- uci set firewall.@ipset[-1].match='ip'
- uci set firewall.@ipset[-1].family='ipv4'
- uci set firewall.@ipset[-1].loadfile='/root/cn.zone'
- uci commit firewall
复制代码 允许IP集通过- uci add firewall rule
- uci set firewall.@rule[-1].name='123'
- uci set firewall.@rule[-1].src='lan'
- uci set firewall.@rule[-1].ipset='CN_ip'
- uci set firewall.@rule[-1].family='ipv4'
- uci set firewall.@rule[-1].target='ACCEPT'
- uci commit firewall
复制代码 拒绝非IP集通过- uci add firewall rule
- uci set firewall.@rule[-1].name='456'
- uci set firewall.@rule[-1].src='lan'
- uci set firewall.@rule[-1].family='ipv4'
- uci set firewall.@rule[-1].target='DROP'
- uci commit firewall
复制代码
重启防火墙
|
|