From LedHed's Wiki
Revision as of 23:14, 2 December 2020 by Ledhed (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

Some useful CLI commands for OpenWRT


Packages

Update Package List

opkg update


Install Package

opkg install nano


Remove Package

opkg remove nano


Firewall

Firewall Config File

/etc/config/firewall


Enable/Disable firewall rule

uci set firewall.@rule[xxx].enabled=0

Where xxx = the rule number


Firewall Rule Example

/etc/config/firewall

config rule
        option target 'ACCEPT'
        option src 'wan'
        option proto 'tcp'
        option dest_port '22'
        option name 'WAN SSH'


Reload the firewall after a change

fw3 reload



Reference

https://forum.openwrt.org/t/how-to-enable-disable-a-traffic-rule-from-the-shell/22611

https://openwrt.org/docs/guide-user/base-system/uci

https://openwrt.org/docs/guide-user/firewall/firewall_configuration