7
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

vagrantで構築した環境でDNS解決できていないかもな時

Posted at

どうしたの

yumでインストールしようとしたらエラーでた

curl#6 - "Could not resolve host: mirrorlist.centos.org;

確認

参考:yum installが失敗するときにやったこと。DNS解決 | 屋根裏の部屋

対応方法

ifcfg-eth0に追記

/etc/sysconfig/network-scripts/ifcfg-eth0にDNSサーバ追記

sudo sh -c "echo -e 'DNS1=8.8.8.8\nDNS2=8.8.4.4' >> /etc/sysconfig/network-scripts/ifcfg-eth0"

中身こんなん

ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="dhcp"
ONBOOT="yes"
TYPE="Ethernet"
PERSISTENT_DHCLIENT="yes"
DNS1=8.8.8.8  #追加
DNS2=8.8.4.4  #追加

network再起動

sudo service network restart

確認

ping通ってればOK

ping www.yahoo.co.jp

おわり

参考:Vagrantのネットワークで躓いた

memo

eth0 はNATなので外部のネットワークにつながる用のアダプター
eth1 はホストコンピュータとsshさせる用のアダプター

7
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?