Configuring OpenVPN client in OpenWrt

By Posted in - Blog on May 11th, 2016 0 Comments

Below steps are based on this article.

It is assumed that OpenVPN configuration files will be located under /etc/openvpn .

  1. If you haven’t done it already, then install openvpn ‘opkg update’ followed by ‘opkg install openvpn-openssl’
  2. scp ca.crt, crl.pem and myConfig.ovpn to /etc/openvpn -> feel free to create the folder if it does not exist
  3. create credentials file -> /etc/openvpn/myCred.p with 2 lines: username/password
  4. edit myConfig.ovpn and make sure ‘auth-user-pass’ is followed by ‘/etc/openvpn/myCred.p’
  5. also set ‘dev tun0’, comment out ‘persist-tun’ and add ‘redirect-gateway def1’
  6. save
  7. edit /etc/config/network and add
config interface 'vpn'
        option ifname 'tun0'
        option proto 'none'

8.  edit /etc/config/firewall and add
config zone
        option name             vpn
        list   network          'vpn'
        option input            REJECT
        option output           ACCEPT
        option forward          REJECT
        option masq             1

config forwarding
        option src              lan
        option dest             vpn

9. edit /etc/config/openvpn and make sure

config openvpn custom_config

 # Set to 1 to enable this instance:
 option enabled 1

 # Include OpenVPN configuration
 option config /etc/openvpn/myConfig.ovpn

10. reboot
11./etc/init.d/openvpn start
12. If internet is available, then make it permanent via
/etc/init.d/openvpn enable
 
 

Please leave a Comment

Solve : *
21 − 19 =