minor fixes and improvements
[automated-distro-installer] / wrt-setup-local
1 #!/bin/bash
2 # Copyright (C) 2016 Ian Kelling
3
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 set -eE -o pipefail
19 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
20
21
22 usage() {
23 cat <<EOF
24 usage: ${0##*/} [-h] [-t 2|3|test] [-m WIRELESS_MAC]
25 setup my router in general: dhcp, dns, etc.
26
27 Type 2 or 3 is for setting up a backup device, there are two kinds so
28 that you can switch the main device to a backup, then a backup to the
29 main. Type test is for setting up a testing device.
30
31 Passing an empty string for WIRELESS_MAC will cause the device's native
32 mac to be used.
33
34 EOF
35
36 exit $1
37 }
38
39
40
41
42 dnsmasq_restart=false
43 firewall_restart=false
44 dev2=false
45 test=false
46 libremanage_host=wrt2
47
48 secrets=false
49 if [[ -e /root/router-secrets ]]; then
50 secrets=true
51 source /root/router-secrets
52 fi
53 rmac=$(cat /sys/class/net/eth0/address)
54 if $secrets; then
55 hostname=${rhost[$rmac]}
56 fi
57 : ${hostname:=wrt}
58
59
60 lanip=1
61 while getopts hm:t: opt; do
62 case $opt in
63 h) usage ;;
64 t)
65 case $2 in
66 2|3)
67 dev2=true
68 libremanage_host=$hostname
69 ;;&
70 2)
71 lanip=4
72 hostname=wrt2
73 ;;
74 3)
75 lanip=14
76 hostname=wrt3
77 ;;
78 test)
79 test=true
80 ;;
81 *) echo "$0: unexpected arg to -t: $*" >&2; usage 1 ;;
82 esac
83 ;;
84 m) mac=$OPTARG ;;
85 *) echo "$0: Internal error! unexpected args: $*" >&2 ; usage 1 ;;
86 esac
87 done
88 shift "$((OPTIND-1))" # Discard the options and sentinel --
89
90 if [[ ! $mac ]] && ! $test && $secrets; then
91 # if we wanted to increment it
92 #mac=${mac:0: -1}$((${mac: -1} + 2))
93 mac=${rwmac[$rmac]}
94 fi
95
96 if (( $# != 0 )); then
97 usage 1
98 fi
99
100
101 macpre=${mac:0: -1}
102 macsuf=${mac: -1}
103
104
105 p_updated=false
106 pmirror() {
107 if $p_updated; then
108 return
109 fi
110 # background: upgrading all packages is not recommended because it
111 # doesn't go into the firmware. build new firmware if you want
112 # lots of upgrades. I think /tmp/opkg-lists is a pre openwrt 14 location.
113 f=(/var/opkg-lists/*)
114 if ! (( $(date -r $f +%s) + 60*60*24 > $(date +%s) )); then
115 if ! opkg update; then
116 echo "$0: warning: opkg update failed" >&2
117 fi
118 p_updated=true
119 fi
120 }
121
122 pi() {
123 to_install=()
124 for p in "$@"; do
125 pname=${p##*/}
126 pname=${pname%%_*}
127 if [[ ! $(opkg list-installed "$pname") ]]; then
128 to_install+=($p)
129 pmirror
130 fi
131 done
132 if [[ $to_install ]]; then
133 opkg install ${to_install[@]}
134 fi
135 }
136
137 v() {
138 printf "+ %s\n" "$*"
139 "$@"
140 }
141
142 ######### uci example:#######
143 # # https://wiki.openwrt.org/doc/uci
144 # wan_index=$(uci show firewall | sed -rn 's/firewall\.@zone\[([0-9])+\]\.name=wan/\1/p')
145 # wan="firewall.@zone[$wan_index]"
146 # if [[ $(uci get firewall.@forwarding[0].dest) != $forward_dest ]]; then
147 # # default is wan
148 # v uci set firewall.@forwarding[0].dest=$forward_dest
149 # uci commit firewall
150 # firewall_restart=true
151 # fi
152 ####### end uci example #####
153
154 uset() {
155 printf "+ uset %s\n" "$*"
156 local key="$1"
157 local val="$2"
158 local service="${key%%.*}"
159 restart_var=${service}_restart
160 if [[ ! ${!restart_var} ]]; then
161 eval $restart_var=false
162 fi
163 if [[ $(uci get "$key") != "$val" ]]; then
164 v uci set "$key"="$val"
165 uci commit $service
166 eval $restart_var=true
167 fi
168 }
169
170 udel() {
171 printf "+ udel %s\n" "$*"
172 local key="$1"
173 local val="$2"
174 local service="${key%%.*}"
175 restart_var=${service}_restart
176 if [[ ! ${!restart_var} ]]; then
177 eval $restart_var=false
178 fi
179 if uci get "$key" &>/dev/null; then
180 v uci set "$key"="$val"
181 uci commit $service
182 eval $restart_var=true
183 fi
184 }
185
186
187
188 ### network config
189 ###
190 lan=10.0.0.0
191 if $test; then
192 lan=10.1.0.0
193 elif [[ $hostname == cmc ]]; then
194 lan=10.2.0.0
195 fi
196
197 if $test; then
198 ssid="gnuv3"
199 elif $secrets; then
200 ssid=${rssid[$rmac]}
201 fi
202
203 : ${ssid:=librecmc}
204
205
206 if $secrets; then
207 key=${rkey[$rmac]}
208 fi
209 : ${key:=pictionary49}
210
211 mask=255.255.0.0
212 cidr=16
213 l=${lan%.0}
214
215 passwd -l root ||: #already locked fails
216
217 sed -ibak '/^root:/d' /etc/shadow
218 # /root/router created by manually running passwd then copying the resulting
219 # line. We have no mkpasswd on wrt/librecmc, then we scp it in.
220 cat /root/router >>/etc/shadow
221 # otherwise, serial console gets root login with no password
222 uset system.@system[0].ttylogin 1
223
224
225
226 cat >/usr/bin/archlike-pxe-mount <<'EOFOUTER'
227 #!/bin/bash
228 # symlinks are collapsed for nfs mount points, so use a bind mount.
229 # tried putting this in /etc/config/fstab,
230 # then doing block mount, it didn't work. This doesn't persist across reboots,
231 # todo: figure that out
232 rm -f /etc/fstab
233 for d in /run/{arch,parabola}iso/bootmnt; do
234 cat >>/etc/fstab <<EOF
235 /mnt/usb/tftpboot $d none bind 0 0
236 EOF
237 mount | grep $d &>/dev/null || mount $d
238 done
239 /etc/init.d/nfsd restart
240 EOFOUTER
241 chmod +x /usr/bin/archlike-pxe-mount
242
243 sed -i '/^root:/s,/bin/ash$,/bin/bash,' /etc/passwd
244
245
246
247 uset dropbear.@dropbear[0].PasswordAuth 0
248 uset dropbear.@dropbear[0].RootPasswordAuth 0
249 uset dropbear.@dropbear[0].Port 2220
250 if ! cmp -s /root/dropbear_rsa_host_key /etc/dropbear/dropbear_rsa_host_key; then
251 cp /root/dropbear_rsa_host_key /etc/dropbear/dropbear_rsa_host_key
252 dropbear_restart=true
253 fi
254
255 if $dropbear_restart; then
256 v /etc/init.d/dropbear restart
257 fi
258
259
260 uset network.lan.ipaddr $l.$lanip
261 uset network.lan.netmask $mask
262 if $dev2; then
263 uset network.lan.gateway $l.1
264 uset network.wan.proto none
265 uset network.wan6.proto none
266 /etc/init.d/dnsmasq stop
267 /etc/init.d/dnsmasq disable
268 /etc/init.d/odhcpd stop
269 /etc/init.d/odhcpd disable
270 rm -f /etc/resolv.conf
271 cat >/etc/resolv.conf <<'EOF'
272 nameserver 8.8.8.8
273 nameserver 8.8.4.4
274 EOF
275
276 # things i tried to keep dnsmasq running but not enabled except local dns,
277 # but it didnt work right and i dont need it anyways.
278 # uset dhcp.wan.ignore $dev2 # default is false
279 # uset dhcp.lan.ignore $dev2 # default is false
280 # uset dhcp.@dnsmasq[0].interface lo
281 # uset dhcp.@dnsmasq[0].localuse 0
282 # uset dhcp.@dnsmasq[0].resolvfile /etc/dnsmasq.conf
283 # uset dhcp.@dnsmasq[0].noresolv 1
284 # todo: populate /etc/resolv.conf with a static value
285
286 else
287 # these are the defaults
288 uset network.lan.gateway ''
289 uset network.wan.proto dhcp
290 uset network.wan6.proto dhcpv6
291 /etc/init.d/dnsmasq start
292 # todo: figure out why this returns 1
293 /etc/init.d/dnsmasq enable ||:
294 /etc/init.d/odhcpd start
295 /etc/init.d/odhcpd enable
296 fi
297
298 wireless_restart=false
299 for x in 0 1; do
300 uset wireless.default_radio$x.ssid "$ssid"
301 uset wireless.default_radio$x.key $key
302 uset wireless.default_radio$x.encryption psk2
303 if [[ $mac ]]; then
304 uset wireless.default_radio$x.macaddr $macpre$((macsuf + 2*x))
305 fi
306 # secondary device has wireless disabled
307 uset wireless.radio$x.disabled $dev2
308 done
309
310 if $wireless_restart; then
311 v wifi
312 fi
313
314
315
316 # usb, screen, relay are for libremanage
317 # rsync is for brc
318 v pi kmod-usb-storage block-mount kmod-fs-ext4 nfs-kernel-server \
319 tcpdump openvpn-openssl adblock libusb-compat /root/relay_1.0-1_mips_24kc.ipk \
320 screen kmod-usb-serial-cp210x kmod-usb-serial-ftdi rsync
321
322 cat >/etc/libremanage.conf <<EOF
323 ${libremanage_host}_type=switch
324 ${libremanage_host}_channel=1
325 EOF
326
327
328
329 v /etc/init.d/fstab enable ||:
330
331 # rebooting makes mounting work, but comparing lsmod,
332 # i'm guessing this will too. todo, test it.
333 # 255 == module already loaded
334 for mod in scsi_mod sd_mod; do v modprobe $mod || [[ $? == 255 ]]; done
335
336 # for archlike pxe. The default settings in the installer expect to find
337 # the NFS at one of these dirs
338 mkdir -p /run/archiso/bootmnt
339 mkdir -p /run/parabolaiso/bootmnt
340
341 # todo: at some later time, i found /mnt/usb not mounted, watch to see if
342 # that is the case after running this or rebooting.
343 # wiki says safe to do in case of fstab changes:
344
345 ## ian: usb broke on old router. if that happens, can just comment this to disable problems
346 # echo | cedit /etc/config/fstab ||:
347 v cedit /etc/config/fstab <<EOF || { v block umount; v block mount; }
348 config global automount
349 option from_fstab 1
350 option anon_mount 1
351
352 config mount
353 # /overlay is an / overlay mount for installing extra packages, etc.
354 # https://openwrt.org/docs/guide-user/additional-software/extroot_configuration
355 option target /mnt/usb
356 # option target /overlay
357 option device /dev/sda1
358 option fstype ext4
359 option options rw,async,noatime,nodiratime
360 option enabled 0
361 EOF
362
363
364 # ian: disabled because afaik I don't need it, no benefit.
365 # config global autoswap
366 # option from_fstab 1
367 # option anon_swap 1
368
369 # config swap
370 # option device /dev/sda1
371 # option enabled 1
372
373
374
375
376 # exportfs -ra wont cut it when its the same path, but now a bind mount
377 # todo: restart nfs when nfs is enabled?
378 #cedit /etc/exports <<EOF || v /etc/init.d/nfsd restart ||:
379 cedit /etc/exports <<EOF ||:
380 /mnt/usb $lan/$cidr(rw,no_root_squash,insecure,sync,no_subtree_check)
381 # for arch pxe
382 /run/archiso/bootmnt $lan/$cidr(rw,no_root_squash,insecure,sync,no_subtree_check)
383 /run/parabolaiso/bootmnt $lan/$cidr(rw,no_root_squash,insecure,sync,no_subtree_check)
384 EOF
385
386
387 # todo: enable nfs when we need it only.
388 # v /etc/init.d/portmap start
389 # v /etc/init.d/nfsd start
390 # v /etc/init.d/portmap enable
391 # v /etc/init.d/nfsd enable
392
393
394
395
396
397
398
399
400 ########## openvpn exampl
401 ########## missing firewall settings for routing lan
402 ########## traffic
403 # v /etc/init.d/openvpn start
404 # v /etc/init.d/openvpn enable
405
406 # # from https://wiki.openwrt.org/doc/uci/firewall
407 # # todo: not sure if /etc/init.d/network needs restarting.
408 # # I did, and I had to restart the vpn afterwards.
409 # # This maps a uci interface to a real interface which is
410 # # managed outside of uci.
411 # v cedit /etc/config/network <<'EOF' ||:
412 # config interface 'tun0'
413 # option ifname 'tun0'
414 # option proto 'none'
415 # EOF
416 # v cedit /etc/config/openvpn <<'EOF' || v /etc/init.d/openvpn restart
417 # config openvpn my_client_config
418 # option enabled 1
419 # option config /etc/openvpn/client.conf
420 # EOF
421
422 wgip4=10.3.0.1/24
423 wgip6=fdfd::1/64
424 wgport=26000
425
426
427 v cedit /etc/config/network <<EOF || v /etc/init.d/network reload
428 config 'route' 'transmission'
429 option 'interface' 'lan'
430 option 'target' '10.173.0.0'
431 option 'netmask' '255.255.0.0'
432 option 'gateway' '$l.3'
433
434 option interface 'wg0'
435 option proto 'wireguard'
436 option private_key '$(cat /root/wg.key)'
437 option listen_port $wgport
438 list addresses '10.3.0.1/24'
439 list addresses 'fdfd::1/64'
440
441 # tp
442 config wireguard_wg0 'wgclient'
443 option public_key '3q+WJGrm85r59NgeXOIvppxoW4ux/+koSw6Fee1c1TI='
444 option preshared_key '$(cat /root/wg.psk)'
445 list allowed_ips '10.3.0.2/24'
446 list allowed_ips 'fdfd::2/64'
447 EOF
448
449
450
451 firewall-cedit() {
452 case $hostname in
453 wrt)
454 v cedit host /etc/config/firewall <<EOF
455 config redirect
456 option name ssh
457 option src wan
458 option src_dport 22
459 option dest_ip $l.3
460 option dest lan
461 EOF
462 ;;
463 cmc)
464 v cedit host /etc/config/firewall <<EOF
465 config redirect
466 option name ssh
467 option src wan
468 option src_dport 22
469 option dest_ip $l.2
470 option dest lan
471 EOF
472 ;;
473 esac
474
475 v cedit /etc/config/firewall <<EOF
476 config rule
477 option src wan
478 option target ACCEPT
479 option dest_port 22
480
481 config redirect
482 option name sshtp
483 option src wan
484 option src_dport 2202
485 option dest_port 22
486 option dest_ip $l.2
487 option dest lan
488 config rule
489 option src wan
490 option target ACCEPT
491 option dest_port 2202
492
493 config redirect
494 option name sshx2
495 option src wan
496 option src_dport 2205
497 option dest_port 22
498 option dest_ip $l.5
499 option dest lan
500 config rule
501 option src wan
502 option target ACCEPT
503 option dest_port 2205
504
505 config redirect
506 option name sshx3
507 option src wan
508 option src_dport 2207
509 option dest_port 22
510 option dest_ip $l.7
511 option dest lan
512 config rule
513 option src wan
514 option target ACCEPT
515 option dest_port 2207
516
517 config redirect
518 option name sshtp
519 option src wan
520 option src_dport 2208
521 option dest_port 22
522 option dest_ip $l.8
523 option dest lan
524 config rule
525 option src wan
526 option target ACCEPT
527 option dest_port 2208
528
529 config redirect
530 option name icecast
531 option src wan
532 option src_dport 8000
533 option dest_port 8000
534 option dest_ip $l.2
535 option dest lan
536 config rule
537 option src wan
538 option target ACCEPT
539 option dest_port 8000
540
541 config rule
542 option name sshwrt
543 option src wan
544 option target ACCEPT
545 option dest_port 2220
546
547 config rule
548 option name wg
549 option src wan
550 option target ACCEPT
551 option dest_port $wgport
552 option proto udp
553
554
555 config redirect
556 option name vpntp
557 option src wan
558 option src_dport 1196
559 option dest lan
560 option dest_ip $l.8
561 option proto udp
562 config rule
563 option src wan
564 option target ACCEPT
565 option dest_port 1196
566 option proto udp
567
568
569 config redirect
570 option name httptp
571 option src wan
572 option src_dport 80
573 option dest lan
574 option dest_ip $l.2
575 option proto tcp
576 config rule
577 option src wan
578 option target ACCEPT
579 option dest_port 80
580 option proto tcp
581
582 config redirect
583 option name httpstp
584 option src wan
585 option src_dport 443
586 option dest lan
587 option dest_ip $l.2
588 option proto tcp
589 config rule
590 option src wan
591 option target ACCEPT
592 option dest_port 443
593 option proto tcp
594
595 config redirect
596 option name syncthing
597 option src wan
598 option src_dport 22001
599 option dest_ip $l.8
600 option dest lan
601 config rule
602 option src wan
603 option target ACCEPT
604 option dest_port 22001
605
606
607 config rule
608 option name ssh-ipv6
609 option src wan
610 option dest lan
611 # note, using mac transform, we could allow all traffic to a host like this,
612 # replacing 1 as appropriate
613 #option dest_ip ::111:11ff:fe11:1111/::ffff:ffff:ffff:ffff
614 option dest_port 22
615 option target ACCEPT
616 option family ipv6
617
618 config rule
619 option name http-ipv6
620 option src wan
621 option dest lan
622 option dest_port 80
623 option target ACCEPT
624 option family ipv6
625
626 config rule
627 option name https-ipv6
628 option src wan
629 option dest lan
630 option dest_port 443
631 option target ACCEPT
632 option family ipv6
633
634 config rule
635 option name node-exporter
636 option src wan
637 option dest lan
638 option dest_port 9101
639 option target ACCEPT
640 option family ipv6
641
642 config rule
643 option name mail587-ipv6
644 option src wan
645 option dest lan
646 option dest_port 587
647 option target ACCEPT
648 option family ipv6
649
650 EOF
651 }
652 firewall-cedit || firewall_restart=true
653
654 if ! uci get firewall.@zone[1].network | grep wg0 &>/dev/null; then
655 # cant mix cedit plus uci
656 echo | cedit /etc/config/firewall ||:
657 uci add_list firewall.@zone[1].network=wg0
658 uci commit firewall
659 firewall-cedit ||:
660 firewall_restart=true
661 fi
662
663
664
665 v cedit /etc/hosts <<EOF || dnsmasq_restart=true
666 127.0.1.1 $hostname
667 #$l.7 x3
668 $l.12 demohost
669 $l.13 trp
670 72.14.176.105 li
671 2600:3c00::f03c:91ff:fe6d:baf8 li
672
673 # netns creation looks for next free subnet starting at 10.173, but I only
674 # use one, and I would keep this one as the first created.
675 10.173.0.2 transmission
676 EOF
677 case $hostname in
678 cmc)
679 v cedit host /etc/hosts <<EOF || dnsmasq_restart=true
680 $l.1 $hostname
681 $l.2 kd b8.nz
682 #$l.3 frodo
683 $l.4 wrt2
684 $l.5 x2 faiserver
685 $l.6 x2w
686 $l.7 rp
687 $l.8 tp
688 $l.9 bb8
689 $l.14 wrt3
690 #$l.18 x3
691 $l.19 brother
692 #$l.28 frodow
693 EOF
694 ;;
695 esac
696
697
698 #mail_host=$(grep -F mail.iankelling.org /etc/hosts | awk '{print $1}')
699 # if [[ $mail_host ]]; then
700 # sed -i '/^$mail_host/a mail.iankelling.org' /etc/hosts
701 # fi
702
703
704 uset dhcp.@dnsmasq[0].domain b8.nz
705 uset dhcp.@dnsmasq[0].local /b8.nz/
706 uset system.@system[0].hostname $hostname
707 # uci doesnt seem to have a way to set an empty value,
708 # if you delete it, it goes back to the default. this seems
709 # to be a decent workaround.
710 # todo: setup /etc/resolv.conf to point to 127.0.0.1
711 uset dhcp.@dnsmasq[0].resolvfile=/dev/null
712
713 # disabled for now. i want to selectively enable it
714 # for specific hosts.
715 if [[ $(uci get adblock.global.adb_enabled) != 0 ]]; then
716 v uci set adblock.global.adb_enabled=0
717 uci commit adblock
718 /etc/init.d/adblock restart
719 fi
720 # https://github.com/openwrt/packages/tree/master/net/adblock/files
721 cat >/etc/crontabs/root <<'EOF'
722 0 06 * * * /etc/init.d/adblock reload
723 EOF
724
725
726 # useful: http://wiki.openwrt.org/doc/howto/dhcp.dnsmasq
727
728 # sometimes /mnt/usb fails, cuz it's just a flash drive,
729 # so make sure we have this dir or else dnsmasq will fail
730 # to start.
731 mkdir -p /mnt/usb/tftpboot
732 v cedit /etc/dnsmasq.conf <<EOF || dnsmasq_restart=true
733 server=/dmarctest.b8.nz/#
734 server=/_domainkey.b8.nz/#
735 server=/_dmarc.b8.nz/#
736 server=/ns1.b8.nz/#
737 server=/ns2.b8.nz/#
738 server=/bk.b8.nz/#
739 server=/je.b8.nz/#
740 mx-host=b8.nz,mail.iankelling.org,10
741 txt-record=b8.nz,"v=spf1 a ?all"
742
743
744 # https://ret2got.wordpress.com/2018/01/19/how-your-ethereum-can-be-stolen-using-dns-rebinding/
745 stop-dns-rebind
746
747 # this says the ip of default gateway and dns server,
748 # but I think they are unneded and default
749 #dhcp-option=3,$l.1
750 #dhcp-option=6,$l.1
751
752
753
754 # results from googling around dnsmasq optimizations
755 # about 50k in memory. router has 62 megs.
756 # in a browsing session, I probably won't ever do 5000 lookups
757 # before the ttl expiration or whatever does expiration.
758 cache-size=10000
759
760 # ask all servers, use the one which responds first.
761 # http://ma.ttwagner.com/make-dns-fly-with-dnsmasq-all-servers/
762 all-servers
763
764 # namebench benchmarks dns servers. google's dns was only
765 # slightly less fast than some others, and I trust it more
766 # to give accurate results, stay relatively fast, and
767 # not do anythin too malicious, so just use that.
768 # download namebench and run it like this:
769 # for x in all regional isp global preferred nearby; do ./namebench.py -s \$x -c US -i firefox -m weighted -J 10 -w; echo \$x; hr; done
770 # google
771 server=8.8.4.4
772 server=8.8.8.8
773 server=2001:4860:4860::8888
774 server=2001:4860:4860::8844
775
776
777 # to fixup existin ips, on the client you can do
778 # sudo dhclient -r; sudo dhclient <interface-name>
779
780 # default dhcp range is 100-150
781 # bottom port, iPXE (PCI 03:00.0) in seabios boot menu
782 dhcp-host=c8:60:00:31:6b:75,set:kd,$l.2,kd
783 # top port, iPXE (PCI 04:00.0) in seabios boot menu
784 #dhcp-host=c8:60:00:2b:15:07,set:kd,$l.2,kd
785 dhcp-host=00:26:18:97:bb:16,set:frodo,$l.3,frodo
786 # 4 is reserved for a staticly configured host wrt2
787 # old x2 with bad fan
788 #dhcp-host=00:1f:16:16:39:24,set:x2,$l.5,x2
789 dhcp-host=f0:de:f1:81:ec:88,set:x2,$l.5,x2
790 dhcp-host=c4:8e:8f:44:f5:63,set:x2w,$l.6,x2w
791 # This is so fai can have an explicit name to use for testing,
792 # or else any random machine which did a pxe boot would get
793 # reformatted. The mac is from doing a virt-install, cancelling it,
794 # and copying the generated mac, so it should be randomish.
795 dhcp-host=fa:08:f8:4c:14:1c,set:tp,$l.7,rp
796 dhcp-host=80:fa:5b:1c:6e:cf,set:tp,$l.8,tp
797 dhcp-host=52:54:00:9c:ef:ad,set:demohost,$l.12,demohost
798 dhcp-host=62:03:cb:a8:3e:a3,set:trp,$1.13,trp
799 dhcp-host=00:1f:16:14:01:d8,set:tp,$l.18,x3
800 # BRN001BA98CA823 in dhcp logs
801 dhcp-host=00:1b:a9:8c:a8:23,set:tp,$l.19,brother
802 dhcp-host=00:26:b6:f6:0f:e9,set:frodow,$l.28,frodow
803
804
805 # faiserver vm
806 dhcp-host=52:54:00:56:09:f9,set:faiserver,$l.15,faiserver
807
808 # This is the ip it picks by default if dhcp fails,
809 # so might as well use it.
810 # hostname is the name it uses according to telnet
811 dhcp-host=b4:75:0e:94:29:ca,set:switch9429ca,$l.251,switch9429ca
812
813 # template
814 # dhcp-host=,$l.,
815
816 # Just leave the tftp server up even if we aren't doing pxe boot.
817 # It has no sensitive info.
818 enable-tftp=br-lan
819 tftp-root=/mnt/usb/tftpboot
820 dhcp-optsfile=/etc/dnsmasq-dhcpopts.conf
821
822 #log-queries=extra
823 EOF
824
825
826
827
828 if $dnsmasq_restart && ! $dev2; then
829 v /etc/init.d/dnsmasq restart
830 fi
831
832 if $firewall_restart; then
833 v /etc/init.d/firewall restart
834 fi
835
836
837 # todo: we should catch errors and still run this if needed
838 if $network_restart; then
839 reboot
840 fi
841
842 exit 0