This shows you the differences between two versions of the page.
Previous revision | |||
— | fuss:openwrt [2025/06/27 23:28] (current) – office | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Creating Packages ====== | ||
+ | |||
+ | Creating packages for '' | ||
+ | |||
+ | <code bash> | ||
+ | cat >> soft/ | ||
+ | Package: soft | ||
+ | Version 0.1 | ||
+ | Architecture: | ||
+ | Maintainer: john < | ||
+ | Section: base | ||
+ | Priority: optional | ||
+ | Description: | ||
+ | Source: http:// | ||
+ | EOF | ||
+ | ipkg-build -o root -g root soft | ||
+ | </ | ||
+ | |||
+ | ====== Create TAP Interface on Boot ====== | ||
+ | |||
+ | OpenWrt scripts can add a TAP interface to a bridge on boot, however tap interfaces are usually created on demand rather than persisting across reboots. To make sure that the TAP interface is brought up on boot, create a script at ''/ | ||
+ | <code bash> | ||
+ | #!/bin/sh / | ||
+ | |||
+ | START=30 | ||
+ | SERVICE_USE_PID=0 | ||
+ | |||
+ | TAP=`ifconfig -a | grep tap0 | wc -l | ||
+ | |||
+ | start() { | ||
+ | if [ $TAP -eq 0 ]; then | ||
+ | ip tuntap add mode tap tap0 | ||
+ | fi | ||
+ | } | ||
+ | |||
+ | stop() { | ||
+ | if [ $TAP -eq 1 ]; then | ||
+ | ip tuntap del mode tap tap0 | ||
+ | fi | ||
+ | } | ||
+ | </ | ||
+ | and possibly change '' | ||
+ | |||
+ | In order to activate the script, issue: | ||
+ | <code bash> | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | The interface should now be created on reboot. | ||
+ | |||
+ | Once TAP interfaces are created the MAC address is randomly generated such that unless you are sending a DHCP client ID, the interface will be difficult to track. To set a permanent MAC address for the TAP interface, edit ''/ | ||
+ | |||
+ | For example, the snippet: | ||
+ | < | ||
+ | config interface ' | ||
+ | option ifname ' | ||
+ | option proto ' | ||
+ | option macaddr ' | ||
+ | </ | ||
+ | |||
+ | configures a TAP interface '' | ||
+ | |||
+ | The configuration combined with the script above work perfectly well together: the script takes care to create the interface and the OpenWrt network configuration will set the MAC address when the interface is brought up. | ||
+ | |||
+ | ====== Fixing Terminal Compatibility Issues with Cygwin ====== | ||
+ | |||
+ | If you access OpenWrt from a cygwin shell, you will notice that running ncurses-based programs (for instance, '' | ||
+ | |||
+ | To resolve the issue, the '' | ||
+ | |||
+ | ====== Making Samba Bind to Interfaces ====== | ||
+ | |||
+ | On OpenWrt version '' | ||
+ | < | ||
+ | interfaces = |INTERFACES| | ||
+ | </ | ||
+ | |||
+ | unfortunately, | ||
+ | |||
+ | Seeing that the interfaces to listen on cannot be configured via LuCi, removing the '' | ||
+ | |||
+ | ====== Getting Python Running Properly ====== | ||
+ | |||
+ | Unfortunately for quite a few releases (LEDE), the python '' | ||
+ | < | ||
+ | pkg_resources.DistributionNotFound: | ||
+ | </ | ||
+ | |||
+ | The solution is to install '' | ||
+ | <code bash> | ||
+ | opkg install python-pip | ||
+ | </ | ||
+ | |||
+ | and then reinstall '' | ||
+ | <code bash> | ||
+ | pip install -U pip setuptools | ||
+ | </ | ||
+ | |||
+ | ====== Routing all Traffic through OpenVPN ====== | ||
+ | |||
+ | TL;DR: old trick, set a lower interface metric for the OpenVPN interface than the default gateway. | ||
+ | |||
+ | Since there does not seem to be an official straightforward answer to route all traffic through OpenVPN "the OpenWrt way" | ||
+ | |||
+ | * ensure that the OpenVPN server (or client configuration file) contains '' | ||
+ | * using the OpenWrt interface: '' | ||
+ | * using the OpenWrt interface: '' | ||
+ | |||
+ | OpenWrt does not do this automatically even if '' | ||
+ | |||
+ | ====== Getting External Full Disk Encryption to Work ====== | ||
+ | |||
+ | In order to get full disk encryption to work on OpenWrt, install the following packages: | ||
+ | <code bash> | ||
+ | opkg install kmod-crypto-ecb kmod-crypto-xts kmod-crypto-hmac kmod-crypto-sha256 kmod-crypto-misc kmod-crypto-user cryptsetup | ||
+ | </ | ||
+ | |||
+ | Similarly, if the storage device is connected via the USB port, install the dependent mass storage modules: | ||
+ | <code bash> | ||
+ | opkg install kmod-usb-storage kmod-usb-storage-uas | ||
+ | </ | ||
+ | |||
+ | Some key derivation mechanisms are memory intensive and may exceed the available memory on an OpenWrt router, this results in the following error when formatting or opening a LUKS device "//Not enough available memory to open a keyslot//" | ||
+ | * use the LUKSv1 key derivation by specifying '' | ||
+ | * restrict the memory available to the key-derivation mechanism by specifying '' | ||
+ | |||
+ | ====== Reading System Log from Terminal ====== | ||
+ | |||
+ | The system log file can be dumped to the terminal by issuing: | ||
+ | <code bash> | ||
+ | logread | ||
+ | </ | ||
+ | |||
+ | The equivalent of '' | ||
+ | <code bash> | ||
+ | logread -f | ||
+ | </ | ||
+ | |||
+ | ====== Fix for Missing POSIX Threads Library ====== | ||
+ | |||
+ | POSIX threads are part of the core '' | ||
+ | < | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | To resolve the issue, simply create an empty library in the library path, ie: | ||
+ | <code bash> | ||
+ | ar -rc / | ||
+ | </ | ||
+ | |||
+ | ====== Policy-Based Routing on OpenWrt ====== | ||
+ | |||
+ | Setting '' | ||
+ | |||
+ | For instance, to perform the equivalent of the following on OpenWrt: | ||
+ | <code bash> | ||
+ | echo "200 vpn" >>/ | ||
+ | ip rule add from all fwmark 0xC8 lookup vpn | ||
+ | ip route add default via 192.168.1.1 table vpn | ||
+ | </ | ||
+ | |||
+ | in order to be able to mark packets and send them through a different route, the following OpenWrt changes have to be made: | ||
+ | |||
+ | * define a table manually from the command line: | ||
+ | <code bash> | ||
+ | echo "200 vpn" >>/ | ||
+ | </ | ||
+ | * edit ''/ | ||
+ | < | ||
+ | config rule | ||
+ | option mark ' | ||
+ | option lookup ' | ||
+ | |||
+ | </ | ||
+ | * edit ''/ | ||
+ | < | ||
+ | config route | ||
+ | option interface ' | ||
+ | option gateway ' | ||
+ | option table ' | ||
+ | option netmask ' | ||
+ | option target ' | ||
+ | |||
+ | </ | ||
+ | |||
+ | ====== Passing Parameters to HostapD ====== | ||
+ | |||
+ | Parameters that are not processed by UCI can be passed to hostapd by using the UCI option '' | ||
+ | |||
+ | For example, the following command: | ||
+ | <code bash> | ||
+ | uci add_list wireless.radio0.hostapd_options=' | ||
+ | </ | ||
+ | will add the option '' | ||
+ | |||
+ | ====== Preserve OPKG Lists Between Reboots ====== | ||
+ | |||
+ | The opkg package manager is configured to download package lists to temporary storage that will end up cleared between reboots. The rationale is that OpenWrt is meant for embedded systems that are short on RAM and Flash ROM such that storing the package lists permanently would take up storage space. However, when OpenWrt is installed on a system with plenty of storage it makes sense to save the packages permanently such that opening '' | ||
+ | |||
+ | In order to make package lists permanent, open a terminal on the OpenWrt machine and issue: | ||
+ | <code bash> | ||
+ | mkdir / | ||
+ | </ | ||
+ | |||
+ | to create a directory that will store the lists permanently and then open ''/ | ||
+ | < | ||
+ | lists_dir ext / | ||
+ | </ | ||
+ | |||
+ | to: | ||
+ | < | ||
+ | lists_dir ext / | ||
+ | </ | ||
+ | |||
+ | Finally, either use the menu to update packages or issue '' | ||
+ | |||
+ | |||
+ | |||
For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.