Asus Router VPN – Static IPs for VPN Clients

asusopenvpnstatic-ip

I have asus router RT-AC58U (fw 3.0.0.4.382_51899) and have successfully set up OpenVPN.
Here are my custom settings:
OpenVPN custom settings

these setting automatically generate file

config.ovpn

# Automatically generated configuration

# Tunnel options
proto udp
multihome
port 1194
dev tun21
sndbuf 0
rcvbuf 0
keepalive 15 60
daemon vpnserver1
verb 3
status-version 2
status status 10
comp-lzo adaptive
plugin /usr/lib/openvpn-plugin-auth-pam.so openvpn

# Server Mode
server 10.8.0.0 255.255.255.0
client-config-dir ccd
client-to-client
duplicate-cn
route 10.8.0.8 255.255.255.128
push "route 192.168.1.0 255.255.255.0 vpn_gateway 500"
push "redirect-gateway def1"
push "dhcp-option DNS 192.168.1.1"

# Data Channel Encryption Options
auth SHA1

# TLS Mode Options
ca ca.crt
dh dh.pem
cert server.crt
key server.key

# Custom Configuration

I know it is possible to to create file in ccd directory with

ifconfig-push ip mask

but I cannot create them manually, everything is generated.
I can enable client specific options and add clients throught ui, which generates ccd directory with client files, but the generated content looks like this:

iroute 10.8.0.8 255.255.255.128

Is it possible to assign VPN clients static IP addresses?

I also have only one client.ovpn possible to export which has always the same CN == client

Best Answer

I managed to make it work by applying following steps:

  1. You need to activate ssh access to your router (+ setup username and password)
  2. Login to your router ssh username@routerIp
  3. There is a writable directory /jffs. Create some config structure under it e.g. /jffs/configs/openvpn/ccd (use mkdir)
  4. In ccd dir create file with same name as your vpn client username (e.g. touch nuc)
  5. Write config for your client in this file (vi nuc)
  6. Write your client's config there using format ifconfig-push staticIP mask (e.g. ifconfig-push 10.0.8.10 255.255.255.0) and save
  7. Leave secure shell (exit)
  8. Log into your router's ui, go to OpenVpn setup menu and fill the path to your client config into "Custom Configuration" field: client-config-dir /jffs/configs/openvpn/ccd Also don't forget to switch Username / Password Auth. Only to "Yes" (otherwise client config files should be named by client's CN)
  9. Save router config clicking on Apply button

Now you can connect with vpn client and you will get the set up IP (mine was 10.0.8.10)