Getting IP address like "10.8.0.33/-1" when setting static IP address with OpenVPN

I'm trying to build an internal network with OpenVPN. Many services require static IPs so I referred to this

However after configuring, when I tried to connect, the client displayed the following error:

Sun Dec 10 09:08:09 2017 /sbin/ip link set dev tun0 up mtu 1500  
Sun Dec 10 09:08:09 2017 /sbin/ip addr add dev tun0 10.8.0.33/-1 broadcast 255.255.255.255  
Error: inet prefix is expected rather than "10.8.0.33/-1".  
Sun Dec 10 09:08:09 2017 Linux ip addr add failed: external program exited with error status: 1  
Sun Dec 10 09:08:09 2017 Exiting due to fatal error  

I can see that the client got an IP address "10.8.0.33/-1", which is invalid.

Any ideas? All kinds of help would be highly appreciated.


Solution 1:

In your ccd/ file you have to add the netmask information:

root@moon:/etc/openvpn# cat ccd/moon 
ifconfig-push 10.8.0.4/24 10.8.0.1
iroute 192.168.1.0   255.255.255.0