X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=fai%2Fconfig%2Fscripts%2FFSF%2F11-iank;h=08a7171070deee01abfe7e47fd6b1bc9b2012023;hb=8bb06901ce000f76dafc73288e1fe47c3032e4af;hp=93c227f584d7b3854aad7a3035e545d17cd85bd8;hpb=14f283f82afc48d6cec1bb7498ec34ac2b0da77c;p=automated-distro-installer diff --git a/fai/config/scripts/FSF/11-iank b/fai/config/scripts/FSF/11-iank index 93c227f..08a7171 100755 --- a/fai/config/scripts/FSF/11-iank +++ b/fai/config/scripts/FSF/11-iank @@ -1,4 +1,20 @@ #!/bin/bash -x +# This file is part of Ian Kelling's automated-distro-installer +# Copyright (C) 2024 Ian Kelling + +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# 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 @@ -23,27 +39,78 @@ iface eth0 inet6 auto source-directory /etc/network/interfaces.d EOF else - ip=$(getent ahosts $HOSTNAME |grep ^209.*RAW| sed 's/ .*//') - ip6=$(getent ahosts $HOSTNAME |grep ^2001.*RAW| sed 's/ .*//') - gateway=209.51.188.1 + ip6=$(getent ahosts $HOSTNAME |grep ^2001.*RAW| sed 's/ .*//' ||:) gateway6=2001:470:142::1 - cat > $target/etc/network/interfaces </dev/null; then + cat >$target/etc/network/interfaces < /proc/sys/net/ipv6/conf/eth0/accept_dad +auto eth1 +allow-bond eth1 +iface eth1 inet manual + bond-master bond0 + +auto bond0 +iface bond0 inet static + bond-slaves none + bond-mode 0 + bond-miimon 100 + address $internal_ip + pre-up ip link add link bond0 name macvtap-bond0 type macvtap mode bridge +# no iptables files exist yet +# post-up iptables-restore < /etc/default/iptables ; ip6tables-restore < /etc/default/ip6tables || : + +auto macvtap-bond0 +iface macvtap-bond0 inet static + address $CIDR + gateway $GATEWAYS + post-up ip a add $internal_ip broadcast 10.0.255.255 dev macvtap-bond0 + +EOF + + # I'm not sure ipv6 works well with the macvtap stuff. todo: research. + # anyways, other kvm hosts dont have it enabled. + if false && [[ $ip6 ]]; then + cat >>$target/etc/network/interfaces < /proc/sys/net/ipv6/conf/bond0/accept_dad address $ip6 netmask 48 gateway $gateway6 EOF + fi + + else + cat > $target/etc/network/interfaces <>$target/etc/network/interfaces < /proc/sys/net/ipv6/conf/eth0/accept_dad +address $ip6 +netmask 48 +gateway $gateway6 +EOF + fi + fi fi # previously had an else condition after @@ -61,10 +128,13 @@ fi ##### end network setup ##### +# note: systemd-resolved + ifupdown causes networking.service to fail in t11, +# https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/1907878 +systemctl disable systemd-resolved # rm first to remove any symlink rm -f $target/etc/resolv.conf -if ifclass demohost; then +if ifclass demohost || [[ $GATEWAYS != 209.51.188.* ]]; then cat >$target/etc/resolv.conf <<'EOF' nameserver 8.8.8.8 EOF