Vagrantfile: set DNS configuration in network-scripts

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.
This commit is contained in:
Fraser Tweedale 2018-06-11 10:40:03 +10:00 committed by Alexander Bokovoy
parent bc1c5a84bd
commit 345850eb6c

8
Vagrantfile vendored
View File

@ -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
@ -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",