meta data for this page
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| linux:openwrt [2015/06/30 14:37] – created niziak | linux:openwrt [2021/03/05 14:09] (current) – niziak | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| - | <code bash> | + | ====== First steps ====== |
| + | To use SSH, first telnet to router and set root password. | ||
| - | Enable | + | ====== |
| <code bash> | <code bash> | ||
| uci add firewall rule | uci add firewall rule | ||
| - | uci set firewall.@rule[-1]._name=openvpn | ||
| uci set firewall.@rule[-1].src=wan | uci set firewall.@rule[-1].src=wan | ||
| uci set firewall.@rule[-1].target=ACCEPT | uci set firewall.@rule[-1].target=ACCEPT | ||
| - | uci set firewall.@rule[-1].proto=udp | + | uci set firewall.@rule[-1].proto=tcp |
| - | uci set firewall.@rule[-1].dest_port=1194 | + | uci set firewall.@rule[-1].dest_port=22 |
| uci commit firewall | uci commit firewall | ||
| + | / | ||
| + | </ | ||
| - | echo "iptables | + | ====== Multiple WAN IP ====== |
| - | echo "iptables -I INPUT -i tap+ -j ACCEPT" | + | ===== same provider ==== |
| - | echo " | + | There are two method defining multiple WAN IP [[https:// |
| - | echo "iptables | + | In both cases, addresses are added to the same interface. |
| + | It is not possible to create 2nd firewall zone, like WAN2, because all iptables | ||
| + | |||
| + | Better is to create second OpenWRT interface | ||
| + | To use other external IP firewall needs to be configured manually by: | ||
| + | <file bash | / | ||
| + | iptables -A input_wan_rule | ||
| + | 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/ | ||
| + | </file> | ||
| + | |||
| + | |||
| + | ====== PXE boot ====== | ||
| + | |||
| + | <file | /etc/dnsmasq.conf> | ||
| + | |||
| + | # set tag "ENH" if request comes from iPXE (" | ||
| + | dhcp-userclass=set: | ||
| + | |||
| + | # alternative way, look for option 175 | ||
| + | #dhcp-match=set: | ||
| + | |||
| + | # UNDI | ||
| + | dhcp-boot=tag: | ||
| + | |||
| + | # PXE | ||
| + | dhcp-boot=tag: | ||
| + | </file> | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ====== Backup ====== | ||
| + | [[https:// | ||
| + | |||
| + | ====== Periodic reboot ====== | ||
| + | |||
| + | ===== cron job ===== | ||
| + | <code> | ||
| + | # 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 |
| - | mkdir -o /etc/openvpn | + | < |
| - | uci set openvpn.uservpn=openvpn | + | 30 4 * * * [ $( cat /proc/uptime | cut -d '.' |
| - | uci set openvpn.uservpn.config=/ | + | |
| - | uci set openvpn.uservpn.enable=1 | + | |
| - | uci commit openvpn | + | |
| </ | </ | ||
| - | cat > / | + | ===== watchcat ===== |
| + | <code bash> | ||
| + | opkg install watchcat luci-app-watchcat | ||
| + | </ | ||
| - | port 1194 | + | And '' |
| - | proto udp | + | |
| - | dev tap0 | + | |
| - | | + | |
| - | | + | |
| - | verb 3 | + | |
| - | | + | |
| + | ====== Issues ====== | ||
| + | Problem: Port-forwarded traffic are always from router local IP instead of real external IP address. | ||
| + | Solution: Disable masq option for LAN zone (should be only on WAN) zone | ||