Assigning Static IP on OpenVPN Linux Ubuntu 12.04



  • Hi Everyone,

    Is there anyone who can help me to assign static IP on OpenVPN using Ubuntu 12.04.

    Here's my config on my server.conf:
    port 1194
    proto udp
    dev tun
    ca ca.crt
    cert myserver.crt
    key myserver.key # This file should be kept secret
    dh dh1024.pem
    server 10.8.0.0 255.255.255.0
    ifconfig-pool-persist ipp.txt
    client-config-dir ccd
    push "redirect-gateway def1 bypass-dhcp"
    push "dhcp-option DNS 208.67.222.222"
    push "dhcp-option DNS 208.67.220.220"
    client-to-client
    keepalive 10 120
    comp-lzo
    max-clients 10
    persist-key
    persist-tun
    status openvpn-status.log
    verb 3
    mute 20

    And I created a ccd directory and config:
    mkdir /etc/openvpn/ccd
    touch /etc/openvpn/ccd/username1

    /etc/openvpn/ccd/username1:
    Code:
    ifconfig-push 10.8.0.9 10.8.0.10

    But did not getting the IP I assigned it gives the dhcp availabale IP.

    Hope someone can help me with this.

    Thanks in advance



  • Pinging this one to get more eyeballs on it.



  • @mlnews said:

    Pinging this one to get more eyeballs on it.

    Thanks @mlnews



  • Have you restarted the OpenVPN service by any chance?



  • @dafyre said:

    Have you restarted the OpenVPN service by any chance?

    Yes it has restarted a lots of time.



  • Have you tried:

    ifconfig-push 10.8.0.10 10.8.0.9 
    

    ?



  • Hi dafyre thanks for the reply. Yes Joy and I tried that as well. We tried to change IP's based on IP Addressing schema below:

    [ 1, 2] [ 5, 6] [ 9, 10] [ 13, 14] [ 17, 18]
    [ 21, 22] [ 25, 26] [ 29, 30] [ 33, 34] [ 37, 38]
    [ 41, 42] [ 45, 46] [ 49, 50] [ 53, 54] [ 57, 58]
    [ 61, 62] [ 65, 66] [ 69, 70] [ 73, 74] [ 77, 78]
    [ 81, 82] [ 85, 86] [ 89, 90] [ 93, 94] [ 97, 98]... and so on

    but still no luck to get the static IP we assign. Still getting IP on DHCP.

    Thanks.



  • I also tried to use the ccd with different segment, with config below:

    server.conf
    client-config-dir /etc/openvpn/ccd
    route 10.8.2.0 255.255.255.0

    /etc/openvpn/ccd/username1:
    Code:
    ifconfig-push 10.8.2.9 10.8.2.10

    but still getting 10.8.0.x internal IP instead of 10.8.2.x.

    Also put in IPtables:
    iptables -A FORWARD -s 10.8.2.0/24 -j ACCEPT