非UCI配置

大部分东西都可以(因而也应该)用uci进行配置。本页主要是一些无法通过UCI进行配置的小东西。有GNU/Linux使用经验的用户自然对这些了然于胸。本页主要针对初学者。

/etc/TZ

仅仅是一个符号连接,指向用UCI在/etc/config/system中创建和配置的/tmp/TZ

/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

起动和激活crond:

sh /etc/init.d/crond start
sh /etc/init.d/crond enable

分钟 小时 日/月 日/周 描述
*/5 * * * * 每5分钟
12 */3 * * * 每3小时在12分
57 11 15 1,6,12 * 在1、6、12月的15号的11:57
25 6 * * 1-5 每周一到周五的上午6:25
0 0 4,12,26 * * 每月4号、12号和26号的午夜
5,10 9,14 10 * 1,4 每周一和周四的9:05AM, 9:10AM, 2:09PM 和 2:14PM

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

/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

no idea

/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 resolf.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
base-file-essential will be always kept.

Back to top

zh-cn/doc/howto/notuci.config.txt · Last modified: 2011/04/27 07:03 (external edit)