Postfix e-mail lab
This lab is heavily based on the dns-bind lab.
On client, run /root/send_mail_to_root_at_domain.sh to test.
Having your own DNS server with the familiar BIND syntax is great, but DNS really is something you should have as managed. It needs a very stable infrastructure to support it. You might consider using Azure DNS. Below is something to get you started...
Set these for later...
DOMAIN_NAME=domain.com
RESOURCE_GROUP=domain
SITE_IP_ADDRESS=10.1.1.1
THIS_MAIL_SERVER_PUBLIC_IP_ADDRESS=192.168.0.1
Create the resource group (using same one? skip)...
azure group create --location centralus --name $RESOURCE_GROUP
Create zone...
azure network dns zone create -g $RESOURCE_GROUP -n $DOMAIN_NAME
Want domain.com and www.domain.com? Create...
azure network dns record-set create -g $RESOURCE_GROUP -z $DOMAIN_NAME -y A -n www -l 3600
azure network dns record-set add-record -g $RESOURCE_GROUP $DOMAIN_NAME -y A -n www -l 3600 -a $SITE_IP_ADDRESS
azure network dns record-set create -g $RESOURCE_GROUP -z $DOMAIN_NAME -y A -n "@" -l 3600
azure network dns record-set add-record -g $RESOURCE_GROUP $DOMAIN_NAME -y A -n "@" -l 3600 -a $SITE_IP_ADDRESS
Want to have mail.domain.com? Create...
azure network dns record-set create -g $RESOURCE_GROUP -z $DOMAIN_NAME -y A -n mail -l 3600
azure network dns record-set add-record -g $RESOURCE_GROUP $DOMAIN_NAME -y A -n mail -l 3600 -a $THIS_MAIL_SERVER_PUBLIC_IP_ADDRESS
Set MX record...
azure network dns record-set create -g $RESOURCE_GROUP -z $DOMAIN_NAME -y MX -n "@" -l 3600
azure network dns record-set add-record -g $RESOURCE_GROUP $DOMAIN_NAME -y MX -n "@" -l 3600 --exchange mail.$DOMAIN_NAME --preference 10
Get the list of DNS servers you're on and set them on your domain hosting to use azure dns...
azure network dns record-set list -g $RESOURCE_GROUP -z $DOMAIN_NAME | grep azure-dns | grep -v 'host:'| cut -c 40-70
Need to verify it's all on Azure DNS?
azure network dns record-set list -g $RESOURCE_GROUP -z $DOMAIN_NAME
Need to check if it's actually going to work?
dig @`azure network dns record-set list -g $RESOURCE_GROUP -z $DOMAIN_NAME | grep azure-dns | grep -v 'host:'| cut -c 40-70 | head -n1` $DOMAIN_NAME
Deploy to Azure