meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:openwrt [2017/01/31 13:29] – [same provider] niziaklinux: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 31: Line 33:
  
  
 +====== PXE boot ======
  
-====== OpenVPN ======+<file | /etc/dnsmasq.conf>
  
-<code bash>opkg install openvpn-openssl luci-app-openvpn openvpn-easy-rsa</code>+# set tag "ENH" if request comes from iPXE ("iPXE" user class) 
 +dhcp-userclass=set:ENH,iPXE
  
-Enable incoming OpenVPN connections:+# alternative way, look for option 175 
 +#dhcp-match=set:ENH,175
  
-<code bash> +# UNDI 
-uci add firewall rule +dhcp-boot=tag:!ENH,netboot.xyz-undionly.kpxe,myserver,192.168.0.231
-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 "iptables -I OUTPUT -o tap+ -j ACCEPT" >> /etc/firewall.user +# PXE 
-echo "iptables -I INPUT -i tap+ -j ACCEPT" >> /etc/firewall.user +dhcp-boot=tag:ENH,netboot.xyz.kpxe,myserver,192.168.0.231 
-echo "iptables -I FORWARD -o tap+ -j ACCEPT" >> /etc/firewall.user +</file>
-echo "iptables -I FORWARD -i tap+ -j ACCEPT" >> /etc/firewall.user +
-</code>+
  
-<code bash> 
-mkdir -o /etc/openvpn 
-uci set openvpn.uservpn=openvpn 
-uci set openvpn.uservpn.config=/etc/openvpn/user-vpn.conf 
-uci set openvpn.uservpn.enable=1 
-uci commit openvpn 
-</code> 
  
-cat > /etc/openvpn/user-vpn.conf 
  
-   port 1194 
-   proto udp 
-   dev tap0 
-   keepalive 10 120 
-   status /tmp/openvpn-status.log 
-   verb 3 
-   secret /etc/openvpn/secret.key 
  
-Add VPN to local LAN bridge:+====== Backup ====== 
 +[[https://wiki.openwrt.org/doc/howto/generic.backup]]
  
-<code bash> +====== Periodic reboot ======
-cat > /etc/init.d/openvpn-bridge +
-#!/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 +
-    }+
  
- +===== cron job ===== 
-chmod 755 /etc/init.d/openvpn-bridge  +<code> 
-/etc/init.d/openvpn-bridge enable +# Reboot at 4:30am every day 
-/etc/init.d/openvpn-bridge start+# 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
 </code> </code>
  
-<code bash+or independent on system time 
-openvpn --genkey --secret /etc/openvpn/secret.key+<code> 
 +30 4 * * *  [ $( cat /proc/uptime | cut -d '.' -f 1 ) -gt 3600 ] && reboot
 </code> </code>
  
-Start VPN:+===== watchcat =====
 <code bash> <code bash>
-/etc/init.d/openvpn enable +opkg install watchcat luci-app-watchcat
-/etc/init.d/openvpn start+
 </code> </code>
  
 +And ''luci'' menu will be available under ''Services''
  
 ====== Issues ====== ====== Issues ======