質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

yum

yumコマンドは、UNIX系OSのRPMパッケージのインストールなどを行うためのプログラムのことです。

VirtualBox

VirtualBoxは、現在米オラクル社が開発している、 x86仮想化ソフトウェア・パッケージの一つです。

Q&A

解決済

2回答

2959閲覧

VirtualBoxでブリッジアダプターを使用した際に仮想マシンが外部と疎通できない

shogidaisuki102

総合スコア5

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

yum

yumコマンドは、UNIX系OSのRPMパッケージのインストールなどを行うためのプログラムのことです。

VirtualBox

VirtualBoxは、現在米オラクル社が開発している、 x86仮想化ソフトウェア・パッケージの一つです。

0グッド

1クリップ

投稿2019/12/04 15:29

編集2019/12/08 12:22

仮想化初心者です。
Virtualboxでネットワークにブリッジアダプターを選択して、CentOS7の仮想マシンインスタンスを立ち上げyum updateを打ったところ、以下のようなエラーが返ってきました。

Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error" One of the configured repositories failed (Unknown), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this: 1. Contact the upstream for the repository and get them to fix the problem. 2. Reconfigure the baseurl/etc. for the repository, to point to a working upstream. This is most often useful if you are using a newer distribution release than is supported by the repository (and the packages for the previous distribution release still work). 3. Run the command with the repository temporarily disabled yum --disablerepo=<repoid> ... 4. Disable the repository permanently, so yum won't use it by default. Yum will then just ignore the repository until you permanently enable it again or use --enablerepo for temporary usage: yum-config-manager --disable <repoid> or subscription-manager repos --disable=<repoid> 5. Configure the failing repository to be skipped, if it is unavailable. Note that yum will try to contact the repo. when it runs most commands, so will have to try and fail each time (and thus. yum will be be much slower). If it is a very temporary problem though, this is often a nice compromise: yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true Cannot find a valid baseurl for repo: extras/7/x86_64

同じような症例がないかググったところ、/etc/sysconfig/network-scripts/ 配下にあるifcfg-〇〇 にDNSとゲートウェイの設定を追記すればよいと書いてあり、そのように対応してsystemctl restart NetworkManagerを打ったのですが問題が解決しません。

pingで疎通確認をしたところ、
ホストOS⇔ゲストOS:〇
ゲストOS⇔デフォルトゲートウェイ:〇
となりました。
(当初、ゲストOS→ホストOSが疎通できなかったのですが、ファイアウォールの設定で仮想マシン監視のICMPを許可したところ通るようになりました。)

どうすれば仮想マシンが外部と疎通できるようになるのか、どなたかお知恵をお貸しください。どうぞよろしくお願いします。

環境
ハード:Windows10 home
仮想化ソフト:VirtualBox 6.0
ゲストOS:CentOS 7.7.1908(core)

追記:nmcliを打った結果
[root@ansiblecontroller ~]# nmcli connection show enp0s3 | grep ipv4
ipv4.method: manual
ipv4.dns: 218.176.253.65,218.176.253.97
ipv4.dns-search: --
ipv4.dns-options: ""
ipv4.dns-priority: 0
ipv4.addresses: 192.168.1.6/24
ipv4.gateway: 192.168.1.1
ipv4.routes: --
ipv4.route-metric: -1
ipv4.route-table: 0 (unspec)
ipv4.routing-rules: --
ipv4.ignore-auto-routes: no
ipv4.ignore-auto-dns: no
ipv4.dhcp-client-id: --
ipv4.dhcp-timeout: 0 (default)
ipv4.dhcp-send-hostname: yes
ipv4.dhcp-hostname: --
ipv4.dhcp-fqdn: --
ipv4.never-default: no
ipv4.may-fail: no
ipv4.dad-timeout: -1 (default)

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

CentOS7ではネットワーク設定はnmcliコマンドで行います。

現在の設定は下記コマンドで確認できますので、正しいか確認しましょう。
(enp0s3はインタフェース名なので環境にあわせて変更してください。VirtualBOXで作った仮想マシンでしたら同じと思います)

nmcli connection show enp0s3 | grep ipv4

不明であれば、上記コマンド結果を質問に追記してください。

Windowsでのipconfig /allコマンド結果もあると尚良いです。

投稿2019/12/05 03:22

yukky1201

総合スコア2751

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

ベストアンサー

DNSの設定をしたのに

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

となったのであれば、DNSの設定が間違っています。
初心者なら、手動設定でなくDHCPによる設定に任せた方がいいかと思います。

