summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Illfelder <illfelder@users.noreply.github.com>2016-11-18 17:34:47 -0800
committerGitHub <noreply@github.com>2016-11-18 17:34:47 -0800
commit21fe34b7f74c62491dd595e70afefaead57e486c (patch)
tree6576c107b0399628fb050375a1cbfa964ff81016
parent997e970310851784a0fb8983aa1b6f89096167ff (diff)
downloadgoogle-compute-image-packages-21fe34b7f74c62491dd595e70afefaead57e486c.tar.gz
Add a route to the metadata server to /etc/hosts. (#360)
-rwxr-xr-xgoogle_config/bin/set_hostname3
1 files changed, 3 insertions, 0 deletions
diff --git a/google_config/bin/set_hostname b/google_config/bin/set_hostname
index 5ced34c..01a11ad 100755
--- a/google_config/bin/set_hostname
+++ b/google_config/bin/set_hostname
@@ -21,6 +21,9 @@ if [ -n "$new_host_name" ] && [ -n "$new_ip_address" ]; then
# Add an entry for our new_host_name/new_ip_address in /etc/hosts.
echo "${new_ip_address} ${new_host_name} ${new_host_name%%.*} # Added by Google" >> /etc/hosts
+
+ # Add an entry for reaching the metadata server in /etc/hosts.
+ echo "169.254.169.254 metadata.google.internal # Added by Google" >> /etc/hosts
fi
# /sbin/dhclient-scripts in both ubuntu and centos have some problems for us: