[Previous] [Contents] [Index] [Next]

sysctl

Get or set the kernel state

Syntax:

sysctl [-n] name...

sysctl [-n] -w name=value...

sysctl [-n] -a|A

Options:

-a
List all the currently available string or integer values.
-A
List all the known MIB names including tables. Those with string or integer values are be printed with the -a flag; for the table values, the name of the utility to retrieve them is given.
-n
Suppress the printing of the field name and output only its value. This flag is also used for setting shell variables. For example, to save the IP TTL value in the variable ipttl:
set ipttl=`sysctl -n net.inet.ip.ttl`
      
-w
If just a MIB style name is given, the corresponding value is retrieved. To set a value specify: this flag, the MIB name followed by an equal sign, and the new value to be used.

Description:

The sysctl utility retrieves the system state and allows processes with appropriate privilege to set the system state. The state to be retrieved or set is described using a Management Information Base (MIB) stylename, described as a dotted set of components.

The information available from sysctl consists of integers and tables. The tabular information can only be retrieved by special purpose programs such as netstat and arp. The integer information is summarized below. For a detailed description of these variable see sysctl(). The changeable column indicates whether a process with appropriate privilege can change the value.

Name                               Type        Changeable
net.inet.icmp.errppslimit          integer     yes
net.inet.icmp.maskrepl             integer     yes
net.inet.icmp.returndatabytes      integer     yes
net.inet.ip.allowsrcrt             integer     yes
net.inet.ip.anonportmax            integer     yes
net.inet.ip.anonportmin            integer     yes
net.inet.ip.directed-broadcast     integer     yes
net.inet.ip.forwarding             integer     yes
net.inet.ip.forwsrcrt              integer     yes
net.inet.ip.gifttl                 integer     yes
net.inet.ip.hostzerobroadcast      integer     yes
net.inet.ip.lowportmax             integer     yes
net.inet.ip.lowportmin             integer     yes
net.inet.ip.maxflows               integer     yes
net.inet.ip.mtudisc                integer     yes
net.inet.ip.mtudisctimeout         integer     yes
net.inet.ip.redirect               integer     yes
net.inet.ip.subnetsarelocal        integer     yes
net.inet.ip.ttl                    integer     yes
net.inet.ipsec.ah_cleartos         integer     yes
net.inet.ipsec.ah_net_deflev       integer     yes
net.inet.ipsec.ah_offsetmask       integer     yes
net.inet.ipsec.ah_trans_deflev     integer     yes
net.inet.ipsec.debug               integer     yes
net.inet.ipsec.def_policy          integer     yes
net.inet.ipsec.dfbit               integer     yes
net.inet.ipsec.ecn                 integer     yes
net.inet.ipsec.esp_net_deflev      integer     yes
net.inet.ipsec.esp_trans_deflev    integer     yes
net.inet.ipsec.inbound_call_ike    integer     yes
net.inet.tcp.ack_on_push           integer     yes
net.inet.tcp.compat_42             integer     yes
net.inet.tcp.cwm                   integer     yes
net.inet.tcp.cwm_burstsize         integer     yes
net.inet.tcp.init_win              integer     yes
net.inet.tcp.keepcnt               integer     yes
net.inet.tcp.keepidle              integer     yes
net.inet.tcp.keepintvl             integer     yes
net.inet.tcp.log_refused           integer     yes
net.inet.tcp.mss_ifmtu             integer     yes
net.inet.tcp.mssdflt               integer     yes
net.inet.tcp.reno                  integer     yes
net.inet.tcp.recvspace             integer     yes
net.inet.tcp.rfc1323               integer     yes
net.inet.tcp.rstppslimit           integer     yes
net.inet.tcp.sack                  integer     yes
net.inet.tcp.sendspace             integer     yes
net.inet.tcp.slowhz                integer     no
net.inet.tcp.syn_bucket_limit      integer     yes
net.inet.tcp.syn_cache_interval    integer     yes
net.inet.tcp.syn_cache_limit       integer     yes
net.inet.tcp.timestamps            integer     yes
net.inet.tcp.win_scale             integer     yes
net.inet.udp.checksum              integer     yes
net.inet.udp.recvspace             integer     yes
net.inet.udp.sendspace             integer     yes
net.inet6.icmp6.errppslimit        integer     yes
net.inet6.icmp6.nd6_delay          integer     yes
net.inet6.icmp6.nd6_maxnudhint     integer     yes
net.inet6.icmp6.nd6_mmaxtries      integer     yes
net.inet6.icmp6.nd6_prune          integer     yes
net.inet6.icmp6.nd6_umaxtries      integer     yes
net.inet6.icmp6.nd6_useloopback    integer     yes
net.inet6.icmp6.nodeinfo           integer     yes
net.inet6.icmp6.rediraccept        integer     yes
net.inet6.icmp6.redirtimeout       integer     yes
net.inet6.ip6.accept_rtadv         integer     yes
net.inet6.ip6.anonportmax          integer     yes
net.inet6.ip6.anonportmin          integer     yes
net.inet6.ip6.auto_flowlabel       integer     yes
net.inet6.ip6.bindv6only           integer     yes
net.inet6.ip6.dad_count            integer     yes
net.inet6.ip6.defmcasthlim         integer     yes
net.inet6.ip6.forwarding           integer     yes
net.inet6.ip6.gifhlim              integer     yes
net.inet6.ip6.hdrnestlimit         integer     yes
net.inet6.ip6.hlim                 integer     yes
net.inet6.ip6.kame_version         string      no
net.inet6.ip6.keepfaith            integer     yes
net.inet6.ip6.log_interval         integer     yes
net.inet6.ip6.lowportmax           integer     yes
net.inet6.ip6.lowportmin           integer     yes
net.inet6.ip6.maxfragpackets       integer     yes
net.inet6.ip6.redirect             integer     yes
net.inet6.ip6.rr_prune             integer     yes
net.inet6.ip6.use_deprecated       integer     yes
net.inet6.ipsec6.ah_net_deflev     integer     yes
net.inet6.ipsec6.ah_trans_deflev   integer     yes
net.inet6.ipsec6.debug             integer     yes
net.inet6.ipsec6.def_policy        integer     yes
net.inet6.ipsec6.ecn               integer     yes
net.inet6.ipsec6.esp_net_deflev    integer     yes
net.inet6.ipsec6.esp_trans_deflev  integer     yes
net.inet6.udp6.recvspace           integer     yes
net.inet6.udp6.sendspace           integer     yes
net.key.blockacq_count             integer     yes
net.key.blockacq_lifetime          integer     yes
net.key.larval_lifetime            integer     yes
net.key.random_int                 integer     yes
net.key.spi_max_value              integer     yes
net.key.spi_min_value              integer     yes
net.key.spi_try                    integer     yes

Examples:

Check to see if the UDP checksum is enabled:

sysctl net.inet.udp.checksum

Enable IP forwarding so that the host acts as a router:

sysctl -w net.inet.ip.forwarding=1

See also:

netstat

sysctl() in the Library Reference


[Previous] [Contents] [Index] [Next]