|
@@ -31,11 +31,12 @@
|
31
|
31
|
# If the system is on an IPv6 network
|
32
|
32
|
IPV6_NETWORK='2001:470:26:307'
|
33
|
33
|
|
34
|
|
-# Destinations used to get the external IP address of this system
|
35
|
|
-# Google ipv6 DNS is 2001:4860:4860::8888
|
|
34
|
+# Destinations used to get the local IP address of this system
|
|
35
|
+# Google ipv6 DNS 2001:4860:4860::8888
|
|
36
|
+# OpenDNS ipv6 DNS 2620:0:ccc::2
|
36
|
37
|
IPV4_ADDRESS_TEST_DESTINATION='85.214.73.63'
|
37
|
38
|
IPV6_ADDRESS_TEST_DESTINATION='2620:0:ccc::2'
|
38
|
|
-
|
|
39
|
+EXTERNAL_IP_LOOKUP_URL='ifcfg.me'
|
39
|
40
|
|
40
|
41
|
# The static IP address of the system within the local network
|
41
|
42
|
# By default the IP address is dynamic within your LAN
|
|
@@ -70,6 +71,10 @@ function install_static_network {
|
70
|
71
|
mark_completed $FUNCNAME
|
71
|
72
|
}
|
72
|
73
|
|
|
74
|
+function get_external_ipv4_address {
|
|
75
|
+ nslookup . $EXTERNAL_IP_LOOKUP_URL | grep Address | tail -n 1 | awk -F ' ' '{print $2}'
|
|
76
|
+}
|
|
77
|
+
|
73
|
78
|
function get_ipv4_address {
|
74
|
79
|
IPv4dev=$(ip route get $IPV4_ADDRESS_TEST_DESTINATION | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}')
|
75
|
80
|
echo $(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}' | awk -F '/' '{print $1}')
|