add ipv4 support
This commit is contained in:
22
ddns/ddns.sh
22
ddns/ddns.sh
@@ -2,11 +2,19 @@
|
||||
|
||||
# Get public IP address (there are many ways to do it, I picked this way)
|
||||
PUBLIC_IP=$(curl -4 ifconfig.me)
|
||||
# Update *.{{ fqdn }} and {{ fqdn }}
|
||||
cat /etc/ddns/record_template.json \
|
||||
| jq '.Changes[0].ResourceRecordSet.ResourceRecords[0].Value = "'$PUBLIC_IP'"' \
|
||||
> /etc/ddns/record.json
|
||||
# aws cli to update a record
|
||||
aws route53 change-resource-record-sets --hosted-zone-id {{ hosted_zone_id }} --change-batch file:///etc/ddns/record.json
|
||||
|
||||
PUBLIC_IPV6=$(dig -t aaaa +short myip.opendns.com @resolver1.opendns.com)
|
||||
# Update reeselink records
|
||||
cat /etc/ddns/reeselink_record_template.json \
|
||||
| jq '.Changes[0].ResourceRecordSet.ResourceRecords[0].Value = "'$PUBLIC_IP'"' \
|
||||
> /etc/ddns/reeselink_record.json
|
||||
|
||||
# Update reeseapps records
|
||||
cat /etc/ddns/reeseapps_record_template.json \
|
||||
| jq '.Changes[].ResourceRecordSet.ResourceRecords[0].Value = "'$PUBLIC_IP'"' \
|
||||
> /etc/ddns/reeseapps_record.json
|
||||
|
||||
# Update reeselink records
|
||||
aws route53 change-resource-record-sets --hosted-zone-id Z0092652G7L97DSINN18 --change-batch file:///etc/ddns/reeselink_record.json
|
||||
|
||||
# Update reeseapps records
|
||||
aws route53 change-resource-record-sets --hosted-zone-id Z012820733346FJ0U4FUF --change-batch file:///etc/ddns/reeseapps_record.json
|
||||
|
||||
Reference in New Issue
Block a user