openwrt 中使用uci 设置防火墙规则 1
openwrt 使用 uci 软件实现对系统的配置。UCI的配置文件全部存储在/etc/config目录下。需要记住。使用 uci 设置后,必须调用uci commit firewall配置才会生效root@OpenWrt:/# ls /etc/config/dhcp dropbear firewall network system wireless更多内容请参考 : http://
·
openwrt 使用 uci 软件实现对系统的配置。
UCI的配置文件全部存储在/etc/config目录下。
需要记住。使用 uci 设置后,必须调用
uci commit firewall
配置才会生效
root@OpenWrt:/# ls /etc/config/
dhcp dropbear firewall network system wireless
更多内容请参考 : http://ingchuang.com/article/217
本文着重讲解防火墙设置。
防火墙的配置文件位于 /etc/config/firewall
例如。我们要让自己能ping到别人。但是让别人ping不通自己
对于ping这个协议,进来的为8(ping),出去的为0(响应).
由于openwrt的防火墙默认是全堵我们为了达到目的,需要禁止8进来
所以。我们需要在 firewall 文件中新增加这样的一条规则:
config rule 'myrule'
option name 'ping'
option proto 'icmp'
option dest_port '8'
option src '*'
option target 'REJECT'
使用 uci 命令,则应当做如下操作
#增加节点
uci set firewall.myrule=rule
uci set firewall.myrule.name=ping
uci set firewall.myrule.proto=icmp
uci set firewall.myrule.dest_port=8
uci set firewall.myrule.target=REJECT
uci set firewall.myrule.src=*
uci commit firewall
/etc/init.d/firewall restart更多推荐
所有评论(0)