option server
server 10.8.0.0 255.255.255.0
The OpenVPN server configuration directive server 10.8.0.0 255.255.255.0 specifies the virtual network that OpenVPN will create and use for its connected clients.
Key Components and Function
This directive tells the OpenVPN server to:
Allocate IP Addresses: The server will assign IP addresses to connecting clients from the specified subnet, which is 10.8.0.0/24 (or 10.8.0.0 with the subnet mask 255.255.255.0). This means client IPs will range from 10.8.0.2 up to 10.8.0.254.
Set the Server’s IP: The server itself typically takes the first usable address in this range, which is 10.8.0.1, as its IP address on the VPN tunnel interface (e.g.,
tun0ortap0).Establish Routing: It sets up the internal routing necessary for the server and clients to communicate within the VPN tunnel.
Detailed Breakdown
Component |
Value |
Description |
|---|---|---|
|
(Directive) |
This is the OpenVPN command that automatically configures |
|
Network Address |
The starting address of the virtual subnet. This is the Network ID. |
|
Subnet Mask |
The mask that defines the size of the subnet. A |
Importance and Context
This is one of the most fundamental and necessary directives in an OpenVPN server configuration file (server.conf).
Virtual Tunnel: The subnet specified here is entirely separate from your physical local area network (LAN) or the public internet. It exists only within the encrypted VPN tunnel.
Address Conflict Avoidance: It’s crucial that the 10.8.0.0/24 subnet does not overlap with the subnet of your local physical network or any other network the clients might need to access. If it does, routing conflicts will occur, and the VPN won’t function correctly.
Simplifies Configuration: Using the
serverdirective is often preferred over manually setting up individual IP addresses and push routes, as it handles the necessary routing and client configuration commands automatically. The server automatically “pushes” the correct VPN gateway information and other settings to the connecting clients.