说明:此Open×××的配置文件详解,是在原有的配置文件的基础上进行相关翻译与说明(大多是自己的理解),若有不正确的地方欢迎大家指出与交流。


#################################################  
# Sample Open××× 2.0 config file for            #    
# multi-client server.                          #    
#                                               #    
# This file is for the server side              #    
# of a many-clients <-> one-server              #    
# Open××× configuration.                        #    
#                                               #    
# Open××× also supports                         #    
# single-machine <-> single-machine             #    
# configurations (See the Examples page         #    
# on the web site for more info).               #    
#                                               #    
# This config should work on Windows            #    
# or Linux/BSD systems.  Remember on            #    
# Windows to quote pathnames and use            #    
# double backslashes, e.g.:                     #    
# "C:\\Program Files\\Open×××\\config\\foo.key" #    
#                                               #    
# Comments are preceded with '#' or ';'         #    
#################################################

注,#号和;号开头的都是注释。


# Which local IP address should Open×××  
# listen on? (optional)    
#设置监听 IP,默认是监听所有 IP


;local a.b.c.d

# Which TCP/UDP port should Open××× listen on?  
# If you want to run multiple Open××× instances    
# on the same machine, use a different port    
# number for each one.  You will need to    
# open up this port on your firewall.  


#Open*** 服务器监听端口
port 1194

# TCP or UDP server?  


#设置用TCP还是UDP协议?
;proto tcp    
proto udp

# "dev tun" will create a routed IP tunnel,  
# "dev tap" will create an ethernet tunnel.    
# Use "dev tap0" if you are ethernet bridging    
# and have precreated a tap0 virtual interface    
# and bridged it with your ethernet interface.    
# If you want to control access policies    
# over the ×××, you must create firewall    
# rules for the the TUN/TAP interface.    
# On non-Windows systems, you can give    
# an explicit unit number, such as tun0.    
# On Windows, use "dev-node" for this.    
# On most systems, the ××× will not function    
# unless you partially or fully disable    
# the firewall for the TUN/TAP interface.  

 
# 设置创建 tun 的路由 IP 通道,还是创建 tap 的以太网通道    
# 路由 IP 通道一般容易控制,所以推荐使用它;但如果如 IPX 等必须      
# 使用第二层才能通过的通讯,则可以用 tap 方式,tap 也      
# 就是以太网桥接

;dev tap    
dev tun

# Windows needs the TAP-Win32 adapter name  
# from the Network Connections panel if you    
# have more than one.  On XP SP2 or higher,    
# you may need to selectively disable the    
# Windows firewall for the TAP adapter.    
# Non-Windows systems usually don't need this.  

 
# 在Windows上如果你更多的网络接口,你需要在网络连接控制面板上增加    
# TAP-Win32适配器接口名      
# 在XP SP2或更高系统上,你需要使windows防火墙对该接口不执行过滤规则      
# 非Windows系统通常不需要设置这个(注,这个是直译的,嘿嘿

;dev-node MyTap

# SSL/TLS root certificate (ca), certificate  
# (cert), and private key (key).  Each client    
# and the server must have their own cert and    
# key file.  The server and all clients will    
# use the same ca file.    
#    
# See the "easy-rsa" directory for a series    
# of scripts for generating RSA certificates    
# and private keys.  Remember to use    
# a unique Common Name for the server    
# and each of the client certificates.    
#    
# Any X509 key management system can be used.    
# Open××× can also use a PKCS #12 formatted key file    
# (see "pkcs12" directive in man page).    


# 这里是重点,必须指定 SSL/TLS root certificate (ca),    
# certificate(cert), and private key (key)      
# ca 文件是服务端和客户端都必须使用的,但不需要 ca.key      
# 服务端和客户端指定各自的.crt 和.key      
# 请注意路径,可以使用以配置文件开始为根的相对路径,      
# 也可以使用绝对路径      
# 请小心存放.key 密钥文件

ca ca.crt    
cert server.crt    
key server.key  # This file should be kept secret

# Diffie hellman parameters.  
# Generate your own with:    
#   openssl dhparam -out dh1024.pem 1024    
# Substitute 2048 for 1024 if you are using    
# 2048 bit keys.    


# 指定 Diffie hellman parameters(密钥交换算法协议).
dh dh1024.pem

# Configure server mode and supply a ××× subnet  
# for Open××× to draw client addresses from.    
# The server will take 10.8.0.1 for itself,    
# the rest will be made available to clients.    
# Each client will be able to reach the server    
# on 10.8.0.1. Comment this line out if you are    
# ethernet bridging. See the man page for more info.  

 
# 配置 ××× 使用的网段,Open××× 会自动提供基于该网段的 DHCP    
# 服务,但不能和任何一方的局域网段重复,保证唯一      
# server 端 ip 默认会设为10.8.0.1的地址。      
server 10.8.0.0 255.255.255.0

