OpenWrt is a highly customizable Linux distribution for embedded devices, particularly routers. To get the most out of your OpenWrt setup, you'll want to familiarize yourself with several key files and directories. These will allow you to configure network settings, services, and other aspects of your router's operation. Here's a guide to some of the most important files and directories:
-
/etc/config/: This directory contains the main configuration files for OpenWrt. Each file is named after the service it configures (e.g., network, wireless, firewall). These files use a UCI (Unified Configuration Interface) format, which is designed to be easy to read and modify.
-
/etc/rc.local: This file is used to execute commands at boot time. If you want to run custom scripts or commands every time your router boots up, you can add them here.
-
/etc/init.d/: This directory contains the initialization scripts for various services. OpenWrt uses these scripts to start, stop, and restart services. You can use the /etc/init.d/ scripts to manage services manually or configure them to start automatically at boot.
-
/etc/firewall.user: This file allows you to add custom firewall rules. It's a convenient place to implement specific firewall policies that are not covered by the standard firewall configuration.
-
/etc/crontabs/: This directory contains crontab files for scheduling tasks to run at regular intervals. OpenWrt includes a cron daemon, and you can use crontab files to automate various tasks.
-
/etc/sysctl.conf: This file is used to configure kernel parameters at boot time. It's useful for tuning system performance and security.
-
/etc/dnsmasq.conf and /etc/resolv.conf: These files are related to DNS and DHCP configuration. dnsmasq is a lightweight DNS forwarder and DHCP server. resolv.conf specifies the nameservers to use for DNS resolution.
-
/etc/samba/: If you're using Samba for file sharing, this directory contains the Samba configuration files.
-
/etc/profile and /etc/profile.d/: These files and directories are used to set system-wide environment variables and run commands at login.
-
/etc/opkg/: This directory contains configuration files for the opkg package manager, which is used to install, update, and remove software packages on OpenWrt.
-
/etc/config/system: This file contains system-related configuration options, such as the hostname, time zone, and system logging configuration.
-
/etc/config/dhcp: This file is used to configure DHCP settings, including static leases and DHCP options.
-
/etc/config/dropbear: If you're using Dropbear as your SSH server, this file contains its configuration options.
-
/etc/config/network: This file is crucial for configuring your network interfaces, including VLANs, bridges, and routes.
-
/etc/config/wireless: This file is used to configure your wireless network, including SSID, encryption, and access control.
When making changes to these files, it's important to back them up first and proceed with caution, especially if you're not familiar with the syntax or the implications of your changes. Improper modifications can lead to an unbootable system or other issues. Always test changes in a controlled environment if possible.