NotUCI Configuration

A lot of stuff can (and therefore should be) configured with UCI via any of its interfaces. This page concerns itself with everything built into OpenWrt that cannot be configured with UCI. Note that most third party applications, installed with opkg or otherwise, typically also have their own configuration methods. Users experienced with GNU/Linux distribution will know all of this by heart. For beginners this should be useful.

/etc/TZ

Merely a symlink to TZ → /tmp/TZ which is being created and configured with UCI in /etc/config/system

/etc/banner

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 ATTITUDE ADJUSTMENT (bleeding edge, r26290) ----------
  * 1/4 oz Vodka      Pour all ingredents into mixing
  * 1/4 oz Gin        tin with ice, strain into glass.
  * 1/4 oz Amaretto
  * 1/4 oz Triple sec
  * 1/4 oz Peach schnapps
  * 1/4 oz Sour mix
  * 1 splash Cranberry juice
 -----------------------------------------------------

/etc/crontabs/root

Start and enable cron:

sh /etc/init.d/cron start
sh /etc/init.d/cron enable
You might have to create the spool directory first, depending on openwrt version:

mkdir -p /var/spool/cron

You can edit the current config with:

crontab -e

min hour day/month month day/week Description
*/5 * * * * every 5 minutes
12 */3 * * * every 3 hours at 12 minutes
57 11 15 1,6,12 * At 11:57 Hrs on 15th of Jan, June & Dec.
25 6 * * 1-5 At 6:25 AM every weekday (Mon-Fri)
0 0 4,12,26 * * At midnight on 4th, 12th and 26th of every month
5,10 9,14 10 * 1,4 At 9:05AM, 9:10AM, 2:05PM and 2:10PM every Monday and Thursday

If you have Daylight saving time you could write yourself a nice alarm clock ;-) When DST starts in central Europe, clocks advance from 02:00 CET to 03:00 CEST on last Sunday in March. Six day before that, you could make your WOL wake you 10 minutes earlier. Later won't work, you'll be late ;-) When DST ends in central Europe, clocks retreat from 03:00 CEST to 02:00 CET on last Sunday in October.

#min hour day month dayofweek command
59 05 * * 1 /usr/bin/wol -h 192.168.1.255 xx:xx:xx:xx:xx:xx # Mo
#crontab muss (wie fstab) in leerzeile oder kommentar enden

Note1: On many platforms shutdown does not work; it will just halt the CPU but it won't power off the device. There is usually no programmable circuitry to actually power off the unit. reboot does work, in case you should want to reboot the router periodically.

/etc/iproute2/rt_tables

This is the configuration file for the routing. See man ip and iproute2.

#
# reserved values
#
255     local
254     main
253     default
0       unspec
#
# local
#
#1      inr.ruhep

/etc/diag.sh

/etc/dnsmasq.conf

/etc/ethers

/etc/firewall.user

Is being called by /etc/config/firewall. Both files are not executed when booting into failsafe mode. You can populate this file with help of netfilter-article.

/etc/fstab

Merely a symlink to fstab → /tmp/fstab which is being created and configured by UCI in /etc/config/fstab

manpage fstab, fstab

/etc/functions.sh

/etc/functions.sh does stuff FIXME

/etc/fw_env.config

/etc/group

/etc/group is an ASCII file which defines the groups to which users belong to. See man group

/etc/hosts

On top of IP addresses we use hostnames to refer to devices in the network. As there are FQDN, so are internal hostnames. Edit the file /etc/hosts:

192.168.1.1    openwrt  openwrt.
192.168.1.1    name1  name1.
192.168.1.1    name2  name2.
192.168.1.2    user1  user1.
192.168.1.254  dockstar  dockstar.

