# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-set -eE -o pipefail
-trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
-
-# ssh
+x="$(readlink -f "$BASH_SOURCE")"; source "${x%/*}/bash-trace"
pmirror() {
# background: upgrading all packages is not recommended because it
config redirect
option src wan
- option src_dport 80
+ option src_dport 1194
option dest lan
option dest_ip 192.168.1.2
- option proto tcp
+ option proto udp
config rule
option src wan
option target ACCEPT
- option dest_port 80
- option proto tcp
+ option dest_port 1194
+ option proto udp
-config redirect
- option name syncthing
- option src wan
- option src_dport 22001
- option dest_ip 192.168.1.2
- option dest lan
-config rule
- option src wan
- option target ACCEPT
- option dest_port 22001
-#### begin rules for nfs ####
-# https://serverfault.com/questions/377170/which-ports-do-i-need-to-open-in-the-firewall-to-use-nfs
-# https://wiki.debian.org/SecuringNFS
-# I had no /etc/default/quota, or any process named quota anything,
-# so, assumed that was unneeded. seems to work.
config redirect
option src wan
- option src_dport 111
- option dest_ip 192.168.1.2
- option dest lan
-config rule
- option src wan
- option target ACCEPT
- option dest_port 111
-config redirect
- option src wan
- option src_dport 2049
- option dest_ip 192.168.1.2
- option dest lan
-config rule
- option src wan
- option target ACCEPT
- option dest_port 2049
-config redirect
- option src wan
- option src_dport 32764
- option dest_ip 192.168.1.2
- option dest lan
-config rule
- option src wan
- option target ACCEPT
- option dest_port 32764
-config redirect
- option src wan
- option src_dport 32765
- option dest_ip 192.168.1.2
- option dest lan
-config rule
- option src wan
- option target ACCEPT
- option dest_port 32765
-config redirect
- option src wan
- option src_dport 32766
- option dest_ip 192.168.1.2
+ option src_dport 80
option dest lan
-config rule
- option src wan
- option target ACCEPT
- option dest_port 32766
-config redirect
- option src wan
- option src_dport 32767
option dest_ip 192.168.1.2
- option dest lan
+ option proto tcp
config rule
option src wan
option target ACCEPT
- option dest_port 32767
+ option dest_port 80
+ option proto tcp
+
config redirect
+ option name syncthing
option src wan
- option src_dport 32768
+ option src_dport 22001
option dest_ip 192.168.1.2
option dest lan
config rule
option src wan
option target ACCEPT
- option dest_port 32768
-#### end rules for nfs ####
-
+ option dest_port 22001
-config redirect
- option name mariadb
- option src wan
- option src_dport 3306
- option dest lan
- option dest_ip 192.168.1.2
- option proto tcp
-config rule
- option src wan
- option target ACCEPT
- option dest_port 3306
- option proto tcp
EOF
dnsmasq_restart=false
v cedit /etc/hosts <<EOF || dnsmasq_restart=true
+127.0.1.1 wrt
192.168.1.1 wrt
-192.168.1.2 treetowl mail.iankelling.org $HOME_DOMAIN faiserver
+192.168.1.2 treetowl b8.nz faiserver
192.168.1.3 frodo
192.168.1.4 htpc
192.168.1.5 x2
# avoid using the dns servers that my isp tells me about.
if [[ $(uci get dhcp.@dnsmasq[0].resolvfile) ]]; then
# default is '/tmp/resolv.conf.auto', we switch to the dnsmasq default of
- # /etc/resolv.conf
+ # /etc/resolv.conf. not sure why I did this.
v uci delete dhcp.@dnsmasq[0].resolvfile
uci commit dhcp
dnsmasq_restart=true
fi
+if [[ $(uci get dhcp.@dnsmasq[0].domain) != b8.nz ]]; then
+ v uci set dhcp.@dnsmasq[0].domain=b8.nz
+ uci commit dhcp
+ dnsmasq_restart=true
+fi
+if [[ $(uci get dhcp.@dnsmasq[0].local) != b8.nz ]]; then
+ v uci set dhcp.@dnsmasq[0].local=/b8.nz/
+ uci commit dhcp
+ dnsmasq_restart=true
+fi
+
+if [[ $(uci get system.@system[0].hostname) != wrt ]]; then
+ v uci set system.@system[0].hostname=wrt
+ uci commit system
+fi
+
# useful: http://wiki.openwrt.org/doc/howto/dhcp.dnsmasq