解決vagrant up centOS name server 會被更改問題

解法一:異動 Vagrantfile

config.vm.provider "virtualbox" do |v| 
  v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end

設定

  • /etc/sysconfig/network-scripts/ifcfg-eth0
NM_CONTROLLED=no
PEERDNS=no
DNS1=8.8.8.8
DNS2=208.67.222.222
DNS3=208.67.220.220
  • /etc/sysconfig/network
RES_OPTIONS="single-request-reopen"
  • 執行:
sudo service NetworkManager stop
sudo chkconfig NetworkManager off
sudo yum erase NetworkManager
  • 重新啟動 vagrant
vagrant up --provision