|
|
|
|
34
|
# OpenDNS ipv6 DNS 2620:0:ccc::2
|
34
|
# OpenDNS ipv6 DNS 2620:0:ccc::2
|
35
|
IPV4_ADDRESS_TEST_DESTINATION='85.214.73.63'
|
35
|
IPV4_ADDRESS_TEST_DESTINATION='85.214.73.63'
|
36
|
IPV6_ADDRESS_TEST_DESTINATION='2620:0:ccc::2'
|
36
|
IPV6_ADDRESS_TEST_DESTINATION='2620:0:ccc::2'
|
37
|
-EXTERNAL_IP_LOOKUP_URL='ifcfg.me'
|
|
|
38
|
|
37
|
|
39
|
# The static IP address of the system within the local network
|
38
|
# The static IP address of the system within the local network
|
40
|
# By default the IP address is dynamic within your LAN
|
39
|
# By default the IP address is dynamic within your LAN
|
|
|
|
|
88
|
}
|
87
|
}
|
89
|
|
88
|
|
90
|
function get_external_ipv4_address {
|
89
|
function get_external_ipv4_address {
|
91
|
- nslookup . $EXTERNAL_IP_LOOKUP_URL | grep Address | tail -n 1 | awk -F ' ' '{print $2}'
|
|
|
|
|
90
|
+ curl ipinfo.io/ip
|
92
|
}
|
91
|
}
|
93
|
|
92
|
|
94
|
function get_ipv4_address {
|
93
|
function get_ipv4_address {
|
|
|
|
|
105
|
ip_update_script=/usr/bin/externalipupdate
|
104
|
ip_update_script=/usr/bin/externalipupdate
|
106
|
{ echo '#!/bin/bash';
|
105
|
{ echo '#!/bin/bash';
|
107
|
echo "existing_ip=\$(cat $CONFIGURATION_FILE | grep \"EXTERNAL_IPV4_ADDRESS=\" | head -n 1 | awk -F '=' '{print \$2}')'";
|
106
|
echo "existing_ip=\$(cat $CONFIGURATION_FILE | grep \"EXTERNAL_IPV4_ADDRESS=\" | head -n 1 | awk -F '=' '{print \$2}')'";
|
108
|
- echo "curr_ip=\$(nslookup . $EXTERNAL_IP_LOOKUP_URL | grep Address | tail -n 1 | awk -F ' ' '{print \$2}')";
|
|
|
|
|
107
|
+ echo "curr_ip=\$(curl ipinfo.io/ip)";
|
109
|
echo "if [[ \"\$curr_ip\" != \"\$existing_ip\" ]]; then";
|
108
|
echo "if [[ \"\$curr_ip\" != \"\$existing_ip\" ]]; then";
|
110
|
echo " sed -i \"s|EXTERNAL_IPV4_ADDRESS=.*|EXTERNAL_IPV4_ADDRESS=\${curr_ip}|g\" $CONFIGURATION_FILE";
|
109
|
echo " sed -i \"s|EXTERNAL_IPV4_ADDRESS=.*|EXTERNAL_IPV4_ADDRESS=\${curr_ip}|g\" $CONFIGURATION_FILE";
|
111
|
echo " echo \"\$(date)\" >> ~/${PROJECT_NAME}-external-ip-changes.txt";
|
110
|
echo " echo \"\$(date)\" >> ~/${PROJECT_NAME}-external-ip-changes.txt";
|