#!/bin/bash DOMAIN=$1 OLDIP=$2 NEWIP=$3 SERVERNAME=$4 echo "Adding new IP to domain" samba-tool dns add localhost $DOMAIN $SERVERNAME.$DOMAIN A $NEWIP samba-tool dns add localhost $DOMAIN $DOMAIN A $NEWIP samba-tool dns add localhost _msdcs.$DOMAIN gc A $NEWIP samba-tool dns add localhost $DOMAIN DomainDnsZones.$DOMAIN A $NEWIP samba-tool dns add localhost $DOMAIN ForestDnsZones.$DOMAIN A $NEWIP echo "Removing old IP from domain" samba-tool dns delete localhost _msdcs.$DOMAIN gc A $OLDIP samba-tool dns delete localhost $DOMAIN $SERVERNAME.$DOMAIN A $OLDIP samba-tool dns delete localhost $DOMAIN $DOMAIN A $OLDIP samba-tool dns delete localhost $DOMAIN DomainDnsZones.$DOMAIN A $OLDIP samba-tool dns delete localhost $DOMAIN ForestDnsZones.$DOMAIN A $OLDIP