Skip to content

Commit

Permalink
fix DNS resolution on centos machines
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Glonek committed Aug 5, 2024
1 parent 6eb53ce commit c0979b9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/cmdClientDoBase.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,12 @@ DNS=1.1.1.1
FallbackDNS=8.8.8.8
EOF
systemctl restart systemd-resolved
systemctl restart systemd-resolved || echo "No systemctl"
if [ -d /etc/NetworkManager/system-connections ]
then
ls /etc/NetworkManager/system-connections |sed 's/.nmconnection//g' |while read file; do nmcli conn modify "$file" ipv4.dns "1.1.1.1 8.8.8.8"; done
systemctl restart NetworkManager
fi
`
if err = b.CopyFilesToClusterReader(string(c.ClientName), []fileListReader{{filePath: "/tmp/fix-dns.sh", fileContents: strings.NewReader(dnsScript), fileSize: len(dnsScript)}}, []int{nnode}); err == nil {
if _, err = b.RunCommands(string(c.ClientName), [][]string{{"/bin/bash", "-c", "chmod 755 /tmp/fix-dns.sh; bash /tmp/fix-dns.sh"}}, []int{nnode}); err != nil {
Expand Down
6 changes: 6 additions & 0 deletions src/cmdClientDoNone.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,12 @@ DNS=1.1.1.1
FallbackDNS=8.8.8.8
EOF
systemctl restart systemd-resolved
systemctl restart systemd-resolved || echo "No systemctl"
if [ -d /etc/NetworkManager/system-connections ]
then
ls /etc/NetworkManager/system-connections |sed 's/.nmconnection//g' |while read file; do nmcli conn modify "$file" ipv4.dns "1.1.1.1 8.8.8.8"; done
systemctl restart NetworkManager
fi
`
if err = b.CopyFilesToClusterReader(string(c.ClientName), []fileListReader{{filePath: "/tmp/fix-dns.sh", fileContents: strings.NewReader(dnsScript), fileSize: len(dnsScript)}}, []int{nnode}); err == nil {
if _, err = b.RunCommands(string(c.ClientName), [][]string{{"/bin/bash", "-c", "chmod 755 /tmp/fix-dns.sh; bash /tmp/fix-dns.sh"}}, []int{nnode}); err != nil {
Expand Down
7 changes: 6 additions & 1 deletion src/cmdClusterCreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,12 @@ cat <<'EOF' > /etc/systemd/resolved.conf.d/aerolab.conf
DNS=1.1.1.1
FallbackDNS=8.8.8.8
EOF
systemctl restart systemd-resolved
systemctl restart systemd-resolved || echo "No systemctl"
if [ -d /etc/NetworkManager/system-connections ]
then
ls /etc/NetworkManager/system-connections |sed 's/.nmconnection//g' |while read file; do nmcli conn modify "$file" ipv4.dns "1.1.1.1 8.8.8.8"; done
systemctl restart NetworkManager
fi
`
if err = b.CopyFilesToClusterReader(string(c.ClusterName), []fileListReader{{filePath: "/tmp/fix-dns.sh", fileContents: strings.NewReader(dnsScript), fileSize: len(dnsScript)}}, []int{nnode}); err == nil {
if _, err = b.RunCommands(string(c.ClusterName), [][]string{{"/bin/bash", "-c", "chmod 755 /tmp/fix-dns.sh; bash /tmp/fix-dns.sh"}}, []int{nnode}); err != nil {
Expand Down

0 comments on commit c0979b9

Please sign in to comment.