openvpn - ifconfig parameter

7,275

From OpenVPNs own documentation:

# 10.1.0.2 is our local VPN endpoint (home).
# 10.1.0.1 is our remote VPN endpoint (office).
ifconfig 10.1.0.2 10.1.0.1

In other words this is when you want your VPN clients to assign their own VPN IP address.

The client will in my example have the IP address 10.1.0.2 and the VPN gateway will have the IP address 10.1.0.1.

Found it on my Ubuntu server under /usr/share/doc/openvpn/examples/sample-config-files/static-home.conf


The alternative is using client-config-dir <path> in OpenVPN servers master file and let all clients connect to the server using a client certificate with unique CommonName in the certificate.

Lets say you have setup client-config-dir to point to the subdirectory ccd.

You can then create a file with a name matching the CommonName in each client certificate that contains the line ifconfig-push <IP address> <subnet mask>. Using my example above:

ifconfig-push 10.1.0.2 255.255.255.0

This assumes you have a line in the servers master config file that contains the line:

server 10.1.0.0 255.255.255.0
Share:
7,275

Related videos on Youtube

umar14
Author by

umar14

Electronics and Programming Enthusiast I program in Python / Bash / C and work as a Radar Engineer maintaining a Linux server. I can write applications and scripts in Python, do server administration and write firmware for microcontrollers. I am also an active Freelancer on Fiverr

Updated on September 18, 2022

Comments

  • umar14
    umar14 almost 2 years

    What does ifconfig parameter in openvpn configuration file mean? Here is an example file:

    dev tun0
    proto udp
    comp-lzo
    port 5073
    remote 172.16.23.73 5073
    ifconfig 172.17.3.41 172.17.3.43
    
  • umar14
    umar14 over 4 years
    Thank you for explaining this!