meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| linux:openwrt [2018/10/18 13:00] – niziak | linux:openwrt [2021/03/05 14:09] (current) – niziak | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== OpenWRT ====== | ||
| + | |||
| ====== First steps ====== | ====== First steps ====== | ||
| To use SSH, first telnet to router and set root password. | To use SSH, first telnet to router and set root password. | ||
| Line 48: | Line 50: | ||
| </ | </ | ||
| - | ====== OpenVPN ====== | ||
| - | <code bash> | ||
| - | Enable incoming OpenVPN connections: | ||
| - | <code bash> | + | ====== Backup ====== |
| - | uci add firewall rule | + | [[https:// |
| - | uci set firewall.@rule[-1]._name=openvpn | + | |
| - | uci set firewall.@rule[-1].src=wan | + | |
| - | uci set firewall.@rule[-1].target=ACCEPT | + | |
| - | uci set firewall.@rule[-1].proto=udp | + | |
| - | uci set firewall.@rule[-1].dest_port=1194 | + | |
| - | uci commit firewall | + | |
| - | echo " | + | ====== Periodic reboot ====== |
| - | echo " | + | |
| - | echo " | + | |
| - | echo " | + | |
| - | </ | + | |
| - | < | + | ===== cron job ===== |
| - | mkdir -o /etc/openvpn | + | < |
| - | uci set openvpn.uservpn=openvpn | + | # Reboot at 4:30am every day |
| - | uci set openvpn.uservpn.config=/etc/openvpn/ | + | # Note: To avoid infinite reboot loop, wait 70 seconds |
| - | uci set openvpn.uservpn.enable=1 | + | # and touch a file in /etc so clock will be set |
| - | uci commit openvpn | + | # properly to 4:31 on reboot before cron starts. |
| + | 30 4 * * * sleep 70 && touch /etc/banner && reboot | ||
| </ | </ | ||
| - | cat > / | + | or independent on system time |
| - | + | < | |
| - | port 1194 | + | 30 4 * * * [ $( cat /proc/uptime | cut -d '.' |
| - | proto udp | + | |
| - | dev tap0 | + | |
| - | | + | |
| - | | + | |
| - | verb 3 | + | |
| - | | + | |
| - | + | ||
| - | Add VPN to local LAN bridge: | + | |
| - | + | ||
| - | < | + | |
| - | cat > /etc/init.d/ | + | |
| - | #!/bin/sh /etc/rc.common | + | |
| - | + | ||
| - | START=94 | + | |
| - | + | ||
| - | start() { | + | |
| - | openvpn | + | |
| - | brctl addif br-lan tap0 | + | |
| - | ifconfig tap0 0.0.0.0 promisc up | + | |
| - | } | + | |
| - | + | ||
| - | stop() { | + | |
| - | ifconfig tap0 0.0.0.0 down | + | |
| - | brctl delif br-lan tap0 | + | |
| - | openvpn --rmtun --dev tap0 | + | |
| - | } | + | |
| - | + | ||
| - | + | ||
| - | chmod 755 / | + | |
| - | / | + | |
| - | / | + | |
| </ | </ | ||
| + | ===== watchcat ===== | ||
| <code bash> | <code bash> | ||
| - | openvpn | + | opkg install watchcat luci-app-watchcat |
| </ | </ | ||
| - | Start VPN: | + | And '' |
| - | <code bash> | + | |
| - | / | + | |
| - | / | + | |
| - | </ | + | |
| - | + | ||
| - | + | ||
| - | ====== Backup ====== | + | |
| - | [[https:// | + | |
| ====== Issues ====== | ====== Issues ====== | ||