forked from openshift/installer
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
baremetal: Add script to configure local DNS
This was previously done with an option to dhclient, but this doesn't work when doing DHCPv6. Switch to a script run by NetworkManager to do the same thing. This matches the same approach moved to by the MCO in this PR: openshift/machine-config-operator#1396
- Loading branch information
Showing
3 changed files
with
21 additions
and
8 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
data/data/bootstrap/baremetal/files/etc/NetworkManager/dispatcher.d/30-local-dns-prepender
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
IFACE=$1 | ||
STATUS=$2 | ||
case "$STATUS" in | ||
up) | ||
logger -s "NM local-dns-prepender triggered by ${1} ${2}." | ||
DNS_IP="127.0.0.1" | ||
set +e | ||
logger -s "NM local-dns-prepender: Checking if local DNS IP is the first entry in resolv.conf" | ||
if grep nameserver /etc/resolv.conf | head -n 1 | grep -q "$DNS_IP" ; then | ||
logger -s "NM local-dns-prepender: local DNS IP already is the first entry in resolv.conf" | ||
exit 0 | ||
else | ||
logger -s "NM local-dns-prepender: Looking for '# Generated by NetworkManager' in /etc/resolv.conf to place 'nameserver $DNS_IP'" | ||
sed -i "/^# Generated by.*$/a nameserver $DNS_IP" /etc/resolv.conf | ||
fi | ||
;; | ||
*) | ||
;; | ||
esac |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters