My pretty face [ László Monda's Blog ]
Exploring the cyberspace, one quadrant at a time!

OpenVPN on OpenWrt

First of all, thanks the OpenVPN via TUN HowTo for the help! Now let's see the real deal.

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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

Leave a Reply

Line and paragraph breaks automatic.
XHTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">