#!/bin/bash set -euo pipefail apt-get update apt-get install -y dnsmasq bind-utils cat > /etc/dnsmasq.conf <<'EOF' port=53 listen-address=127.0.0.1,192.168.100.2 bind-interfaces no-resolv server=77.88.8.8 domain-needed bogus-priv local=/au-team.irpo/ address=/hq-rtr.au-team.irpo/192.168.100.1 address=/br-rtr.au-team.irpo/172.16.2.2 address=/br-fw.au-team.irpo/192.168.254.1 host-record=hq-srv.au-team.irpo,192.168.100.2 address=/hq-cli.au-team.irpo/192.168.100.34 host-record=br-srv.au-team.irpo,192.168.200.2 address=/docker.au-team.irpo/172.16.1.1 address=/web.au-team.irpo/172.16.2.1 EOF dnsmasq --test systemctl enable --now dnsmasq systemctl restart dnsmasq nic=$(for path in /sys/class/net/*; do [[ -e $path/device ]] || continue; [[ $(cat "$path/address") != "02:27:00:0${BUNDLE}:04:00" ]] || basename "$path"; done) test -n "$nic" printf 'search au-team.irpo\nnameserver 127.0.0.1\n' > "/etc/net/ifaces/$nic/resolv.conf" cp "/etc/net/ifaces/$nic/resolv.conf" /etc/resolv.conf dig +short br-fw.au-team.irpo dig +short -x 192.168.200.2 dig +short mirror.yandex.ru