投稿2019/12/04 16:25

otn

総合スコア84529

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

shogidaisuki102

2019/12/08 12:10

nmtuiでIPv4 CONFIGURATIONの設定をAutomaticにしてみたのですが、やはり外部と疎通できませんでした…
otn

2019/12/08 12:25

nmcli コマンドで、ipアドレスやDNSが今どう設定されているか表示されます。 あと、 dig mirrorlist.centos.org と dig mirrorlist.centos.org @8.8.8.8 の結果はどうなりますか?
shogidaisuki102

2019/12/08 12:43

[root@ansiblecontroller ~]# dig mirrorlist.centos.org ; <<>> DiG 9.11.4-P2-RedHat-9.11.4-9.P2.el7 <<>> mirrorlist.centos.org ;; global options: +cmd ;; connection timed out; no servers could be reached [root@ansiblecontroller ~]# dig mirrorlist.centos.org @8.8.8.8 ; <<>> DiG 9.11.4-P2-RedHat-9.11.4-9.P2.el7 <<>> mirrorlist.centos.org @8.8.8.8 ;; global options: +cmd ;; connection timed out; no servers could be reached [root@ansiblecontroller ~]# DNSを打った結果は質問本文に追記しました(今はDNSを使うように戻しています)
otn

2019/12/08 14:04

そもそも外部へのpingは通ってるんですか??
shogidaisuki102

2019/12/08 14:09

通ってないです… yahooのアドレス(183.79.219.252)に向けてpingを打ちましたが何も返ってきませんでした。
otn

2019/12/08 14:13

ああ、yumが失敗するという質問じゃなくて、外部と通信できないということでしたか。 普通、yumコマンドは、外部と通信できることを確認してから実行します。
otn

2019/12/08 14:18

traceroute 8.8.8.8 はどうなりますか?
shogidaisuki102

2019/12/10 10:13

気を付けます… >>普通、yumコマンドは、外部と通信できることを確認してから実行します。 [osboxes@ansiblecontroller ~]$ traceroute 8.8.8.8 traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets 1 gateway (192.168.1.1) 0.751 ms 0.693 ms 1.602 ms 2 * * * 3 * * * 4 * * * 5 * * * 6 * * * 7 * * * 8 * * * 9 * * * 10 * * * 11 * * * 12 * * * 13 * * * 14 * * * 15 * * * 16 * * * 17 * * * 18 * * * 19 * * * 20 * * * 21 * * * 22 * * * 23 * * * 24 * * * 25 * * * 26 * * * 27 * * * 28 * * * 29 * * * 30 * * * [osboxes@ansiblecontroller ~]$
otn

2019/12/10 11:02

中略でよかったのに。。。 ホストのWindows10で、tracert 8.8.8.8 ではどうなりますか?192.168.x.x と 8.8.8.8以外のIPアドレスはマスクして書いてください。
shogidaisuki102

2019/12/10 12:45

確かに見づらいですね???? C:\Users\xxxx>tracert 8.8.8.8 dns.google [8.8.8.8] へのルートをトレースしています 経由するホップ数は最大 30 です: 1 6 ms 6 ms 6 ms softbankxxxxxxxxxxxx.bbtec.net [xxx.xxx.xxx.xxx] 2 12 ms 6 ms 7 ms softbankxxxxxxxxxxxx.bbtec.net [xxx.xxx.xxx.xxx] 3 13 ms 13 ms 13 ms softbankxxxxxxxxxxxx.bbtec.net [xxx.xxx.xxx.xxx] 4 * * * 要求がタイムアウトしました。 5 8 ms 7 ms 11 ms xxx.xx.xxx.xxx 6 * * * 要求がタイムアウトしました。 7 10 ms 10 ms 8 ms dns.google [8.8.8.8] トレースを完了しました。 C:\Users\xxxx>
otn

2019/12/10 13:08

普通は、1番目は家庭内ルーターになるはずですが、 Win10PCは、ルーターを介さずにインターネットにつながっているのですか?
shogidaisuki102

2019/12/12 13:40

ルーターはあります。10年前くらいのものですが、LANポートが複数あるもおで、ADSL回線でつながっています。
otn

2019/12/12 13:50

ちょっと、ネットワーク構成がどうなっているのか想像がつかなくなってきました。
shogidaisuki102

2019/12/12 15:21

特別な設定はしていないのですが… ここまで辛抱強く付き合ってもらってありがとうございます。 自分でも色々調べてみますね!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問