# Maintain a record of client <-> virtual IP address  
# associations in this file.  If Open××× goes down or    
# is restarted, reconnecting clients can be assigned    
# the same virtual IP address from the pool that was    
# previously assigned.    


# 维持一个客户端和 virtual IP 的对应表,以方便客户端重新    
# 连接可以获得同样的 IP

ifconfig-pool-persist ipp.txt

# Configure server mode for ethernet bridging.  
# You must first use your OS's bridging capability    
# to bridge the TAP interface with the ethernet    
# NIC interface.  Then you must manually set the    
# IP/netmask on the bridge interface, here we    
# assume 10.8.0.4/255.255.255.0.  Finally we    
# must set aside an IP range in this subnet    
# (start=10.8.0.50 end=10.8.0.100) to allocate    
# to connecting clients.  Leave this line commented    
# out unless you are ethernet bridging.    


# 配置为以太网桥模式,但需要使用系统的桥接功能    
# 一般不需要使用
;server-bridge 10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100

# Push routes to the client to allow it  
# to reach other private subnets behind    
# the server.  Remember that these    
# private subnets will also need    
# to know to route the Open××× client    
# address pool (10.8.0.0/255.255.255.0)    
# back to the Open××× server.    


# 为客户端创建对应的路由,以另其通达公司网内部服务器    
# 但记住,公司网内部服务器也需要有可用路由返回到客户端(很多博友都会在这里出问题

;push "route 192.168.10.0 255.255.255.0"    
;push "route 192.168.20.0 255.255.255.0"

# To assign specific IP addresses to specific  
# clients or if a connecting client has a private    
# subnet behind it that should also have ××× access,    
# use the subdirectory "ccd" for client-specific    
# configuration files (see man page for more info).

# EXAMPLE: Suppose the client  
# having the certificate common name "Thelonious"    
# also has a small subnet behind his connecting    
# machine, such as 192.168.40.128/255.255.255.248.    
# First, uncomment out these lines:    
;client-config-dir ccd    
;route 192.168.40.128 255.255.255.248    
# Then create a file ccd/Thelonious with this line:    
#   iroute 192.168.40.128 255.255.255.248    
# This will allow Thelonious' private subnet to    
# access the ×××.  This example will only work    
# if you are routing, not bridging, i.e. you are    
# using "dev tun" and "server" directives.

# EXAMPLE: Suppose you want to give  
# Thelonious a fixed ××× IP address of 10.9.0.1.    
# First uncomment out these lines:    


# 为特定的客户端指定 IP 或指定路由,该路由通常是客户端后面的    
# 内网网段,而不是服务端连接的网段      
# ccd 是/etc/open*** 下的目录,其中建有希望限制的客户端 Common      
# Name 为文件名的文件,并通过下面的命令写入固定 IP 地址      
# 例如 Common Name 为 client1,则在/etc/open***/ccd/client1 写有:

# ifconfig-push 10.9.0.1 10.9.0.2
;client-config-dir ccd    
;route 10.9.0.0 255.255.255.252    
# Then add this line to ccd/Thelonious:    
#   ifconfig-push 10.9.0.1 10.9.0.2

# Suppose that you want to enable different  
# firewall access policies for different groups    
# of clients.  There are two methods:    
# (1) Run multiple Open××× daemons, one for each    
#     group, and firewall the TUN/TAP interface    
#     for each group/daemon appropriately.    
# (2) (Advanced) Create a script to dynamically    
#     modify the firewall in response to access    
#     from different clients.  See man    
#     page for more info on learn-address script.  


# 支持对不同客户端组执行不同的防火墙策略    
# 这里有两种方法      
# (1) 运行多个Open×××守护进程, 每个对应不同的组      
# 并且防火墙对不同的组和进程执行不同的策略      
# (2) (高级)创建1个动态脚本使防火墙对接入的不同客户端执行不同的策略

;learn-address ./script

# If enabled, this directive will configure  
# all clients to redirect their default    
# network gateway through the ×××, causing    
# all IP traffic such as web browsing and    
# and DNS lookups to go through the ×××    
# (The Open××× server machine may need to NAT    
# the TUN/TAP interface to the internet in    
# order for this to work properly).    
# CAVEAT: May break client's network config if    
# client's local DHCP server packets get routed    
# through the tunnel.  Solution: make sure    
# client's local DHCP server is reachable via    
# a more specific route than the default route    
# of 0.0.0.0/0.0.0.0.    


# 若客户端希望所有的流量都通过 ××× 传输,则可以使用该语句    
# 其会自动改变客户端的网关为 ××× 服务器,推荐关闭      
# 一旦设置,请小心服务端的 DHCP 设置问题

;push "redirect-gateway"

# Certain Windows-specific network settings  
# can be pushed to clients, such as DNS    
# or WINS server addresses.  CAVEAT:    
# http://open***.net/faq.html#dhcpcaveats


