OpenWrt Forum Archive

Topic: Openvpn - could not asssign fixed ip's to clients

The content of this topic has been archived on 11 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Got a problem with OpenVPN:

clients getting random address, not assigned by settings.
Tried to use ipp.txt and ccd, and looks like server just ignoring that settings by some unknown reason.

Maybe this is only OpenWrt problem? Is there some differences in client-config-files when UCI is used for config, like
list 'ifconfig-push' '10.0.0.5 10.0.0.1' instead of ifconfig-push 10.0.0.5 10.0.0.1 ?

Cannot really find examples for UCI with client-config-files.

(Last edited by watarych on 27 Jun 2013, 18:10)

Looks like i had solved it, but in a very strange way.

Half of parameter do not work as they described in docs, and they are described 100500 different ways in many different manuals.

So, if you using UCI, you need this:
- DELETE (not comment) strings "ifconfig-pool" and all about "ccd" in server config file
- add " option 'topology' 'subnet' " to server config file
- add path to your ipp.txt, mine is '/etc/config/ccd/ipp.txt' , '/tmp/openvpn/ipp.txt' also worked
- delete ALL WRITE PREMISSIONS to ipp.txt. Parameter 0 in '/etc/config/ccd/ipp.txt 0' IS NOT WORKING, and openvpn wipes file at every start
- add you clients, like " client1,10.0.0.5 " without quotes, to ipp.txt
- restart openvpn

Could you please post your server config file? I am not sure what "- add path to your ipp.txt, mine is '/etc/config/ccd/ipp.txt' , '/tmp/openvpn/ipp.txt' also worked" is supposed to mean. Thanks!

config openvpn 'lan'
        option 'enabled' '1'
        option 'port' 'your_port'
        option 'proto' 'udp'
        option 'dev' 'tun'
        option 'ca' '/etc/openvpn/ca.crt'
        option 'cert' '/etc/openvpn/server.crt'
        option 'key' '/etc/openvpn/server.key'
        option 'dh' '/etc/openvpn/dh1024.pem'
        option 'server' '10.10.1.0 255.255.255.0'
        option 'topology' 'subnet'
        option 'ifconfig_pool_persist' '/etc/config/ccd/ipp.txt 0'
        list 'push' 'route 192.168.10.0 255.255.255.0'
        list 'push' 'redirect-gateway'
        list 'push' 'dhcp-option DNS 10.10.1.1'
        option 'client_to_client' '1'
        option 'keepalive' '10 120'
        option 'max_clients' '3'
        option 'persist_key' '1'
        option 'persist_tun' '1'
        option 'status' '/tmp/openvpn-status.log'
        option 'verb' '9'

Thanks, this works!

The discussion might have continued from here.