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 [2017/01/31 12:53] – 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 21: | Line 23: | ||
| Better is to create second OpenWRT interface " | Better is to create second OpenWRT interface " | ||
| - | To use other external IP firewall needs to be configured manually by / | + | To use other external IP firewall needs to be configured manually by: |
| + | <file bash | / | ||
| + | iptables -A input_wan_rule -d $WAN2_NET/ | ||
| + | iptables -t nat -A prerouting_wan_rule -p tcp -d $WAN2_IP3 --dport 80 -j DNAT --to-destination 192.168.0.90: | ||
| + | # goal is to do not pass into default WAN rules | ||
| + | iptables -t nat -A prerouting_wan_rule -d $WAN2_NET/ | ||
| + | </ | ||
| - | ====== | + | ====== |
| - | <code bash> | + | <file | /etc/ |
| - | Enable incoming OpenVPN connections: | + | # set tag " |
| + | dhcp-userclass=set:ENH,iPXE | ||
| - | <code bash> | + | # alternative way, look for option 175 |
| - | uci add firewall rule | + | #dhcp-match=set:ENH,175 |
| - | 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 " | + | # UNDI |
| - | echo " | + | dhcp-boot=tag: |
| - | echo " | + | |
| - | echo " | + | |
| - | </ | + | |
| - | <code bash> | + | # PXE |
| - | mkdir -o / | + | dhcp-boot=tag: |
| - | uci set openvpn.uservpn=openvpn | + | </file> |
| - | uci set openvpn.uservpn.config=/ | + | |
| - | uci set openvpn.uservpn.enable=1 | + | |
| - | uci commit openvpn | + | |
| - | </code> | + | |
| - | cat > / | ||
| - | port 1194 | ||
| - | proto udp | ||
| - | dev tap0 | ||
| - | | ||
| - | | ||
| - | verb 3 | ||
| - | | ||
| - | Add VPN to local LAN bridge: | ||
| - | <code bash> | + | ====== Backup ====== |
| - | cat > /etc/init.d/openvpn-bridge | + | [[https://wiki.openwrt.org/doc/howto/generic.backup]] |
| - | #!/bin/sh /etc/rc.common | + | |
| - | + | ||
| - | START=94 | + | |
| - | + | ||
| - | start() { | + | |
| - | openvpn --mktun --dev tap0 | + | |
| - | 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 | + | |
| - | } | + | |
| + | ====== Periodic reboot ====== | ||
| - | chmod 755 /etc/ | + | ===== cron job ===== |
| - | /etc/init.d/ | + | < |
| - | /etc/init.d/ | + | # Reboot at 4:30am every day |
| + | # Note: To avoid infinite reboot loop, wait 70 seconds | ||
| + | # and touch a file in /etc so clock will be set | ||
| + | # properly to 4:31 on reboot before cron starts. | ||
| + | 30 4 * * * sleep 70 && touch /etc/banner && reboot | ||
| </ | </ | ||
| - | < | + | or independent on system time |
| - | openvpn | + | < |
| + | 30 4 * * * [ $( cat / | ||
| </ | </ | ||
| - | Start VPN: | + | ===== watchcat ===== |
| <code bash> | <code bash> | ||
| - | / | + | opkg install watchcat luci-app-watchcat |
| - | / | + | |
| </ | </ | ||
| + | And '' | ||
| ====== Issues ====== | ====== Issues ====== | ||