Configuring OpenVPN client in OpenWrt
Below steps are based on this article.
It is assumed that OpenVPN configuration files will be located under /etc/openvpn .
- If you haven’t done it already, then install openvpn ‘opkg update’ followed by ‘opkg install openvpn-openssl’
- scp ca.crt, crl.pem and myConfig.ovpn to /etc/openvpn -> feel free to create the folder if it does not exist
- create credentials file -> /etc/openvpn/myCred.p with 2 lines: username/password
- edit myConfig.ovpn and make sure ‘auth-user-pass’ is followed by ‘/etc/openvpn/myCred.p’
- also set ‘dev tun0’, comment out ‘persist-tun’ and add ‘redirect-gateway def1’
- save
- 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