Unable to start the VM with centos and not able to figure out the error

I am trying to vagrant up my two VMs: one is Ubuntu and the other is CentOS. One is working fine and the other gives this error:

Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=vag error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=vag error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"

I have tried the ping thing. Internet is coming through but I am not sure why it is happening. I am sharing my vagrantfile too for reference. I tried other solutions on StackOverflow and couldn’t find a solution that worked.

Vagrant.configure("2") do |config|
 
    # Configuration for web01 VM
    config.vm.define "web01" do |web01|
      web01.vm.box = "ubuntu/bionic64"
      web01.vm.hostname = "web01"
      web01.vm.network "private_network", ip: "192.168.40.11"
      web01.vm.provider "virtualbox" do |vb|
          vb.memory = "1024"
          vb.cpus = 2
        end
      web01.vm.provision "shell", inline: <<-SHELL
        apt update
          apt install apache2 wget unzip -y
          systemctl start apache2
          systemctl enable apache2
          cd /tmp/
          wget https://www.tooplate.com/zip-templates/2119_gymso_fitness.zip
          unzip -o 2119_gymso_fitness.zip
          cp -r 2119_gymso_fitness/* /var/www/html/
          systemctl restart apache2
      SHELL
    end
  
    # Configuration for db01 VM
    config.vm.define "db01" do |db01|
      db01.vm.box = "centos/7"
      db01.vm.hostname = "db01"
      db01.vm.network "private_network", ip: "192.168.40.12"
      db01.vm.provider "virtualbox" do |vb|
        vb.memory = "1024"
        vb.cpus = 2
     end
  
      # Provisioning with a shell script
      db01.vm.provision "shell", inline: <<-SHELL
        # Update package list and install necessary software 
        yum install -y mariadb-server -y
        systemctl start mariadb
        systemctl start mariadb
        systemctl enable mariadb
  
        mysql -u root -e 'CREATE DATABASE wordpress;'
        mysql -u root -e 'GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER ON wordpress.* TO wordpress@localhost IDENTIFIED BY "admin123";'
        mysql -u root -e 'FLUSH PRIVILEGES;'
      SHELL
    end
  end