1. #################################################
  2. # Sample OpenVPN 2.0 config file for #
  3. # multi-client server. #
  4. # #
  5. # This file is for the server side #
  6. # of a many-clients <-> one-server #
  7. # OpenVPN configuration. #
  8. # #
  9. # OpenVPN also supports #
  10. # single-machine <-> single-machine #
  11. # configurations (See the Examples page #
  12. # on the web site for more info). #
  13. # #
  14. # This config should work on Windows #
  15. # or Linux/BSD systems. Remember on #
  16. # Windows to quote pathnames and use #
  17. # double backslashes, e.g.: #
  18. # "C:\\Program Files\\OpenVPN\\config\\foo.key" #
  19. # #
  20. # Comments are preceded with '#' or ';' #
  21. #################################################
  22. # Which local IP address should OpenVPN
  23. # listen on? (optional)
  24. ;local a.b.c.d
  25. # Which TCP/UDP port should OpenVPN listen on?
  26. # If you want to run multiple OpenVPN instances
  27. # on the same machine, use a different port
  28. # number for each one. You will need to
  29. # open up this port on your firewall.
  30. port 1194
  31. # TCP or UDP server?
  32. ;proto tcp
  33. proto udp
  34. # "dev tun" will create a routed IP tunnel,
  35. # "dev tap" will create an ethernet tunnel.
  36. # Use "dev tap0" if you are ethernet bridging
  37. # and have precreated a tap0 virtual interface
  38. # and bridged it with your ethernet interface.
  39. # If you want to control access policies
  40. # over the VPN, you must create firewall
  41. # rules for the the TUN/TAP interface.
  42. # On non-Windows systems, you can give
  43. # an explicit unit number, such as tun0.
  44. # On Windows, use "dev-node" for this.
  45. # On most systems, the VPN will not function
  46. # unless you partially or fully disable
  47. # the firewall for the TUN/TAP interface.
  48. ;dev tap
  49. dev tun
  50. # Windows needs the TAP-Win32 adapter name
  51. # from the Network Connections panel if you
  52. # have more than one. On XP SP2 or higher,
  53. # you may need to selectively disable the
  54. # Windows firewall for the TAP adapter.
  55. # Non-Windows systems usually don't need this.
  56. ;dev-node MyTap
  57. # SSL/TLS root certificate (ca), certificate
  58. # (cert), and private key (key). Each client
  59. # and the server must have their own cert and
  60. # key file. The server and all clients will
  61. # use the same ca file.
  62. #
  63. # See the "easy-rsa" directory for a series
  64. # of scripts for generating RSA certificates
  65. # and private keys. Remember to use
  66. # a unique Common Name for the server
  67. # and each of the client certificates.
  68. #
  69. # Any X509 key management system can be used.
  70. # OpenVPN can also use a PKCS #12 formatted key file
  71. # (see "pkcs12" directive in man page).
  72. ca /etc/openvpn/keys/ca.crt
  73. cert /etc/openvpn/keys/server.crt
  74. key /etc/openvpn/keys/server.key # This file should be kept secret
  75. dh /etc/openvpn/keys/dh2048.pem
  76. # Diffie hellman parameters.
  77. # Generate your own with:
  78. # openssl dhparam -out dh2048.pem 2048
  79. #dh dh2048.pem
  80. # Network topology
  81. # Should be subnet (addressing via IP)
  82. # unless Windows clients v2.0.9 and lower have to
  83. # be supported (then net30, i.e. a /30 per client)
  84. # Defaults to net30 (not recommended)
  85. ;topology subnet
  86. # Configure server mode and supply a VPN subnet
  87. # for OpenVPN to draw client addresses from.
  88. # The server will take 10.8.0.1 for itself,
  89. # the rest will be made available to clients.
  90. # Each client will be able to reach the server
  91. # on 10.8.0.1. Comment this line out if you are
  92. # ethernet bridging. See the man page for more info.
  93. server 10.8.0.0 255.255.255.0
  94. # Maintain a record of client <-> virtual IP address
  95. # associations in this file. If OpenVPN goes down or
  96. # is restarted, reconnecting clients can be assigned
  97. # the same virtual IP address from the pool that was
  98. # previously assigned.
  99. client-config-dir ccd
  100. ifconfig-pool-persist ipp.txt
  101. route 192.168.0.0 255.255.255.0
  102. tls-server
  103. tls-auth /etc/openvpn/keys/ta.key 0
  104. tls-timeout 120
  105. auth SHA1
  106. cipher AES-256-CBC
  107. # Configure server mode for ethernet bridging.
  108. # You must first use your OS's bridging capability
  109. # to bridge the TAP interface with the ethernet
  110. # NIC interface. Then you must manually set the
  111. # IP/netmask on the bridge interface, here we
  112. # assume 10.8.0.4/255.255.255.0. Finally we
  113. # must set aside an IP range in this subnet
  114. # (start=10.8.0.50 end=10.8.0.100) to allocate
  115. # to connecting clients. Leave this line commented
  116. # out unless you are ethernet bridging.
  117. ;server-bridge 10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100
  118. # Configure server mode for ethernet bridging
  119. # using a DHCP-proxy, where clients talk
  120. # to the OpenVPN server-side DHCP server
  121. # to receive their IP address allocation
  122. # and DNS server addresses. You must first use
  123. # your OS's bridging capability to bridge the TAP
  124. # interface with the ethernet NIC interface.
  125. # Note: this mode only works on clients (such as
  126. # Windows), where the client-side TAP adapter is
  127. # bound to a DHCP client.
  128. ;server-bridge
  129. # Push routes to the client to allow it
  130. # to reach other private subnets behind
  131. # the server. Remember that these
  132. # private subnets will also need
  133. # to know to route the OpenVPN client
  134. # address pool (10.8.0.0/255.255.255.0)
  135. # back to the OpenVPN server.
  136. ;push "route 192.168.10.0 255.255.255.0"
  137. ;push "route 192.168.20.0 255.255.255.0"
  138. # To assign specific IP addresses to specific
  139. # clients or if a connecting client has a private
  140. # subnet behind it that should also have VPN access,
  141. # use the subdirectory "ccd" for client-specific
  142. # configuration files (see man page for more info).
  143. # EXAMPLE: Suppose the client
  144. # having the certificate common name "Thelonious"
  145. # also has a small subnet behind his connecting
  146. # machine, such as 192.168.40.128/255.255.255.248.
  147. # First, uncomment out these lines:
  148. #;client-config-dir ccd
  149. #;route 192.168.40.128 255.255.255.248
  150. # Then create a file ccd/Thelonious with this line:
  151. # iroute 192.168.40.128 255.255.255.248
  152. # This will allow Thelonious' private subnet to
  153. # access the VPN. This example will only work
  154. # if you are routing, not bridging, i.e. you are
  155. # using "dev tun" and "server" directives.
  156. # EXAMPLE: Suppose you want to give
  157. # Thelonious a fixed VPN IP address of 10.9.0.1.
  158. # First uncomment out these lines:
  159. #;client-config-dir ccd
  160. #;route 10.9.0.0 255.255.255.252
  161. # Then add this line to ccd/Thelonious:
  162. # ifconfig-push 10.9.0.1 10.9.0.2
  163. # Suppose that you want to enable different
  164. # firewall access policies for different groups
  165. # of clients. There are two methods:
  166. # (1) Run multiple OpenVPN daemons, one for each
  167. # group, and firewall the TUN/TAP interface
  168. # for each group/daemon appropriately.
  169. # (2) (Advanced) Create a script to dynamically
  170. # modify the firewall in response to access
  171. # from different clients. See man
  172. # page for more info on learn-address script.
  173. ;learn-address ./script
  174. # If enabled, this directive will configure
  175. # all clients to redirect their default
  176. # network gateway through the VPN, causing
  177. # all IP traffic such as web browsing and
  178. # and DNS lookups to go through the VPN
  179. # (The OpenVPN server machine may need to NAT
  180. # or bridge the TUN/TAP interface to the internet
  181. # in order for this to work properly).
  182. ;push "redirect-gateway def1 bypass-dhcp"
  183. # Certain Windows-specific network settings
  184. # can be pushed to clients, such as DNS
  185. # or WINS server addresses. CAVEAT:
  186. # http://openvpn.net/faq.html#dhcpcaveats
  187. # The addresses below refer to the public
  188. # DNS servers provided by opendns.com.
  189. ;push "dhcp-option DNS 208.67.222.222"
  190. ;push "dhcp-option DNS 208.67.220.220"
  191. # Uncomment this directive to allow different
  192. # clients to be able to "see" each other.
  193. # By default, clients will only see the server.
  194. # To force clients to only see the server, you
  195. # will also need to appropriately firewall the
  196. # server's TUN/TAP interface.
  197. client-to-client
  198. # Uncomment this directive if multiple clients
  199. # might connect with the same certificate/key
  200. # files or common names. This is recommended
  201. # only for testing purposes. For production use,
  202. # each client should have its own certificate/key
  203. # pair.
  204. #
  205. # IF YOU HAVE NOT GENERATED INDIVIDUAL
  206. # CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
  207. # EACH HAVING ITS OWN UNIQUE "COMMON NAME",
  208. # UNCOMMENT THIS LINE OUT.
  209. ;duplicate-cn
  210. # The keepalive directive causes ping-like
  211. # messages to be sent back and forth over
  212. # the link so that each side knows when
  213. # the other side has gone down.
  214. # Ping every 10 seconds, assume that remote
  215. # peer is down if no ping received during
  216. # a 120 second time period.
  217. keepalive 10 120
  218. # For extra security beyond that provided
  219. # by SSL/TLS, create an "HMAC firewall"
  220. # to help block DoS attacks and UDP port flooding.
  221. #
  222. # Generate with:
  223. # openvpn --genkey --secret ta.key
  224. #
  225. # The server and each client must have
  226. # a copy of this key.
  227. # The second parameter should be '0'
  228. # on the server and '1' on the clients.
  229. #tls-auth ta.key 0 # This file is secret
  230. # Select a cryptographic cipher.
  231. # This config item must be copied to
  232. # the client config file as well.
  233. # Note that v2.4 client/server will automatically
  234. # negotiate AES-256-GCM in TLS mode.
  235. # See also the ncp-cipher option in the manpage
  236. #cipher AES-256-CBC
  237. # Enable compression on the VPN link and push the
  238. # option to the client (v2.4+ only, for earlier
  239. # versions see below)
  240. ;compress lz4-v2
  241. ;push "compress lz4-v2"
  242. # For compression compatible with older clients use comp-lzo
  243. # If you enable it here, you must also
  244. # enable it in the client config file.
  245. comp-lzo
  246. # The maximum number of concurrently connected
  247. # clients we want to allow.
  248. max-clients 100
  249. # It's a good idea to reduce the OpenVPN
  250. # daemon's privileges after initialization.
  251. #
  252. # You can uncomment this out on
  253. # non-Windows systems.
  254. user nobody
  255. group nogroup
  256. # The persist options will try to avoid
  257. # accessing certain resources on restart
  258. # that may no longer be accessible because
  259. # of the privilege downgrade.
  260. persist-key
  261. persist-tun
  262. # Output a short status file showing
  263. # current connections, truncated
  264. # and rewritten every minute.
  265. #status /var/log/openvpn/openvpn-status.log
  266. status openvpn-status.log
  267. log /var/log/openvpn.log
  268. #log /var/log/openvpn/openvpn.log
  269. #log-append /var/log/openvpn/openvpn.log
  270. # By default, log messages will go to the syslog (or
  271. # on Windows, if running as a service, they will go to
  272. # the "\Program Files\OpenVPN\log" directory).
  273. # Use log or log-append to override this default.
  274. # "log" will truncate the log file on OpenVPN startup,
  275. # while "log-append" will append to it. Use one
  276. # or the other (but not both).
  277. # Set the appropriate level of log
  278. # file verbosity.
  279. #
  280. # 0 is silent, except for fatal errors
  281. # 4 is reasonable for general usage
  282. # 5 and 6 can help to debug connection problems
  283. # 9 is extremely verbose
  284. verb 3
  285. # Silence repeating messages. At most 20
  286. # sequential messages of the same message
  287. # category will be output to the log.
  288. mute 20
  289. # Notify the client that when the server restarts so it
  290. # can automatically reconnect.
  291. explicit-exit-notify 1