Created
April 4, 2013 00:54
-
-
Save mondalaci/5306813 to your computer and use it in GitHub Desktop.
OpenVPN configuration on OpenWrt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat >> /etc/firewall << END | |
iptables -t filter -A input_wan -p udp --dport 1194 -j ACCEPT | |
iptables -I INPUT 1 -i tun+ -j ACCEPT | |
iptables -I FORWARD 1 -i tun+ -j ACCEPT | |
iptables -I OUTPUT 1 -o tun+ -j ACCEPT | |
iptables -I FORWARD 1 -o tun+ -j ACCEPT | |
END | |
/etc/init.d/firewall restart | |
opkg install openvpn | |
# I don't wanna convert my OpenVPN config to UCI-like format so I just replace the default init script. | |
mv /etc/init.d/openvpn /etc/init.d/openvpn.orig | |
cat >/etc/init.d/openvpn < <END | |
#!/bin/sh /etc/rc.common | |
START=99 | |
start() { | |
openvpn --daemon --config /etc/openvpn/server.conf | |
} | |
restart() { | |
stop | |
sleep 3 | |
start | |
} | |
reload() { | |
killall -SIGHUP openvpn | |
} | |
stop() { | |
killall openvpn | |
} | |
END | |
chmod 755 /etc/init.d/openvpn | |
/etc/init.d/openvpn start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
error line 15 "< <END" => "<<END"