### Install adblock-fast and luci-app-adblock-fast on OpenWrt Source: https://docs.openwrt.melmac.ca/adblock-fast This command installs the core `adblock-fast` package and its LuCI web interface application `luci-app-adblock-fast`. It first updates the package list and then proceeds with the installation. ```shell opkg update; opkg install adblock-fast luci-app-adblock-fast ``` -------------------------------- ### Install VPN Policy Routing Packages (OpenWrt) Source: https://docs.openwrt.melmac.ca/vpn-policy-routing Installs the `vpn-policy-routing` and `luci-app-vpn-policy-routing` packages on an OpenWrt system using opkg. This command updates the package list and then installs the specified packages. ```bash opkg update opkg install vpn-policy-routing luci-app-vpn-policy-routing ``` -------------------------------- ### Install dnsmasq-full and ipset for DNSMASQ ipset Option Source: https://docs.openwrt.melmac.ca/simple-adblock This sequence of commands updates the package list, downloads `dnsmasq-full`, installs it along with `ipset` and related libraries, removes the standard `dnsmasq` package, and then installs `dnsmasq-full` from the cache. This setup is necessary for the `dnsmasq.ipset` option, which enables blocking ads served over HTTPS. ```bash opkg update; cd /tmp/ && opkg download dnsmasq-full; opkg install ipset libnettle8 libnetfilter-conntrack3; opkg remove dnsmasq; opkg install dnsmasq-full --cache /tmp/; rm -f /tmp/dnsmasq-full*.ipk; ``` -------------------------------- ### Force Install with Dependency Ignored (OpenWrt) Source: https://docs.openwrt.melmac.ca/vpn-policy-routing Installs the `luci-app-vpn-policy-routing` package while ignoring missing dependencies, specifically useful for older OpenWrt versions where `luci-compat` might be missing. This command should be used with caution. ```bash opkg install --force-depends luci-app-vpn-policy-routing ``` -------------------------------- ### Install Recommended Packages for Faster Block-list Processing Source: https://docs.openwrt.melmac.ca/simple-adblock This command installs `gawk`, `grep`, `sed`, and `coreutils-sort` with the `--force-overwrite` option. These packages are optional but highly recommended as they significantly speed up the processing of block-lists. ```bash opkg --force-overwrite install gawk grep sed coreutils-sort ``` -------------------------------- ### Install OpenWrt Required Packages Source: https://docs.openwrt.melmac.ca/vpn-policy-routing Installs essential packages for OpenWrt services, including ipset, resolveip, ip-full, kmod-ipt-ipset, and iptables. This command first updates the package list and then installs the specified packages. ```bash opkg update; opkg install ipset resolveip ip-full kmod-ipt-ipset iptables ``` -------------------------------- ### mwan3 to mwan4 Example Migration Source: https://docs.openwrt.melmac.ca/mwan4 Compares a typical mwan3 interface configuration with its automatically migrated mwan4 equivalent, showing changes in `flush_conntrack` and the addition of `family`. ```uci # mwan3 config: config interface 'wan' option enabled '1' list track_ip '1.1.1.1' option flush_conntrack 'always' # mwan4 config (after automatic migration): config interface 'wan' option enabled '1' list family 'ipv4' list track_ip '1.1.1.1' list flush_conntrack 'ifup' list flush_conntrack 'ifdown' ``` -------------------------------- ### Install Simple AdBlock and luci-app-simple-adblock Source: https://docs.openwrt.melmac.ca/simple-adblock This command updates the package list and installs the `simple-adblock` package along with its LuCI web interface application `luci-app-simple-adblock`. These are the core packages for the ad-blocking service. ```bash opkg update; opkg install simple-adblock luci-app-simple-adblock ``` -------------------------------- ### Check adblock-fast Package Installation (opkg/apk) Source: https://docs.openwrt.melmac.ca/adblock-fast These commands check the installed versions of the 'adblock-fast' package and its related components on an OpenWrt device using either the 'opkg' or 'apk' package managers. This is useful for diagnosing internal version mismatches in the WebUI. ```shell command -v opkg > /dev/null 2>&1 && opkg list-installed | grep adblock-fast command -v apk > /dev/null 2>&1 && apk list --installed | grep adblock-fast ``` -------------------------------- ### Force Install WLAN Blinker (OpenWrt - Older Versions) Source: https://docs.openwrt.melmac.ca/wlanblinker Installs the `luci-app-wlanblinker` package, forcing the installation even if the `luci-compat` dependency is reported as missing. This is typically used on older OpenWrt versions or systems that have diverged from official releases. ```shell opkg install --force-depends luci-app-wlanblinker ``` -------------------------------- ### Force Install vpnbypass with Ignored Dependencies on OpenWrt Source: https://docs.openwrt.melmac.ca/vpnbypass Force installs the vpnbypass LuCI application on older OpenWrt systems (prior to 18.06.6) where 'luci-compat' might be missing. Use with caution. ```bash opkg install --force-depends luci-app-vpnbypass ``` -------------------------------- ### Start antminer-monitor service Source: https://docs.openwrt.melmac.ca/antminer-monitor This snippet demonstrates how to start the antminer-monitor service either through the Web UI or via an SSH session using the init.d script. This command assumes the service has been successfully installed. ```bash /etc/init.d/antminer-monitor start ``` -------------------------------- ### Install Wireshark Helper Packages on OpenWrt Source: https://docs.openwrt.melmac.ca/wireshark-helper Installs the necessary packages for the Wireshark helper service on an OpenWrt router. This command updates the package list and then installs the `wireshark-helper` and `luci-app-wireshark-helper` packages. ```shell opkg update; opkg install wireshark-helper luci-app-wireshark-helper ``` -------------------------------- ### Install vpnbypass and luci-app-vpnbypass on OpenWrt Source: https://docs.openwrt.melmac.ca/vpnbypass Installs the vpnbypass package and its LuCI web interface companion for OpenWrt via SSH. This command assumes the package is available in the official repositories. ```bash opkg update opkg install vpnbypass luci-app-vpnbypass ``` -------------------------------- ### Install curl for File Scheme Requirements Source: https://docs.openwrt.melmac.ca/simple-adblock This command updates the package list and installs the `curl` package, which is required for using local files as allow-lists or block-lists with the file:// scheme. ```bash opkg update; opkg install curl; ``` -------------------------------- ### OpenWrt Policy Routing Examples Source: https://docs.openwrt.melmac.ca/pbr Demonstrates various OpenWrt policy routing configurations using UCI syntax. These examples cover routing based on single IP, IP range, MAC address, local machine names, specific ports (SIP), services (Plex, Emby), and domain names (Netflix). ```uci config policy option name 'Local IP' option interface 'wan' option src_addr '192.168.1.70' config policy option name 'Local Subnet' option interface 'wan' option src_addr '192.168.1.81/29' config policy option name 'Local Machine' option interface 'wan' option src_addr 'dell-ubuntu' config policy option name 'Local MAC Address' option interface 'wan' option src_addr '00:0F:EA:91:04:08' config policy option name 'Local Devices' option interface 'wan' option src_addr '192.168.1.70 192.168.1.81/29 dell-ubuntu 00:0F:EA:91:04:08' config policy option name 'SIP Ports' option interface 'wan' option dest_port '5060' option proto 'tcp udp' config policy option name 'Plex Local Server' option interface 'wan' option src_port '32400' config policy option name 'Plex Remote Servers' option interface 'wan' option dest_addr 'plex.tv my.plexapp.com' config policy option name 'Emby Local Server' option interface 'wan' option src_port '8096 8920' config policy option name 'Emby Remote Servers' option interface 'wan' option dest_addr 'emby.media app.emby.media tv.emby.media' config policy option name 'Netflix Domains' option interface 'wan' option dest_addr 'amazonaws.com netflix.com nflxext.com nflximg.net nflxso.net nflxvideo.net dvd.netflix.com' ``` -------------------------------- ### Install IPv6 Support Packages Source: https://docs.openwrt.melmac.ca/simple-adblock These commands update the package list and install `ip6tables-mod-nat` and `kmod-ipt-nat6`, which are required for enabling IPv6 support in the Simple AdBlock service. ```bash opkg update; opkg install ip6tables-mod-nat kmod-ipt-nat6; ``` -------------------------------- ### Install WLAN Blinker Packages (OpenWrt) Source: https://docs.openwrt.melmac.ca/wlanblinker Installs the `wlanblinker` and `luci-app-wlanblinker` packages on an OpenWrt router. This requires updating the package list first. Ensure your router has access to the official OpenWrt repositories or a custom repository if packages are not found. ```shell opkg update opkg install wlanblinker luci-app-wlanblinker ``` -------------------------------- ### Install antminer-monitor using opkg Source: https://docs.openwrt.melmac.ca/antminer-monitor This snippet shows the commands to update the package list and install the antminer-monitor package using the opkg package manager on OpenWrt. Ensure your router meets the memory requirements (128MB recommended) and that the necessary repositories are configured. ```bash opkg update opkg install antminer-monitor ``` -------------------------------- ### Install https-dns-proxy and luci-app-https-dns-proxy Source: https://docs.openwrt.melmac.ca/https-dns-proxy Installs the https-dns-proxy service and its optional LuCI web interface for OpenWrt. This command first updates the package list and then installs the specified packages. ```shell opkg update; opkg install https-dns-proxy luci-app-https-dns-proxy; ``` -------------------------------- ### OpenWrt Dnsmasq Server Configuration Example Source: https://docs.openwrt.melmac.ca/https-dns-proxy This example demonstrates how to configure dnsmasq server entries within the OpenWrt configuration. It shows how to specify custom server settings, including IP addresses and ports, and how these entries are preserved even when dnsmasq configuration is updated by the service. ```uci list server '/onion/127.0.0.1#65453' list server '/openwrt.org/8.8.8.8' list server '/pool.ntp.org/8.8.8.8' list server '127.0.0.1#15353' list server '127.0.0.1#55353' list server '127.0.0.1#65353' ``` -------------------------------- ### Enable VPN Policy Routing Service (UCI) Source: https://docs.openwrt.melmac.ca/vpn-policy-routing Enables the VPN policy routing service using the UCI command-line interface. This is an alternative to using the Web UI to start the service. ```bash uci set vpn-policy-routing.config.enabled=1 uci commit vpn-policy-routing ``` -------------------------------- ### OpenWrt Configuration File Example Source: https://docs.openwrt.melmac.ca/https-dns-proxy This snippet shows the structure of the OpenWrt configuration file, defining main settings and multiple instances of the https-dns-proxy service with different configurations. ```uci config main 'config' option canary_domains_icloud '1' option canary_domains_mozilla '1' option dnsmasq_config_update '*' option force_dns '1' list force_dns_port '53' list force_dns_port '853' list force_dns_src_interface 'lan' option procd_trigger_wan6 '0' option heartbeat_domain 'heartbeat.melmac.ca' option heartbeat_sleep_timeout '10' option heartbeat_wait_timeout '10' option user 'nobody' option group 'nogroup' option listen_addr '127.0.0.1' config https-dns-proxy option bootstrap_dns '1.1.1.1,1.0.0.1' option resolver_url 'https://cloudflare-dns.com/dns-query' option listen_port '5053' config https-dns-proxy option bootstrap_dns '8.8.8.8,8.8.4.4' option resolver_url 'https://dns.google/dns-query' option listen_port '5054' ``` -------------------------------- ### System Log Example: Mounting Alternative Partition Source: https://docs.openwrt.melmac.ca/luci-app-advanced-reboot This log snippet shows the process of mounting an alternative partition (mtd6) on a NAND router to retrieve firmware information. It includes kernel messages about UBI device attachment, UBIFS mounting, and subsequent unmounting. ```log Tue Nov 19 15:45:03 2019 user.notice luci-app-advanced-reboot: attempting to mount alternative partition (mtd6) Tue Nov 19 15:45:03 2019 kern.notice kernel: [30392.673826] ubi2: attaching mtd6 Tue Nov 19 15:45:03 2019 kern.notice kernel: [30392.876698] ubi2: scanning is finished Tue Nov 19 15:45:03 2019 kern.notice kernel: [30392.885267] ubi2: attached mtd6 (name "rootfs1", size 74 MiB) Tue Nov 19 15:45:03 2019 kern.notice kernel: [30392.891063] ubi2: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes Tue Nov 19 15:45:03 2019 kern.notice kernel: [30392.898011] ubi2: min./max. I/O unit sizes: 2048/2048, sub-page size 2048 Tue Nov 19 15:45:03 2019 kern.notice kernel: [30392.904878] ubi2: VID header offset: 2048 (aligned 2048), data offset: 4096 Tue Nov 19 15:45:03 2019 kern.notice kernel: [30392.911928] ubi2: good PEBs: 592, bad PEBs: 0, corrupted PEBs: 0 Tue Nov 19 15:45:03 2019 kern.notice kernel: [30392.917962] ubi2: user volume: 2, internal volumes: 1, max. volumes count: 128 Tue Nov 19 15:45:03 2019 kern.notice kernel: [30392.925252] ubi2: max/mean erase counter: 48/32, WL threshold: 4096, image sequence number: 1659081076 Tue Nov 19 15:45:03 2019 kern.notice kernel: [30392.934623] ubi2: available PEBs: 0, total reserved PEBs: 592, PEBs reserved for bad PEB handling: 40 Tue Nov 19 15:45:03 2019 kern.notice kernel: [30392.944346] ubi2: background thread "ubi_bgt2d" started, PID 26780 Tue Nov 19 15:45:03 2019 kern.info kernel: [30392.952596] block ubiblock2_0: created from ubi2:0 (rootfs) Tue Nov 19 15:45:03 2019 kern.notice kernel: [30392.964083] UBIFS (ubi2:1): background thread "ubifs_bgt2_1" started, PID 26787 Tue Nov 19 15:45:03 2019 kern.notice kernel: [30393.009298] UBIFS (ubi2:1): UBIFS: mounted UBI device 2, volume 1, name "rootfs_data" Tue Nov 19 15:45:03 2019 kern.notice kernel: [30393.017185] UBIFS (ubi2:1): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes Tue Nov 19 15:45:03 2019 kern.notice kernel: [30393.027213] UBIFS (ubi2:1): FS size: 61075456 bytes (58 MiB, 481 LEBs), journal size 3047424 bytes (2 MiB, 24 LEBs) Tue Nov 19 15:45:03 2019 kern.notice kernel: [30393.037733] UBIFS (ubi2:1): reserved for root: 2884744 bytes (2817 KiB) Tue Nov 19 15:45:03 2019 kern.notice kernel: [30393.044389] UBIFS (ubi2:1): media format: w4/r0 (latest is w5/r0), UUID 76F0C52C-6197-4E00-B306-747262B06545, small LPT model Tue Nov 19 15:45:03 2019 user.notice luci-app-advanced-reboot: attempting to unmount alternative partition (mtd6) Tue Nov 19 15:45:03 2019 kern.notice kernel: [30393.132743] UBIFS (ubi2:1): un-mount UBI device 2 Tue Nov 19 15:45:03 2019 kern.notice kernel: [30393.137481] UBIFS (ubi2:1): background thread "ubifs_bgt2_1" stops Tue Nov 19 15:45:03 2019 kern.info kernel: [30393.390961] block ubiblock2_0: released Tue Nov 19 15:45:03 2019 kern.notice kernel: [30393.396576] ubi2: detaching mtd6 Tue Nov 19 15:45:03 2019 kern.notice kernel: [30393.400117] ubi2: mtd6 is detached ``` -------------------------------- ### Create Device Configuration JSON Source: https://docs.openwrt.melmac.ca/luci-app-advanced-reboot This JSON file defines the device model, commands for interacting with the boot environment, and partition details for advanced reboot. It requires specifying vendor, model, board name, MTD identifiers, and label offsets. ```json { "device": { "vendor": "Linksys", "model": "MX4200v1", "board": ["linksys,mx4200v1"] }, "commands": { "params": ["boot_part"], "get": "fw_printenv", "set": "fw_setenv", "save": null }, "partitions": [ { "number": 1, "param_values": ["1"], "mtd": "mtd21", "labelOffsetBytes": 192 }, { "number": 2, "param_values": ["2"], "mtd": "mtd23", "labelOffsetBytes": 192 } ] } ``` -------------------------------- ### Install Netclient Package on OpenWrt Source: https://docs.openwrt.melmac.ca/netclient Installs the Netclient package and updates the package list on an OpenWrt system. This command is essential for setting up the Netclient client for Netmaker networks. ```shell opkg update; opkg install netclient; ``` -------------------------------- ### Install Basic Dependencies for IP/Port VPN Bypass on OpenWrt Source: https://docs.openwrt.melmac.ca/vpnbypass Installs the essential packages required for the IP/Port VPN Bypass feature on OpenWrt, namely ipset and iptables. ```bash opkg update; opkg install ipset iptables ``` -------------------------------- ### Basic OpenVPN Client Config for OpenWrt Source: https://docs.openwrt.melmac.ca/vpn-policy-routing This snippet shows the essential configuration for a basic OpenVPN client on OpenWrt. It includes settings for the VPN interface in `/etc/config/network`, firewall zone and forwarding rules in `/etc/config/firewall`, and the OpenVPN client configuration in `/etc/config/openvpn`. Ensure these settings are applied to a fresh OpenWrt install to avoid conflicts. ```uci config vpn-policy-routing 'config' list supported_interface 'vpnclient' ``` ```uci config interface 'vpnclient' option proto 'none' option ifname 'ovpnc0' ``` ```uci config zone option name 'vpnclient' option network 'vpnclient' option input 'REJECT' option forward 'REJECT' option output 'ACCEPT' option masq '1' option mtu_fix '1' config forwarding option src 'lan' option dest 'vpnclient' ``` ```uci config forwarding option src 'guest' option dest 'vpnclient' ``` ```uci config openvpn 'vpnclient' option enabled '1' option client '1' option dev_type 'tun' option dev 'ovpnc0' ``` -------------------------------- ### Install Full Dependencies for VPN Bypass Features on OpenWrt Source: https://docs.openwrt.melmac.ca/vpnbypass Installs all necessary packages for both IP/Port and Domain VPN Bypass features on OpenWrt, including ipset, iptables, and dnsmasq-full. It also handles the removal of the default dnsmasq package. ```bash opkg update; cd /tmp/ && opkg download dnsmasq-full; opkg install ipset iptables libnettle8 libnetfilter-conntrack3; opkg remove dnsmasq; opkg install dnsmasq-full --cache /tmp/; rm -f /tmp/dnsmasq-full*.ipk; ``` -------------------------------- ### Manage Netifd Support with PBR Service Commands Source: https://docs.openwrt.melmac.ca/pbr Provides commands to manage the netifd support for the PBR package. These commands allow for installation, uninstallation, removal of netifd support, and checking the status of the netifd enabled flag. ```bash service pbr netifd install service pbr netifd uninstall service pbr netifd remove service pbr netifd check ``` -------------------------------- ### Check Installed pbr Package Versions (Shell) Source: https://docs.openwrt.melmac.ca/pbr This command checks for the installed versions of the 'pbr' package and its related luci app using either 'opkg' or 'apk' package managers. It's used to diagnose version mismatches in luci-app-pbr. ```shell command -v opkg > /dev/null 2>&1 && opkg list-installed | grep pbr command -v apk > /dev/null 2>&1 && apk list --installed | grep pbr ``` -------------------------------- ### OpenVPN Client and Server Configuration (OpenWrt) Source: https://docs.openwrt.melmac.ca/vpn-policy-routing Configuration for a local OpenVPN server and an OpenVPN client on an OpenWrt router. This includes settings for `/etc/config/vpn-policy-routing`, `/etc/config/network`, `/etc/config/firewall`, and `/etc/config/openvpn`. The client is set as the default route for internet traffic, and the server handles specific inbound traffic. ```uci # /etc/config/vpn-policy-routing config vpn-policy-routing 'config' list ignored_interface 'vpnserver' ... config policy option name 'OpenVPN Server' option interface 'wan' option proto 'tcp' option src_port '1194' option chain 'OUTPUT' ``` ```uci # /etc/config/network config interface 'vpnclient' option proto 'none' option ifname 'ovpnc0' config interface 'vpnserver' option proto 'none' option ifname 'ovpns0' option auto '1' ``` ```uci # /etc/config/firewall config zone option name 'vpnclient' option network 'vpnclient' option input 'REJECT' option forward 'ACCEPT' option output 'REJECT' option masq '1' option mtu_fix '1' config forwarding option src 'lan' option dest 'vpnclient' config zone option name 'vpnserver' option network 'vpnserver' option input 'ACCEPT' option forward 'REJECT' option output 'ACCEPT' option masq '1' config forwarding option src 'vpnserver' option dest 'wan' config forwarding option src 'vpnserver' option dest 'lan' config forwarding option src 'vpnserver' option dest 'vpnclient' config rule option name 'Allow-OpenVPN-Inbound' option target 'ACCEPT' option src '*' option proto 'tcp' option dest_port '1194' ``` ```uci # /etc/config/openvpn config openvpn 'vpnclient' option client '1' option dev_type 'tun' option dev 'ovpnc0' option proto 'udp' option remote 'some.domain.com 1197' # DO NOT USE PORT 1194 for VPN Client ... config openvpn 'vpnserver' option port '1194' option proto 'tcp' option server '192.168.200.0 255.255.255.0' ... ``` -------------------------------- ### Configure PBR for Older Versions Source: https://docs.openwrt.melmac.ca/pbr For older PBR versions lacking the 'support' command, this sequence sets counters and verbosity to maximum levels for detailed logging. It requires committing the changes to UCI configuration. ```bash uci set pbr.config.nft_rule_counter='1' uci set pbr.config.nft_set_counter='1' uci set pbr.config.verbosity='2' commit pbr ``` -------------------------------- ### Test Partition Switching with ubus Source: https://docs.openwrt.melmac.ca/luci-app-advanced-reboot These `ubus` commands interact with the `luci.advanced-reboot` service to switch the boot partition. Executing these commands will effectively change the boot environment and may reboot the device. Use with caution. ```bash ubus -S call luci.advanced-reboot boot_partition '{ "number": "1" }' ubus -S call luci.advanced-reboot boot_partition '{ "number": "2" }' ```