Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

Commit

Permalink
Vagrantfile: set DNS configuration in network-scripts
Browse files Browse the repository at this point in the history
The Vagrantfile puts the server's address in /etc/resolv.conf but
this configuration will not survive a reboot or network restart.
Add configuration to /etc/sysconfig/network-scripts/ to ensure the
correct resolver is always used.
  • Loading branch information
frasertweedale committed Jun 11, 2018
1 parent 3fae237 commit d64a113
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Vagrantfile
Expand Up @@ -33,6 +33,10 @@ Vagrant.configure(2) do |config|
replica.vm.network "private_network", ip: "192.168.33.11"
replica.vm.hostname = "replica.ipademo.local"

replica.vm.provision "shell",
inline: 'echo "PEERDNS=no" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
replica.vm.provision "shell",
inline: 'echo "DNS1=192.168.33.10" >> /etc/sysconfig/network-scripts/ifcfg-eth1'
replica.vm.provision "shell",
inline: 'echo "nameserver 192.168.33.10" > /etc/resolv.conf'
end
Expand All @@ -41,6 +45,10 @@ Vagrant.configure(2) do |config|
client.vm.network "private_network", ip: "192.168.33.20"
client.vm.hostname = "client.ipademo.local"

client.vm.provision "shell",
inline: 'echo "PEERDNS=no" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
client.vm.provision "shell",
inline: 'echo "DNS1=192.168.33.10" >> /etc/sysconfig/network-scripts/ifcfg-eth1'
client.vm.provision "shell",
inline: 'echo "nameserver 192.168.33.10" > /etc/resolv.conf'
client.vm.provision "shell",
Expand Down

0 comments on commit d64a113

Please sign in to comment.