Skip to content

Commit

Permalink
Change how hostnames work:
Browse files Browse the repository at this point in the history
- only use shortform for /etc/nodename (no domain appended)
- only add hostname to the 127.0.0.1 entry in /etc/inet/hosts
- do not add any entries to /etc/inet/hosts for public/private IPs
  • Loading branch information
mamash committed Mar 5, 2013
1 parent a5a1365 commit 33c8d8d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
4 changes: 2 additions & 2 deletions zoneinit/includes/02-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ else
fi
: ${ZONENAME:=$(zonename)}
: ${HOSTNAME:=${ZONENAME}.local}
: ${DOMAINNAME:=${HOSTNAME##*.}}
: ${HOSTNAME:=${ZONENAME}}
: ${DOMAINNAME:=local}
[ ${RAM_IN_BYTES} ] || RAM_IN_BYTES=$( kstat -p -c zone_memory_cap -s physcap | awk '{print $2}' )
[ ${RAM_IN_BYTES} -gt 0 2>/dev/null ] || RAM_IN_BYTES=134217728
Expand Down
15 changes: 5 additions & 10 deletions zoneinit/includes/12-network.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
log "setting hostname, IPs and resolvers"

echo "${HOSTNAME}.${DOMAINNAME}" > /etc/nodename
/bin/hostname ${HOSTNAME}.${DOMAINNAME}
echo "${HOSTNAME}" > /etc/nodename
/bin/hostname ${HOSTNAME}

(
echo "domain ${DOMAINNAME}"
/bin/sed -E -e '/nameserver|domain/d' /etc/resolv.conf 2>/dev/null
/bin/sed '/nameserver/d' /etc/resolv.conf 2>/dev/null
for HOST in ${RESOLVERS[@]}; do
echo "nameserver ${HOST}"
done
) > /etc/resolv.conf.tmp
mv /etc/resolv.conf{.tmp,}

for IP in ${PUBLIC_IPS[@]}; do
echo "${IP}"$'\t'"${HOSTNAME}" >> /etc/inet/hosts
done
for IP in ${PRIVATE_IPS[@]}; do
echo "${IP}"$'\t'"${ZONENAME}"$'\t'"loghost" >> /etc/inet/hosts
done
sed '/^127\.0\.0\.1/s/$/ '${HOSTNAME}'/' /etc/inet/hosts > /etc/inet/hosts.tmp
mv /etc/inet/hosts{.tmp,}

log "checking if we can reach the Internets"

Expand Down

0 comments on commit 33c8d8d

Please sign in to comment.