📄 openvpn.8
字号:
is also specified, OpenVPN will pass the ifconfig localand remote endpoints on the command line to the.B --upscript so that they can be used to configure routes such as:.B route add -net 10.0.0.0 netmask 255.255.255.0 gw $5.TP.B --up-delayDelay TUN/TAP open and possible.B --upscript executionuntil after TCP/UDP connection establishment with peer.In.B --proto udpmode, this option normally requires the use of.B --pingto allow connection initiation to be sensed in the absenceof tunnel data, since UDP is a "connectionless" protocol.On Windows, this option will delay the TAP-Win32 media statetransitioning to "connected" until connection establishment,i.e. the receipt of the first authenticated packet from the peer..TP.B --down cmdShell command to run after TUN/TAP device close(post.B --userUID change and/or.B --chroot). Called with the same parameters and environmentalvariables as the.B --upoption above..TP.B --up-restartEnable the.B --upand.B --downscripts to be called for restarts as well as initial program start.This option is described more fully above in the.B --upoption documentation..TP.B --setenv name valueSet a custom environmental variable.B name=valueto pass to script..TP.B --disable-occDon't output a warning message if option inconsistencies are detected betweenpeers. An example of an option inconsistency would be where one peer uses.B --dev tunwhile the other peer uses.B --dev tap.Use of this option is discouraged, but is provided asa temporary fix in situations where a recent version of OpenVPN mustconnect to an old version..TP.B --user userChange the user ID of the OpenVPN process to.B userafter initialization, dropping privileges in the process.This option is useful to protect the systemin the event that some hostile party was able to gain control ofan OpenVPN session. Though OpenVPN's security features makethis unlikely, it is provided as a second line of defense.By setting.B userto.I nobodyor somebody similarly unprivileged, the hostile party would belimited in what damage they could cause. Of course onceyou take away privileges, you cannot return themto an OpenVPN session. This means, for example, that ifyou want to reset an OpenVPN daemon with a.B SIGUSR1signal(for example in responseto a DHCP reset), you should make use of one or more of the.B --persistoptions to ensure that OpenVPN doesn't need to execute any privilegedoperations in order to restart (such as re-reading key filesor running.BR ifconfigon the TUN device)..TP.B --group groupSimilar to the.B --useroption,this option changes the group ID of the OpenVPN process to.B groupafter initialization..TP.B --cd dirChange directory to.B dirprior to reading any files such asconfiguration files, key files, scripts, etc..B dirshould be an absolute path, with a leading "/",and without any referencesto the current directory such as "." or "..".This option is useful when you are runningOpenVPN in .B --daemonmode, and you want to consolidate all ofyour OpenVPN control files in one location..TP.B --chroot dirChroot to.B dirafter initialization. .B --chrootessentially redefines.B diras being the toplevel directory tree (/). OpenVPN will thereforebe unable to access any files outside this tree.This can be desirable from a security standpoint.Since the chroot operation is delayed until afterinitialization, most OpenVPN options that referencefiles will operate in a pre-chroot context.In many cases, the.B dirparameter can point to an empty directory, howevercomplications can result when scripts or restartsare executed after the chroot operation..TP.B --daemon [progname]Become a daemon after all initialization functions are completed.This option will cause all message and error output tobe sent to the syslog file (such as /var/log/messages),except for the output of shell scripts andifconfig commands,which will go to /dev/null unless otherwise redirected.The syslog redirection occurs immediately at the pointthat.B --daemonis parsed on the command line even thoughthe daemonization point occurs later. If one of the.B --logoptions is present, it will supercede syslogredirection.The optional.B prognameparameter will cause OpenVPN to report its program nameto the system logger as.B progname.This can be useful in linking OpenVPN messagesin the syslog file with specific tunnels.When unspecified,.B prognamedefaults to "openvpn".When OpenVPN is run with the.B --daemonoption, it will try to delay daemonization until the majority of initializationfunctions which are capable of generating fatal errors are complete. This meansthat initialization scripts can test the return status of theopenvpn command for a fairly reliable indication of whether the commandhas correctly initialized and entered the packet forwarding event loop.In OpenVPN, the vast majority of errors which occur after initialization are non-fatal..TP.B --passtosSet the TOS field of the tunnel packet to what the payload's TOS is..TP.B --inetd [wait|nowait] [progname]Use this option when OpenVPN is being run from the inetd or.BR xinetd(8)server.The.B wait/nowaitoption must match what is specified in the inetd/xinetdconfig file. The.B nowaitmode can only be used with.B --proto tcp-server.The default is.B wait.The.B nowaitmode can be used to instantiate the OpenVPN daemon as a classic TCP server,where client connection requests are serviced on a singleport number. For additional information on this kind of configuration,see the OpenVPN FAQ:.I http://openvpn.sourceforge.net/faq.html#oneportThis option precludes the use of.B --daemon, --local,or.B --remote.Note that this option causes message and error output to be handled in the sameway as the.B --daemonoption. The optional.B prognameparameter is also handled exactly as in.B --daemon.Also note that in.B waitmode, each OpenVPN tunnel requires a separate TCP/UDP port anda separate inetd or xinetd entry. See the OpenVPN HOWTO for an exampleon using OpenVPN with xinetd:.I http://openvpn.sourceforge.net/howto.html.TP.B --log fileOutput logging messages to.B file,including output to stdout/stderr whichis generated by called scripts.If.B filealready exists it will be truncated.This option takes effectimmediately when it is parsed in the command lineand will supercede syslog output if.B --daemonor.B --inetdis also specified.This option is persistent over the entire course ofan OpenVPN instantiation and will not be reset by SIGHUP,SIGUSR1, or.B --ping-restart.Note that on Windows, when OpenVPN is started as a service,logging occurs by default without the need to specifythis option..TP.B --log-append fileAppend logging messages to.B file.If.B filedoes not exist, it will be created.This option behaves exactly like.B --logexcept that it appends to ratherthan truncating the log file..TP.B --writepid fileWrite OpenVPN's main process ID to.B file..TP.B --nice nChange process priority after initialization(.B ngreater than 0 is lower priority,.B nless than zero is higher priority)..TP.B --nice-work nChange priority of background TLS work thread. The TLS threadfeature is enabled when OpenVPN is builtwith pthread support, and you are running OpenVPNin TLS mode (i.e. with.B --tls-clientor.B --tls-serverspecified).Using a TLS thread offloads the CPU-intensive process of SSL/TLS-basedkey exchange to a background thread so that it does not becomea latency bottleneck in the tunnel packet forwarding process.The parameter.B nis interpreted exactly as with the.B --niceoption above, but in relation to the work thread ratherthan the main thread..TP.B --verb nSet output verbosity to.B n(default=1). Each level shows all info from the previous levels.Level 3 is recommended if you want a good summaryof what's happening without being swamped by output..B 0 --No output except fatal errors..br.B 1 --Show startup information + connection initiated messages + non-fatal encryption & net errors..br.B 2 --Show SSL/TLS negotiations..br.B 3 --Show extra SSL/TLS info +.B --gremlinnet outages + adaptive compression state changes (on or off)..br.B 4 --Show all parameter settings..br.B 5 --Output.B Rand.B Wcharacters to the console for each packet read and write, uppercase isused for TCP/UDP packets and lowercase is used for TUN/TAP packets..br.B 6 to 11 --Show debug info of increasing verbosity (see errlevel.h for additionalinformation on debug levels)..TP.B --status file [n]Write operational status to.B fileevery.B nseconds.Status can also be written to the syslog by sending a.B SIGUSR2signal..TP.B --mute nLog at most.B nconsecutive messages in the same category. This is useful tolimit repetitive logging of similar message types..TP.B --gremlinSimulate dropped & corrupted packets + network outages(for debugging and testing only). This is apowerful tool for verifying the robustness of the OpenVPN protocol,especially in TLS mode. When used with TLS parameters that forcefrequent key renegotiations such as.B --reneg-sec 10,this option will stress-test the ability of OpenVPN peers to recoverfrom errors and remain in sync.Current parameter settings will cause.B --gremlinto drop 2% of packets and corrupt another 2%. A packet corruption willalter a random byte in the packet to a random value. It mightalso increase or decrease the size of the packet by one byte..B --gremlinwill also simulate network outages by going "down"for a period of 10 to 60 seconds.Between simulated outages, OpenVPN willremain up for periods of 10 to 300 seconds. To see gremlinmessages, set.B --verbto 3 or higher. To change gremlin constants, consult thefile gremlin.c included in the OpenVPN source distribution..TP.B --comp-lzoUse fast LZO compression -- may add up to 1 byte perpacket for incompressible data..TP.B --comp-noadaptWhen used in conjunction with.B --comp-lzo,this option will disable OpenVPN's adaptive compression algorithm.Normally, adaptive compression is enabled with.B --comp-lzo.Adaptive compression tries to optimize the case where you havecompression enabled, but you are sending predominantly uncompressible(or pre-compressed) packets over the tunnel, such as an FTP or rsync transferof a large, compressed file. With adaptive compression,OpenVPN will periodically sample the compression process to measure itsefficiency. If the data being sent over the tunnel is already compressed,the compression efficiency will be very low, triggering openvpn to disablecompression for a period of time until the next re-sample test..SS Multi-Client Server optionsStarting with OpenVPN 2.0, a multi-client UDP server modeis supported, and can be enabled with the.B --mode serveroption. In server mode, OpenVPN will listen on a singleUDP port for incoming client connections. All clientconnections will be routed through a single tun or tapinterface. This mode is designed for scalability and shouldbe able to support hundreds or even thousands of clientson sufficiently fast hardware. SSL/TLS authentication mustbe used in this mode..TP.B --push "option"Push a config file option back to the client for remoteexecution. Note that.Boptionmust be enclosed in double quotes (""). The client must specify.B --pullin its config file. The set of options which can bepushed is limited by both feasibility and security.Some options such as those which would execute scriptsare banned, since they would effectively allow a compromisedserver to execute arbitrary code on the client.Other options such as TLS or MTU parameterscannot be pushed because the client needs to knowthem before the connection to the server can be initiated.This is a partial list of options which can currently be pushed:.B --route, --route-gateway, --route-delay, --redirect-gateway,.B --ip-win32, --dhcp-option,.B --inactive, --ping, --ping-exit, --ping-restart,.B --setenv.TP.B --push-resetDon't inherit the global push list for a specific client instance.Specify this option in a client-specific context suchas with a.B --client-config-dirconfiguration file. This option will ignore.B --pushoptions at the global config file level..TP.B --pullThis option must be used on a client which is connectingto a multi-client server. It indicates to OpenVPN that itshould accept options pushed by the server, provided theyare part of the legal set of pushable options..TP.B --ifconfig-pool start-IP end-IPSet aside a pool of subnets to bedynamically allocated to connecting clients. For tun-styletunnels, each client will be given a /30 subnet (forinteroperability with Windows clients). For tap-styletunnels, individual addresses will be allocated..TP.B --ifconfig-push local remote-netmaskPush a tunnel ifconfig command to remote client,overriding the --ifconfig-pool dynamic allocation.Must be associated with a specific client instance,which means that it must be specified either in a clientinstance config file using.B --client-config-diror dynamically generated using a.B --client-connectscript..TP.B --iroute network [netmask]Generate an internal route to a specificclient. The.B netmaskparameter, if omitted, defaults to 255.255.255.255.This directive can be used to route a fixed subnet fromthe server to a particular client, regardless
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -