|
Using "cat" and "echo" is the simplest way to access the /proc filesystem, but some requirements are needed for that
The /proc-filesystem had to be enabled in kernel, means on compiling following switch has to be set
CONFIG_PROC_FS=y |
The /proc-filesystem was mounted before, which can be tested using
# mount | grep "type proc" none on /proc type proc (rw) |
You need read and sometimes also write access (normally root only) to the /proc-filesystem
Normally, only entries in /proc/sys/* are writable, the others are readonly and for information retrieving only.
Using the "sysctl" program to access the kernel switches is a modern method today. You can use it also, if the /proc-filesystem isn't mounted. But you have only access to /proc/sys/*!
The program "sysctl" is included in package "procps" (on Red Hat Linux systems).
The sysctl-interface had to be enabled in kernel, means on compiling following switch has to be set
CONFIG_SYSCTL=y |
The value of an entry can be retrieved now:
# sysctl net.ipv6.conf.all.forwarding net.ipv6.conf.all.forwarding = 0 |
A new value can be set (if entry is writable):
# sysctl -w net.ipv6.conf.all.forwarding=1 net.ipv6.conf.all.forwarding = 1 |
Note: Don't use spaces around the "=" on setting values. Also on multiple values per line, quote them like e.g.
# sysctl -w net.ipv4.ip_local_port_range="32768 61000" net.ipv4.ip_local_port_range = 32768 61000 |
There are several formats seen in /proc-filesystem:
BOOLEAN: simple a "0" (false) or a "1" (true)
INTEGER: an integer value, can be unsigned, too
more sophisticated lines with several values: sometimes a header line is displayed also, if not, have a look into the kernel source to retrieve information about the meaning of each value...
Hosting by: Hurra Communications Ltd.
Generated: 2007-01-26 17:58:19