# 用Open×××的DHCP功能为客户端提供指定的DNS、WINS等
;push "dhcp-option DNS 10.8.0.1"    
;push "dhcp-option WINS 10.8.0.1"

# Uncomment this directive to allow different  
# clients to be able to "see" each other.    
# By default, clients will only see the server.    
# To force clients to only see the server, you    
# will also need to appropriately firewall the    
# server's TUN/TAP interface.    


# 下面这句使客户端能相互访问    
# 否则,默认设置下客户端间不能相互访问      
;client-to-client

# Uncomment this directive if multiple clients  
# might connect with the same certificate/key    
# files or common names.  This is recommended    
# only for testing purposes.  For production use,    
# each client should have its own certificate/key    
# pair.    
#    
# IF YOU HAVE NOT GENERATED INDIVIDUAL    
# CERTIFICATE/KEY PAIRS FOR EACH CLIENT,    
# EACH HAVING ITS OWN UNIQUE "COMMON NAME",    
# UNCOMMENT THIS LINE OUT.    


# 如果您希望有相同 Common Name 的客户端都可以登陆    
# 也可以注释下面的语句,推荐每个客户端都使用不用的 Common Name      
# 常用于测试

;duplicate-cn

# The keepalive directive causes ping-like  
# messages to be sent back and forth over    
# the link so that each side knows when    
# the other side has gone down.    
# Ping every 10 seconds, assume that remote    
# peer is down if no ping received during    
# a 120 second time period.    


# 设置服务端检测的间隔和超时时间 每 10 秒 ping 一次,    
# 如果 120 秒没有回应则认为对方已经 down

keepalive 10 120

# For extra security beyond that provided  
# by SSL/TLS, create an "HMAC firewall"    
# to help block DoS attacks and UDP port flooding.    
#    
# Generate with:    
#   open*** --genkey --secret ta.key    
#    
# The server and each client must have    
# a copy of this key.    
# The second parameter should be '0'    
# on the server and '1' on the clients.    


# 为防止遭到DDoS***    
# 生成ta.key文件,并cp到服务器端和每个客户端      
# 该文件用以下命令生成      
# open*** --genkey --secret ta.key      
# 服务器端0,客户端1      
# 该文件要严格保护

;tls-auth ta.key 0 # This file is secret

# Select a cryptographic cipher.  
# This config item must be copied to    
# the client config file as well.    


# 选择一种加密算法,Server端和Client端必须一样
;cipher BF-CBC        # Blowfish (default)    
;cipher AES-128-CBC   # AES    
;cipher DES-EDE3-CBC  # Triple-DES

# Enable compression on the ××× link.  
# If you enable it here, you must also    
# enable it in the client config file.    


# 允许数据压缩    
# 客户端配置文件也需要有这项

comp-lzo

# The maximum number of concurrently connected  
# clients we want to allow.    


# 最大客户端并发连接数量
;max-clients 100

# It's a good idea to reduce the Open×××  
# daemon's privileges after initialization.    
#    
# You can uncomment this out on    
# non-Windows systems.    


# 定义运行open***的用户
;user nobody    
;group nobody

# The persist options will try to avoid  
# accessing certain resources on restart    
# that may no longer be accessible because    
# of the privilege downgrade.    


#通过keepalive检测超时后,重新启动×××,不重新读取keys,保留第一次使用的keys
persist-key    


#通过keepalive检测超时后,重新启动×××,一直保持tun或者tap设备是linkup的,    
#否则网络连接会先linkdown然后linkup

persist-tun

# Output a short status file showing  
# current connections, truncated    
# and rewritten every minute.    


#定期把open***的一些状态信息写到文件中,以便自己写程序计费或者进行其他操作
status open***-status.log

# By default, log messages will go to the syslog (or  
# on Windows, if running as a service, they will go to    
# the "\Program Files\Open×××\log" directory).    
# Use log or log-append to override this default.    
# "log" will truncate the log file on Open××× startup,    
# while "log-append" will append to it.  Use one    
# or the other (but not both).    


#记录日志,每次重新启动open***后删除原有的log信息
;log         open***.log    


#记录日志,每次重新启动open***后追加原有的log信息
;log-append  open***.log

# Set the appropriate level of log  
# file verbosity.    
#    
# 0 is silent, except for fatal errors    
# 4 is reasonable for general usage    
# 5 and 6 can help to debug connection problems    
# 9 is extremely verbose    


#设置日志要记录的级别。    
#0 只记录错误信息。      
#4 能记录普通的信息。      
#5 和 6 在连接出现问题时能帮助调试      
#9 是极端的,所有信息都会显示,甚至连包头等信息都显示(像tcpdump)

verb 3

# Silence repeating messages.  At most 20  
# sequential messages of the same message    
# category will be output to the log.    


#相同信息的数量,如果连续出现 20 条相同的信息,将不记录到日志中。
;mute 20


好了,到这里我们配置文件说明就到这里了,嘿嘿!最后,希望大家有所收获^_^……