After rebooting you can address your network devices not only by their IPs, but by their names. e.g. [http://openwrt.lan] or [smb://dockstar.lan] etc.

The UCI method for setting the hostname of the OpenWrt system itself is via /etc/config/system:

  config system
  	option hostname	lila

/etc/hosts.allow

/etc/hosts.deny

/etc/hotplug2-common.rules

/etc/hotplug2-init.rules

/etc/hotplug2.rules

/etc/init.d/rcS

This get's executed by init every boot: init

#!/bin/sh
# Copyright (C) 2006 OpenWrt.org

run_scripts() {
        for i in /etc/rc.d/$1*; do
                [ -x $i ] && $i $2 2>&1
        done | $LOGGER
}

system_config() {
        config_get_bool foreground $1 foreground 0
}

LOGGER="cat"
[ -x /usr/bin/logger ] && LOGGER="logger -s -p 6 -t sysinit"

. /etc/functions.sh

config_load system
config_foreach system_config system

if [ "$1" = "S" -a "$foreground" != "1" ]; then
        run_scripts "$1" "$2" &
else
        run_scripts "$1" "$2"
fi

/etc/inittab

http://linux.die.net/man/5/inittab

::sysinit:/etc/init.d/rcS S boot
::shutdown:/etc/init.d/rcS K shutdown
tts/0::askfirst:/bin/ash --login
ttyS0::askfirst:/bin/ash --login
tty1::askfirst:/bin/ash --login

/etc/mtab

mtab, → filesystems, →flash.layout, procfs, sysfs, devpts

rootfs / rootfs rw 0 0
/dev/root /rom squashfs ro,relatime 0 0
proc /proc proc rw,noatime 0 0
sysfs /sys sysfs rw,noatime 0 0
tmpfs /tmp tmpfs rw,nosuid,nodev,noatime 0 0
tmpfs /dev tmpfs rw,noatime,size=512k,mode=755 0 0
devpts /dev/pts devpts rw,noatime,mode=600 0 0
/dev/mtdblock3 /overlay jffs2 rw,noatime 0 0
overlayfs:/overlay / overlayfs rw,noatime 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
none /proc/bus/usb usbfs rw,relatime 0 0

/etc/ntp.conf

/etc/opkg.conf

opkg

/etc/passwd

/etc/preinit

In OpenWrt the Kernel is executed by the bootloader with the option init=/etc/preinit (instead of the usual init=/sbin/init). So the Kernel executes /etc/preinit which itself calls upon:

process.boot should bring some clarity into this matter

#!/bin/sh

export PATH=/bin:/sbin:/usr/bin:/usr/sbin
. /etc/diag.sh

pi_ifname=
pi_ip=192.168.1.1
pi_broadcast=192.168.1.255
pi_netmask=255.255.255.0

fs_failsafe_ifname=
fs_failsafe_ip=192.168.1.1
fs_failsafe_broadcast=192.168.1.255
fs_failsafe_netmask=255.255.255.0

fs_failsafe_wait_timeout=2

pi_suppress_stderr="y"
pi_init_suppress_stderr="y"
pi_init_path="/bin:/sbin:/usr/bin:/usr/sbin"
pi_init_cmd="/sbin/init"

. /etc/functions.sh
. /lib/functions/boot.sh

boot_hook_init preinit_essential
boot_hook_init preinit_main
boot_hook_init failsafe
boot_hook_init initramfs
boot_hook_init preinit_mount_root

for pi_source_file in /lib/preinit/*; do
    . $pi_source_file
done

boot_run_hook preinit_essential

pi_mount_skip_next=false
pi_jffs2_mount_success=false
pi_failsafe_net_message=false

boot_run_hook preinit_main

/etc/profile

#!/bin/sh
[ -f /etc/banner ] && cat /etc/banner
 
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
export HOME=${HOME:-/root}
export PS1="\[\033[4;44;1;35m\]\u@\h:\w$\[\033[0m\] "
 
[ -x /bin/more ] || alias more=less
[ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi
 
[ -z "$KSH_VERSION" -o \! -s /etc/mkshrc ] || . /etc/mkshrc
 
[ -x /sbin/arp ] || arp() { cat /proc/net/arp; }
[ -z /bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }

/etc/protocols

/etc/rc.common

/etc/rc.common

Part of the Shebang (Unix) of many shell scripts in /etc/init.d. It checks the start scripts for mistakes. E.g. since R27797 it checks whether "start" and "stop" are defined.

/etc/rc.local

This file gets executed by /etc/rc.d/S95done on every boot up. You should treat this file as a shell script.

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

exit 0

/etc/resolv.conf

A symlink to resolv.conf → /tmp/resolv.conf

man resolv.conf

/etc/services

/etc/shells

/etc/sysctl.conf

/etc/sysctl.conf gets called every boot up by /etc/rc.d/S99sysctlmanpage sysctl.conf
http://www.frozentux.net/ipsysctl-tutorial/ipsysctl-tutorial.html for Kernel 2.4!

kernel.panic=3
net.ipv4.conf.default.arp_ignore=1
net.ipv4.conf.all.arp_ignore=1
net.ipv4.ip_forward=1
net.ipv4.icmp_echo_ignore_broadcasts=1
net.ipv4.icmp_ignore_bogus_error_responses=1
net.ipv4.tcp_ecn=0
net.ipv4.tcp_fin_timeout=30
net.ipv4.tcp_keepalive_time=120
net.ipv4.tcp_syncookies=1
net.ipv4.tcp_timestamps=0
net.core.netdev_max_backlog=30
net.netfilter.nf_conntrack_checksum=0
net.ipv4.netfilter.ip_conntrack_checksum=0
net.ipv4.netfilter.ip_conntrack_max=16384
net.ipv4.netfilter.ip_conntrack_tcp_timeout_established=3600
net.ipv4.netfilter.ip_conntrack_udp_timeout=60
net.ipv4.netfilter.ip_conntrack_udp_timeout_stream=180
net.ipv6.conf.all.forwarding=1

# disable bridge firewalling by default
net.bridge.bridge-nf-call-arptables=0
net.bridge.bridge-nf-call-ip6tables=0
net.bridge.bridge-nf-call-iptables=0

/etc/sysupgrade.conf

generic.sysupgrade

## This file contains files and directories that should
## be preserved during an upgrade.

# /etc/example.conf
# /etc/openvpn/
/etc/config
/etc/profile
/etc/firewall.user
/etc/TC_hfsc.sh
/etc/hotplug.d/iface/30-trafficc
/etc/init.d/trafficc
/root
/etc/crontabs/root
Files listed by "opkg list-changed-conffiles" and files listed in /lib/upgrade/keep.d/* (eg. base-file-essential) will be always kept.

Back to top

doc/howto/notuci.config.txt · Last modified: 2014/01/08 19:30 by brna