how to configure network with DHCP_FQDN and PEERDNS

5 views
Skip to first unread message

j

unread,
Mar 10, 2020, 5:43:14 PM3/10/20
to Vagrant
Hi!

I have been trying to add the lines below in /etc/sysconfig/network-scripts/ifcfg-eth0.

DHCP_FQDN=server1.example.com
PEERDNS
=yes

Here are my specs.
Vagrant 2.2.7

Vagrantfile
Vagrant.configure("2") do |config|

  config
.vm.box = "bento/centos-8.1"

end

I have tried adding the following in the config.

config.vm.network "public_network", DHCP_FQDN: "server1.example.com", PEERDNS: "yes"

and

config.vm.provision "shell", inline: <<-SHELL
echo
-e "DHCP_FQDN=server1.example.com\nPEERDNS=yes" >> /etc/sysconfig/network-scripts/ifcfg-eth1
systemctl restart
NetworkManager.service"
SHELL

Help.

Thank you in advance.

Regards,
j



j

unread,
Mar 10, 2020, 5:55:34 PM3/10/20
to Vagrant
Used the following to get it working.  Test.sh contains the logic to make the changes to the network.

config.vm.provision "shell", path: "test.sh"

:)
Reply all
Reply to author
Forward
0 new messages