I have an OpenVPN server running on an embedded Linux device. The clients connect to it through a wireless WAN interface. The server also has a LAN interface with a static IP that I manually configured.
I noticed that the server automatically assigns new clients to an IP address in the same subnet as the static IP on the LAN. That happens to be exactly the behavior that I wanted, but I don't understand why it works. I did not explicitly configure the server to do that. What would happen, for example, if I had two LAN interfaces with different static IPs? Does it just default to the subnet of the first other interface it finds? Is this behavior explained in the documentation somewhere?
Here is the server configuration file (this is in OpenWRT, but it should be clear how the options are applied):
config openvpn 'myvpn'
option enabled '1'
option verb '3'
option proto 'udp'
option port '1194'
option dev 'tap'
option mode 'server'
option tls_server '1'
list push 'route-gateway dhcp'
option keepalive '10 120'
option ca '/etc/openvpn/ca.crt'
option cert '/etc/openvpn/server.crt'
option key '/etc/openvpn/server.key'
option dh '/etc/openvpn/dh2048.pem'
option log '/var/log/openvpn.log'