Skip to content

Instantly share code, notes, and snippets.

@mondalaci
Created April 4, 2013 00:54
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save mondalaci/5306813 to your computer and use it in GitHub Desktop.
Save mondalaci/5306813 to your computer and use it in GitHub Desktop.
OpenVPN configuration on OpenWrt
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
Copy link

ghost commented Jan 27, 2017

error line 15 "< <END" => "<<END"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment