⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 openvpn.8

📁 OpenVPN -- A Secure tunneling daemon
💻 8
📖 第 1 页 / 共 5 页
字号:
.B --remoteallows an OpenVPN session to initially connect to a peerat a known address, however if packets arrive from a newaddress and pass all authentication tests, the new addresswill take control of the session.  This is useful whenyou are connecting to a peer which holds a dynamic addresssuch as a dial-in user or DHCP client.Essentially,.B --floattells OpenVPN to accept authenticated packetsfrom any address, not only the address which was specified in the.B --remoteoption..TP.B --ipchange cmdExecute shell command.B cmdwhen our remote ip-address is initially authenticated orchanges.Execute as:.B cmd ip_address port_numberNote that.B cmdcan be a shell command with multiple arguments, in whichcase all OpenVPN-generated arguments will be appendedto.B cmdto build a command line which will be passed to the script.If you are running in a dynamic IP address environment wherethe IP addresses of either peer could change without notice,you can use this script, for example, to edit the.I /etc/hostsfile with the current address of the peer.  The script willbe run every time the remote peer changes its IP address.Similarly if.I ourIP address changes due to DHCP, we should configureour IP address change script (see man page for.BR dhcpcd (8)) to deliver a.B SIGHUPor.B SIGUSR1signal to OpenVPN.  OpenVPN will thenreestablish a connection with its most recently authenticatedpeer on its new IP address..TP.B --port portUDP port number for both local and remote..TP.B --lport portUDP port number for local (default=5000)..TP.B --rport portUDP port number for remote (default=5000)..TP.B --nobindDo not bind to local address and port.  The IP stack will allocatea dynamic port for returning packets.  Since the value of the dynamic portcould not be known in advance by a peer, this option is only suitable forpeers which will be initiating connections by using the.B --remoteoption..TP.B --dev tunX | tapX | nullTUN/TAP virtual network device (.B Xcan be omitted for dynamic device inLinux 2.4.7+).  See examples section belowfor an example on setting up a TUN device..TP.B --dev-type device-typeWhich device type are we using?.B device-typeshould be.B tunor.B tap.Use this option only if the TUN/TAP device used with.B --devdoes not begin with.B tunor.B tap..TP.B --tun-ipv6Build a tun link capable of forwarding IPv6 traffic.Should be used in conjunction with.B --dev tunor.B --dev tunX.A warning will be displayedif no specific IPv6 TUN support for your OS has been compiled into OpenVPN..TP.B --dev-node nodeExplicitly set the device node rather than using/dev/net/tun, /dev/tun, /dev/tap, etc.  If OpenVPNcannot figure out whether.B nodeis a TUN or TAP device based on the name, you shouldalso specify.B --dev-type tunor.B --dev-type tap..TP.B --ifconfig l rConfigure the TUN device to use IP address.B las a local endpoint and.B ras a remote endpoint..B l&.B rshould be swapped on the other peer..B l&.B rmust be privateaddresses outside of the subnets used by either peer.This option implies.B --udp-mtu 1300if neither.B --udp-mtuor.B --tun-mtuis explicitly specified.This option willconfigure the tunnel endpoints using the.BR ifconfig (8)command, eliminating the need to have an.B --upscript.  However, you will still need an.B --upscript if you will be adding routesto the tunnel.The.B --ifconfigoption can be used in conjunction with an.B --upscript in which case the local and remoteendpoints will be passed as parameters tothe script.In addition, the.B --ifconfigoption will set the UDP MTU to 1300and derive the tunnel MTU automatically.  You canoverride the UDP MTU value of 1300 by usingthe.B --udp-mtuoption to explicitly specify a different value.One of the nice features of the .B --ifconfigoption is that it knows how to run the.BR ifconfig (8)tool on each of the operating systemswhich OpenVPN supports, allowing youto specify the option consistentlyacross platforms, while OpenVPN dealswith formatting the appropriate.BR ifconfig (8)command for your platform..TP.B --udp-mtu nTake the UDP device MTU to be n and derive the TUN MTUfrom it (default=1300 when the.B --ifconfigoption is used).  This is a conservative value that was chosenbecause it has a higher probability of working correctly.However, for manycases, using a value of 1472 will maximize performance.This option should only be used for TUN style tunnels.  TAP tunnelsthat are used for ethernet bridging should use the.B --tun-mtuparameter.The MTU (Maximum Transmission Units) isthe maximum datagram size in bytes that can be sent unfragmentedover a particular network path.  OpenVPN requires that packetson the control or data channels be sent unfragmented.Typically, the UDP MTU should be set to a value between 1300 and 1500.The optimal size for UDP MTU is the largestMTU that can be handled by every router on the link path.The UDP MTU value should be equal on both peers.OpenVPNadds a small amount of overhead to each tunnel packet beforeit is forwarded from the TUN device over the secure UDP channel.This overhead consists of data fields such as the HMAC signature,packet ID, encryption block padding, etc.  Because of this overhead,the TUN device MTU should be slightly smaller than the UDP deviceMTU to make room for the extra bytes which OpenVPN adds to everydata channel packet.  OpenVPN allows you to explicitly specify eitherthe TUN MTU or the UDP MTU (but not both).  OpenVPN will thencompute the value you didn't specify based on the value you did.OpenVPN will compute exactly how much overhead it will need to addto each packet, based on the other options you specify.  If youspecify an.B --upscript, OpenVPN will pass the TUN MTU and UDP MTU values on the command lineto the script..TP.B --tun-mtu nTake the TUN device MTU to be.B nand derive the UDP MTUfrom it (default=1300).See.B --udp-mtuabove more more information on MTU.Using the.B --ifconfigoption is the recommended method of configuringa TUN device MTU automatically.However, for TUN devices which are used to bridge ethernet segments,it is recommended that you set this parameter to 1500 and then also add.B --tun-mtu-extra 64to your command line or config file..TP.B --tun-mtu-extra nAssume that the TUN/TAP device might return as many as.B nbytes more than the.B --tun-mtusize on read.  This parameter defaults to 0, which is sufficient formost TUN devices.  TAP devices may introduce additional overhead in excessof the MTU size, and a setting of 64 would be a conservative choice forTAP device usage.  This parameter only controls internal OpenVPN buffer sizing,so there is no transmission overhead associated with using a larger value..TP.B --mtu-disc typeShould we do Path MTU discovery on UDP channel?  Only supported on OSes suchas Linux that supports the necessary system call to set..B 'no'-- Never send DF (Don't Fragment) frames.br.B 'maybe'-- Use per-route hints.br.B 'yes'-- Always DF (Don't Fragment).br.TP.B --mtu-dynamic [min] [max]EXPERIMENTAL -- Enable internal datagram fragmentation sothat no UDP datagrams are sent whichare larger than.B maxbytes.  Currently, dynamic MTUsizing is not yet implemented, so.B minshould equal.B max.Adds 4 bytes of overhead per datagram.Since this option is currently experimental, you must rebuildOpenVPN with the.B --enable-mtu-dynamicconfigure flag in order to have the capability of usingthis option.It should also be noted that this option is not meant to replaceUDP fragmentation at the IP stack level.  It is only meant as alast resort when path MTU discovery is broken.  Using this optionis less efficient than fixing path MTU discovery for your IP link andusing native IP fragmentation instead.Having said that, there are circumstances where using OpenVPN'sinternal fragmentation capability may be your only option, suchas tunneling a UDP multicast stream which requires fragmentation..TP.B --shaper nLimit bandwidth of outgoing tunnel data to.B nbytes per second on the UDP port.If you want to limit the bandwidthin both directions, use this option on both peers.OpenVPN uses the following algorithm to implementtraffic shaping: Given a shaper rate of.I nbytes per second, after a datagram write of.I bbytes is queued on the UDP port, wait a minimum of.I (b / n)seconds before queuing the next write.It should be noted that OpenVPN supports multipletunnels between the same two peers, allowing youto construct full-speed and reduced bandwidth tunnelsat the same time,routing low-priority data such as off-site backupsover the reduced bandwidth tunnel, and other dataover the full-speed tunnel.Also note that for low bandwidth tunnels(under 1000 bytes per second), you should probablyuse lower MTU values as well (see above), otherwisethe packet latency will grow so large as to triggertimeouts in the TLS layer and TCP connections runningover the tunnel.OpenVPN allows.B nto be between 100 bytes/sec and 100 Mbytes/sec..TP.B --inactive nCauses OpenVPN to exit after.B nseconds of inactivity on the TUN/TAP device.  The time lengthof inactivity is measured since the last incoming tunnel packet..TP.B --ping nPing remote over the UDP control channelif no packets have been sent for at least.B nseconds (specify.B --pingon both peers to cause ping packets to be sent in both directions).When used in one of OpenVPN's secure modes (where.B --secret, --tls-server,or.B --tls-clientis specified), the ping packetwill be cryptographically secure.This option has two intended uses:(1) Compatibilitywith stateful firewalls.  The periodic ping will ensure thata stateful firewall rule which allows OpenVPN UDP packets topass will not time out.(2) To provide a basis for the remote to test the existenceof its peer using the.B --ping-exitoption..TP.B --ping-exit nCauses OpenVPN to exit after.B nseconds pass without reception of a pingor other packet from remote.This option can be combined with.B --inactive, --ping,and.B --ping-exitto create a two-tiered inactivity disconnect.For example,.B openvpn [options...] --inactive 3600 --ping 10 --ping-exit 60when used on both peers will cause OpenVPN to exit within 60seconds if its peer disconnects, but will exit after onehour if no actual tunnel data is exchanged..TP.B --ping-restart nSimilar to.B --ping-exit,but trigger a.B SIGUSR1restart after.B nseconds pass without reception of a pingor other packet from remote.This option is useful in caseswhere the remote peer has a dynamic IP address anda low-TTL DNS name is used to track the IP address usinga service such as.I http://dyndns.org/+ a dynamic DNS client suchas.B ddclient.If the peer cannot be reached, a restart will be triggered, causingthe hostname used with.B --remoteto be re-resolved (if.B --resolv-retryis also specified).See the signals section below for more informationon.B SIGUSR1.Note that the behavior of.B SIGUSR1can be modified by the.B --persist-tun, --persist-key, --persist-local-ip,and.B --persist-remote-ipoptions.Also note that.B --ping-exitand.B --ping-restartare mutually exclusive and cannot be used together..TP.B --ping-timer-rem

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -