I would be very grateful if someone whoes setup is working properly could compare my scripts to their own to help identify the issue, please let me know if there's anything that doesn't look right.
It currently doesn't show the VPN IP as my DNS after the router is rebooted, so there's obviously an issue somewhere. I currently have a workaround in the "services-start" file to start "unbound_via_vc1.sh".
Here are almost all of my scripts:
dnsmasq.postconf
Code:
#!/bin/sh
. /opt/share/diversion/file/post-conf.div # Added by Diversion
sh /jffs/addons/unbound/unbound.postconf "$1" # unbound_manager
firewall-start
Code:
#!/bin/sh
sh /jffs/scripts/firewall start skynetloc=/tmp/mnt/MicroSD/skynet # Skynet
init-start
Code:
#!/bin/sh
sh /jffs/addons/unbound/stuning start # unbound_manager
modprobe xt_comment
nat-start
Code:
#!/bin/sh
sh /jffs/scripts/x3mRouting/x3mRouting.sh 1 0 WAN_IP dnsmasq=whatsmyip.com
sh /jffs/scripts/x3mRouting/x3mRouting.sh ALL 1 VPN_IP dnsmasq=whatismyip.com
openvpn-event
Code:
#!/bin/sh
[ -s /jffs/scripts/x3mRouting/openvpn-event ] && sh /jffs/scripts/x3mRouting/openvpn-event $@
post-mount
Code:
#!/bin/sh
swapon /tmp/mnt/MicroSD/myswap.swp # Added by amtm
. /jffs/addons/diversion/mount-entware.div # Added by Diversion
/jffs/addons/unbound/unbound_stats.sh startup "$@" & # Unbound_Stats.sh
service-event
Code:
#!/bin/sh
[ "$2" = diversion ] && sh /opt/share/diversion/webui/process.div "$1" & # Added by Diversion
if [ "$1" = "start" ] && [ "$2" = "SkynetStats" ]; then sh /jffs/scripts/firewall debug genstats; fi # Skynet
/jffs/addons/unbound/unbound_stats.sh generate "$1" "$2" & # Unbound_Stats.sh
services-start
Code:
#!/bin/sh
cru a root_servers "12 4 * * * curl -o \/opt\/var\/lib\/unbound\/root\.hints https://www.internic.net/domain/named.cache" # unbound_manager
sleep 30 && sh /jffs/scripts/unbound_via_vc1.sh start & # My reboot workaround fix
services-stop
Code:
#!/bin/sh
/opt/etc/init.d/rc.unslung stop # Added by Diversion
sh /jffs/scripts/firewall save # Skynet
unmount
Code:
#!/bin/sh
[ "$(/usr/bin/find $1/entware/bin/diversion 2> /dev/null)" ] && diversion unmount # Added by Diversion
swapoff -a 2>/dev/null # Skynet
x3mRouting / vpnclient1-route-pre-down
Code:
#!/bin/sh
iptables -t mangle -D PREROUTING -i br0 -m set --match-set WAN_IP dst -j MARK --set-mark 0x8000/0x8000 2>/dev/null
iptables -t mangle -D PREROUTING -i br0 -m set --match-set VPN_IP dst -j MARK --set-mark 0x1000/0x1000 2>/dev/null
/jffs/scripts/unbound_via_vc1.sh stop &
x3mRouting / vpnclient1-route-up
Code:
#!/bin/sh
iptables -t mangle -D PREROUTING -i br0 -m set --match-set WAN_IP dst -j MARK --set-mark 0x8000/0x8000 2>/dev/null
iptables -t mangle -A PREROUTING -i br0 -m set --match-set WAN_IP dst -j MARK --set-mark 0x8000/0x8000
iptables -t mangle -D PREROUTING -i br0 -m set --match-set VPN_IP dst -j MARK --set-mark 0x1000/0x1000 2>/dev/null
iptables -t mangle -A PREROUTING -i br0 -m set --match-set VPN_IP dst -j MARK --set-mark 0x1000/0x1000
/jffs/scripts/unbound_via_vc1.sh start &
Update:
Reboot issue is sorted, reinstalled Unbound and this time the following was added to "services-start":
Code:
#!/bin/sh
cru a root_servers "12 4 * * * curl -o \/opt\/var\/lib\/unbound\/root\.hints https://www.internic.net/domain/named.cache" # unbound_manager
/jffs/addons/unbound/unbound_rpz.sh startup # Unbound_RPZ.sh
It now survives a reboot, going to add this to the guide. No idea why it didn't add this line the previous times I reinstalled Unbound. I'll keep an eye on it and hopefully it will maintain the VPN IP.