X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=modules%2Fganeti2%2Ftemplates%2Finstance-debootstrap%2Fhooks%2F00-dsa-configure-networking.erb;h=e06ecfff0de90688f137b32d09341188fb385e03;hb=501e88f916b62cdc232b204457a82ee77ab089b2;hp=6878e13182d1bfb01249cf4d54fd04af11152d5c;hpb=f47e3bc07ecb609dd2f180925300aa3bf503ef66;p=dsa-puppet.git diff --git a/modules/ganeti2/templates/instance-debootstrap/hooks/00-dsa-configure-networking.erb b/modules/ganeti2/templates/instance-debootstrap/hooks/00-dsa-configure-networking.erb index 6878e131..e06ecfff 100755 --- a/modules/ganeti2/templates/instance-debootstrap/hooks/00-dsa-configure-networking.erb +++ b/modules/ganeti2/templates/instance-debootstrap/hooks/00-dsa-configure-networking.erb @@ -19,24 +19,49 @@ fi rm -f $TARGET/etc/udev/rules.d/70-persistent-net.rules -if [ "$NIC_COUNT" -gt 0 ]; then +touch $TARGET/etc/udev/rules.d/75-cd-aliases-generator.rules +touch $TARGET/etc/udev/rules.d/75-persistent-net-generator.rules - cat > $TARGET/etc/network/interfaces < $TARGET/etc/hostname + +########################################### +if [ "$NIC_COUNT" -ge 1 ]; then + cat > $TARGET/etc/network/interfaces << EOF # /etc/network/interfaces auto lo iface lo inet loopback +EOF +fi + + +########################################### +########################################### +<% if scope.lookupvar('::cluster').to_s == 'ganeti2.debian.org' -%> + +########################################### +if [ "$NIC_COUNT" -ge 1 ]; then + cat >> $TARGET/etc/network/interfaces << EOF auto eth0 iface eth0 inet static address ${NIC_0_IP} netmask 255.255.255.0 gateway 206.12.19.254 + pre-up /sbin/sysctl -w net.ipv6.conf.\$IFACE.accept_ra=0 || true + up ip addr add 2607:f8f0:610:4000:6564:0a62:\$IF_ADDRESS/64 dev \$IFACE + up ip r add default via 2607:f8f0:610:4000::1 src 2607:f8f0:610:4000:6564:0a62:\$IF_ADDRESS dev \$IFACE + down ip r del default via 2607:f8f0:610:4000::1 src 2607:f8f0:610:4000:6564:0a62:\$IF_ADDRESS dev \$IFACE + down ip addr del 2607:f8f0:610:4000:6564:0a62:\$IF_ADDRESS/64 dev \$IFACE EOF fi +########################################### cat > $TARGET/etc/resolv.conf < +# +########################################### +if [ "$NIC_COUNT" -ge 1 ]; then + cat >> $TARGET/etc/network/interfaces << EOF +auto eth0 +iface eth0 inet static + address ${NIC_0_IP} + netmask 255.255.255.128 + gateway 140.211.166.1 + + pre-up /sbin/sysctl -w net.ipv6.conf.\$IFACE.accept_ra=0 || true +EOF + +fi + +########################################### +cat > $TARGET/etc/resolv.conf < +# +########################################### +if [ "$NIC_COUNT" -ge 1 ]; then + cat >> $TARGET/etc/network/interfaces << EOF +auto eth0 +iface eth0 inet static + address ${NIC_0_IP} + netmask 255.255.255.192 + gateway 82.195.75.126 + + pre-up /sbin/sysctl -w net.ipv6.conf.\$IFACE.accept_ra=0 || true +EOF + +fi + +########################################### +cat > $TARGET/etc/resolv.conf < + +# No config for cluster <%= scope.lookupvar('::cluster').to_s %> +cp /etc/resolv.conf $TARGET/etc/resolv.conf + +<% end -%> + + + + +########################################### +if [ "$NIC_COUNT" -ge 2 ]; then + cat >> $TARGET/etc/network/interfaces << EOF + +auto eth1 +iface eth1 inet static + address ${NIC_1_IP} + netmask 255.255.255.0 +EOF + +fi + +########################################### +# clean up etc/hosts +cat > $TARGET/etc/hosts << EOF +127.0.0.1 localhost +${NIC_0_IP} ${fqdn} ${fqdn%%.*} + +# The following lines are desirable for IPv6 capable hosts +::1 ip6-localhost ip6-loopback +fe00::0 ip6-localnet +ff00::0 ip6-mcastprefix +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters +EOF + exit 0 + +# vim:set syn=sh: