OpenWrt system kernel settings

  System kernel settings: OpenWrt is also a Linux operating system, so it can be configured through some configuration files just like other Linux operating systems.

1. /etc/sysctl.conf configuration file

  This file is the kernel configuration file preloaded at system startup, which is read and set into the system through the sysctl command. This file is in the /etc/ directory of the OpenWrt system and in the package/base-files/files/etc/ directory of the OpenWrt source code.
insert image description here
insert image description here

  The parameter configuration of the kernel loads /etc/sysctl.conf by default at startup. After startup, it can be queried under /proc/sys. All available kernel parameters are in the /proc/sys directory, and can take effect by directly modifying the files under /proc/sys. For example, to query the host name of the system, you can use the following command:

cat /proc/sys/kernel/hostname 

insert image description here
  You can also use the sysctl command to modify the running kernel parameters. Running sysctl requires the support of the procfs file system. Kernel parameter data can be read and modified with sysctl. Among them:
  Parameter: The parameter is set in the form of "key= value".
  Commonly used options are as follows:
    -n: Output the value of the configuration item when querying, but not the configuration item.
    -e: When encountering an unknown configuration item, ignore the error.
    -w: Use this option to modify system settings.
    -p: Load the configuration from the specified configuration file, if not specified, the default configuration file /etc/sysctl.conf will be used.
    -a: Display all currently available values.
  For example, to query the host name of the system, you can use the following command:

/sbin/sysctl -n kernel.hostname

insert image description here

二、/etc/rc.local

  This file is a shell script, which is the last script that will be called after the system is powered on. That is to say, when there is any command that you want to execute immediately after booting, write it directly to /etc/rc.local, then the command will be automatically executed every time you start, without waiting for us Log in to the system and execute it.
insert image description here

Three, /etc/profile

  /etc/profile sets environment variables for each logged-in user of the system. This file is executed when the user logs in for the first time. This file first outputs the content of the "banner" file, then sets environment variables for the logged-in user, and creates links to some common commands.

4. /etc/shells

  Shell means the shell, which is relative to the Linux kernel. Linux has several command-parsing shells, and the shells file contains a list of all shells on the system. Applications use this file to determine whether a shell is valid. Each shell occupies one line, and the content is the absolute path of the shell execution program.
  The content of the file starts with "#", which means that this line is a comment line. If the content of the shells is wrong, it may lead to failure to log in. OpenWrt uses /bin/ash.
insert image description here

5. /etc/fstab

  This file is static information about the file system, read and set when the system starts. The file fstab contains the description information of various file systems. Now fstab can only be read by the program, and the program cannot modify it; it is the system administrator who creates and maintains this file.
  Each file system is described on one line; each field on a line is separated by spaces or tabs. Lines starting with "#" are comment lines. The order of entries in fstab is also very important, since commands like fsck, mount, and umount read sequentially to perform their tasks.
insert image description here
  The first field is fs_spec, which describes the specific block device or remote file system to be mounted. Use "/dev/cdrom" or "/dev/sdb7" for block device mounts. For NFS filesystems mount hosts and directories, and for procfs filesystems use "proc". Another way to indicate the type of filesystem (ext4 or swap) is the mounted UUID or volume label, written as LABEL= or, for example, "LABEL=Boot" or "UUID=3e6be9de-8139-11d1-9106-a43f08d823a6". This will make the system more robust: adding or removing a SCSI disk will change the disk device name, but the file system volume label will not change.
  The second field is fs_file, which describes the mount point of the file system. For the swap partition (swap), the value of this field should be specified as "none".
  The third field is fs_vfstype, which describes the type of file system. Linux supports a large number of file system types. Common file system types include ext3, ext4, ntfs, proc, swap, tmpfs, and vfat. All currently supported file systems are listed in /proc/filesystems. swap indicates that the partition is used for swapping, ignore indicates that this line is ignored, and is used to display the currently unused disk partition.
  The fourth field is fs_mntops, which describes the mount options of the file system (comma-separated list options). It contains at least the mount type plus additional filesystem types. Common options for all types of filesystems are "noauto" (don't mount when "-a" is given, e.g., at boot time), "user" (allow user to mount), "owner" (allow device to be or mount) and "comment" (for example, using the fstab maintainer). The "owner" and "comment" options are Linux-specific support.
  The fifth field is fs_freq, which is used for the Dump program and is used for backup.
  The sixth domain is fs_passno, a tool fsck program for checking and repairing disks, which determines the order of detecting file systems at startup. It should be set to 1 for the root filesystem and 2 for other filesystems. Checks will be performed sequentially on one physical device, and will be checked simultaneously on different devices if parallel capabilities are used. If the sixth field does not exist, it returns zero, indicating that no checking is required.

6. /etc/services

  This file is a list of Internet network service types. This is a plain ASCII-encoded file that provides a mapping between friendly text names and Internet services, and also includes port numbers and protocol types. Every network program can get the port number and protocol of the service from this file. The C libraries getervent, getservbyname, getservbyport, setservent, and endservent support querying from this file.
insert image description here

7. /etc/protocols

  This file is a protocol definition description file, which is an ordinary ASCII code text file used to describe various Internet network protocols. These numbers appear in the protocol field of the IP packet header
insert image description here

Guess you like

Origin blog.csdn.net/xxxx123041/article/details/132719254