Skip to content

Commit f0d78e1

Browse files
authored
Merge pull request #318 from mekanix/feature/automatic-dns
Let DHCP set resolv.conf
2 parents a1bb595 + e3454a2 commit f0d78e1

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

scripts/base-network-init.sh

+7
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ dns() {
100100
jexec ${SERVICE} usr/local/bin/reggae-register.sh ipv6 add ${IPV6_PREFIX}${MASTER_IP6} @ ${DOMAIN}
101101
jexec ${SERVICE} /usr/local/bin/reggae-register.sh ipv6 add ${IPV6_PREFIX}${MASTER_IP6} network ${DOMAIN}
102102
fi
103+
echo "search $(hostname)" >"${BASE_WORKDIR}/${SERVICE}/etc/resolv.conf"
104+
if [ "${USE_IPV4}" = "yes" ]; then
105+
echo "nameserver 127.0.01" >>"${BASE_WORKDIR}/${SERVICE}/etc/resolv.conf"
106+
fi
107+
if [ "${USE_IPV6}" = "yes" ]; then
108+
echo "nameserver ::1" >>"${BASE_WORKDIR}/${SERVICE}/etc/resolv.conf"
109+
fi
103110
}
104111

105112

scripts/mkjail.sh

+1-8
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,7 @@ if [ "${NAME}" = "network" ]; then
164164
sed -e "s;HOST;${HOST};g" \
165165
-e "s;BASE_WORKDIR;${BASE_WORKDIR};g" \
166166
-e "s;INTERFACE;${INTERFACE};g" \
167-
"${SCRIPT_DIR}/../templates/network-jail.conf" >"/etc/jail.conf.d/${NAME}.conf"
168-
echo "search $(hostname)" >"${BSDINSTALL_CHROOT}/etc/resolv.conf"
169-
if [ "${USE_IPV4}" = "yes" ]; then
170-
echo "nameserver ${INTERFACE_IP}" >>"${BSDINSTALL_CHROOT}/etc/resolv.conf"
171-
fi
172-
if [ "${USE_IPV6}" = "yes" ]; then
173-
echo "nameserver ${IPV6_PREFIX}${INTERFACE_IP6}" >>"${BSDINSTALL_CHROOT}/etc/resolv.conf"
174-
fi
167+
"${SCRIPT_DIR}/../templates/network-jail.conf" >"/etc/jail.conf.d/${NAME}.conf"
175168
else
176169
MOUNTS=$(get_mounts)
177170
DEPENDS=$(get_dependencies)

0 commit comments

Comments
 (0)