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

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

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

Windows 10は、マイクロソフト社がリリースしたOSです。Modern UIを標準画面にした8.1から、10では再びデスクトップ主体に戻され、UIも変更されています。PCやスマホ、タブレットなど様々なデバイスに幅広く対応していることが特徴です。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

Q&A

解決済

4回答

316閲覧

1度は接続出来たのに・・PuTTY・・接続したい!

chiro_qok

総合スコア10

Windows 10

Windows 10は、マイクロソフト社がリリースしたOSです。Modern UIを標準画面にした8.1から、10では再びデスクトップ主体に戻され、UIも変更されています。PCやスマホ、タブレットなど様々なデバイスに幅広く対応していることが特徴です。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

0グッド

1クリップ

投稿2017/07/11 23:11

ドットインストールのローカル開発環境を学習している者です。

virtualboxとvagrantをダウンロードし、7/8にVagrant up後、PuTTYに接続、PHPやRubyなどのアプリもインストール出来ました。ここで1度はログイン出来たんです。そこで学習を終了し、次の日に同じようにvagrant upして続きをと思ったら、PuTTYにエラーが出るようになってしまいました。やり直しすぎてもう埒が明かないので、どなたかご教示願いたく質問立てました。

現在の段階では、仮想マシンは起動出来ていますが、PuTTYを起動した時点で

putty fatal error server unexpectedly closed network

と表示され、先に進む事が出来ません。色々と調べ、アイドル状態になっているのか、PuTTYの接続のkeepaliveの数字を0から15とか、変えてみましたが結果は同じで。

もう、どうしたらいいか分かりません。ドットインストールの管理者に質問もし、
色々と対処済みであり、poderozaを進められました。結果、PuTTYが何か問題が有るようなので、poderozaが使えるならそれで学習を進めてくださいとの事でしたが・・・poderozaでは接続出来たのですが、使い方がイマイチわからず、PuTTYでは一度は接続出来たので、何とか出来ないかと悪戦苦闘しております。

vagrant upで途中の経過が気になるのですが、これは関係有るのでしょうか。

PS C:\Users\user\Myvagrant\MyCentOS> vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'bento/centos-6.8' is up to date...
==> default: Machine already provisioned. Run vagrant provision or use the --provision
==> default: flag to force provisioning. Provisioners marked to run always will still run.
PS C:\Users\user\Myvagrant\MyCentOS> vagrant halt
==> default: Attempting graceful shutdown of VM...
PS C:\Users\user\Myvagrant\MyCentOS> vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'bento/centos-6.8' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection aborted. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection aborted. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection reset. Retrying...
default: Warning: Connection aborted. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection aborted. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
==> default: Mounting shared folders...
default: /vagrant => C:/Users/user/MyVagrant/MyCentOS
==> default: Machine already provisioned. Run vagrant provision or use the --provision
==> default: flag to force provisioning. Provisioners marked to run always will still run.

『default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...』とエラーを繰り返す割には、
PS C:\Users\user\Myvagrant\MyCentOS> vagrant status
Current machine states:

default running (virtualbox)

The VM is running. To stop this VM, you can run vagrant halt to
shut it down forcefully, or you can run vagrant suspend to simply
suspend the virtual machine. In either case, to restart it again,

となっており、起動出来てる・・のがよく分かりません。

環境
windows 10 64 bit
vagrant/virtualbox 最新版

宜しくお願い致します!!

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

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

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

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

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

guest

回答4

0

自己解決

色々教えて頂きましたが、自己で解決できず、PuTTYではなく違うターミナルで接続出来たため。

色々ご教授くださった皆様、ありがとうございました。

投稿2017/07/14 03:17

chiro_qok

総合スコア10

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

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

0

一度は接続できたあとに、vagrantを正しく停止等しましたか?(dotinstallだとsuspendをするように言ってるはず)

実は私も接続できてたのに、suspendせずにPCが落ちた時にできなくなったっていうことがありました。

私は適切な対応ではないのだろうとは思いましたが、いっそのことと思い、MyVagrantフォルダから消して作り直してみたら動いたりしました。
(まぁ作り直して動かなかったらもう、、、ですけどね)

これは、あくまでも参考程度のコメントで、これが解決するための方法として適切とは言いませんが、悩みすぎるよりはリセットするのも最終的には一つの方法で、早いかもしれません。。。

投稿2017/07/12 02:21

Z-TALBO

総合スコア525

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

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

chiro_qok

2017/07/12 02:27

ありがとうございます。 >一度は接続できたあとに、vagrantを正しく停止等しましたか? ・・していません。exitして終了させてしまいました。 これが原因でしょうか。でも1から入れなおしてやり直ししても、PuTTYの結果は同じなのです。。。
Z-TALBO

2017/07/12 05:47

終了の仕方が原因というのはあると思います。 puttyの入れなおしをしてみるのも方法かなと思いますし、いっそですが、ipを変えてみてやってみるのはどうでしょうか? vagrantfileで#を外した奴のipを変えるだけなので、例えば192.168.33.11とかにして、putty側もそれで新たにやってみるってのは? dotinstallを見ながらだとsuspendなどの説明もしてくれていたと思います。 exitはvagrantが終了というよりはpowershellとかの終了なので、vagrant自体はrunnninngしてます。 やはり、起動させ続けるのは簡単ですが、終了のさせ方は気にしないと面倒が増えるだけですよ。 vagrantコマンドもついでに検索してみてみるのも良いかと思います。
chiro_qok

2017/07/12 08:05

ほんとそうですよね。suspendで終了させてちゃんとやっていれば・・と思います。 ファイルも書き換えて192.168.33.11でやってみましたが、 putty fatal error server unexpectedly closed network となってしまいました。もう、PuttYはやめようかと思います。
guest

0

private_network を有効にしているので、192.168.33.10:22
でも接続できると思います。
vagrant reload するとどうなりますか?

投稿2017/07/12 01:13

hotta

総合スコア1613

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

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

chiro_qok

2017/07/12 01:52

hottaさん ありがとうございます。reloadした結果はVagrant upした結果と同じです。 PS C:\Users\user\Myvagrant\MyCentOS> vagrant halt ==> default: Attempting graceful shutdown of VM... PS C:\Users\user\Myvagrant\MyCentOS> vagrant reload ==> default: Checking if box 'bento/centos-6.8' is up to date... ==> default: Clearing any previously set forwarded ports... ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat default: Adapter 2: hostonly ==> default: Forwarding ports... default: 22 (guest) => 2222 (host) (adapter 1) ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key ==> default: Machine booted and ready! ==> default: Checking for guest additions in VM... ==> default: Configuring and enabling network interfaces... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key ==> default: Mounting shared folders... default: /vagrant => C:/Users/user/MyVagrant/MyCentOS ==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision` ==> default: flag to force provisioning. Provisioners marked to run always will still run.
guest

0

何が悪いか分からないので Vagrantfile を載せて下さい。

vagrant ssh で接続できますか?であれば putty の設定が間違ってるのだと思います。

エスパーですが、putty で指定した private key が間違った物を指してるんじゃないかと思います。

投稿2017/07/11 23:54

mattn

総合スコア5030

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

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

chiro_qok

2017/07/11 23:59

# -*- mode: ruby -*- # vi: set ft=ruby : # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please don't change it unless you know what # you're doing. Vagrant.configure("2") do |config| # The most common configuration options are documented and commented below. # For a complete reference, please see the online documentation at # https://docs.vagrantup.com. # Every Vagrant development environment requires a box. You can search for # boxes at https://vagrantcloud.com/search. config.vm.box = "bento/centos-6.8" # Disable automatic box update checking. If you disable this, then # boxes will only be checked for updates when the user runs # `vagrant box outdated`. This is not recommended. # config.vm.box_check_update = false # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine. In the example below, # accessing "localhost:8080" will access port 80 on the guest machine. # NOTE: This will enable public access to the opened port # config.vm.network "forwarded_port", guest: 80, host: 8080 # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine and only allow access # via 127.0.0.1 to disable public access # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" # Create a private network, which allows host-only access to the machine # using a specific IP. config.vm.network "private_network", ip: "192.168.33.10" # Create a public network, which generally matched to bridged network. # Bridged networks make the machine appear as another physical device on # your network. # config.vm.network "public_network" # Share an additional folder to the guest VM. The first argument is # the path on the host to the actual folder. The second argument is # the path on the guest to mount the folder. And the optional third # argument is a set of non-required options. # config.vm.synced_folder "../data", "/vagrant_data" # Provider-specific configuration so you can fine-tune various # backing providers for Vagrant. These expose provider-specific options. # Example for VirtualBox: # # config.vm.provider "virtualbox" do |vb| # # Display the VirtualBox GUI when booting the machine # vb.gui = true # # # Customize the amount of memory on the VM: # vb.memory = "1024" # end # # View the documentation for the provider you are using for more # information on available options. # Enable provisioning with a shell script. Additional provisioners such as # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the # documentation for more information about their specific syntax and use. # config.vm.provision "shell", inline: <<-SHELL # apt-get update # apt-get install -y apache2 # SHELL end
chiro_qok

2017/07/12 00:02

ドットインストールの内容では、vagrantfileの config.vm.network "private_network", ip: "192.168.33.10" とし、保存との内容で、その通りやっており一度はちゃんと接続出来たんです。。
chiro_qok

2017/07/12 00:06

mattn様 putty の設定は、ホスト名(IPアドレス)に192.168.33.10 ポートは22 MyCentOSでsessionを保存し、オープンするという学習の流れの通り行っています。 起動後すぐにフリーズというか、成すすべもなくという感じです。
mattn

2017/07/12 00:07

ドットインストールはやった事がないので分かりませんが、putty のセットアップの最後あたりに putty の設定画面から Saved Session というのをやったはずだと思います。これは 127.0.0.1:2222 (vagrant) の接続時に private key を割り当てた際の状態を保存しておくもので、これが無いと次回から接続出来なくなります。いちど引数など無しに putty を起動してセッション一覧に作った物が残っているか確認してみてはどうでしょうか。
mattn

2017/07/12 00:08

vagrant であればポートは 22 でなく 2222 でないでしょうか。
chiro_qok

2017/07/12 00:11

今PuTTYでポートを22から2222に変更してみましたが、 network error connection refused となり、拒否されました・・・
chiro_qok

2017/07/12 00:16

前後してすみません。 セッション一覧に作った物↓ Saved Sessionを192.168.33.10で MyCentOSでsessionを保存  次回、これでerrorという感じなのです。一切何も変更もしていません。 次の日いきなり、errorになりました。
mattn

2017/07/12 00:18

vagrant であれば localhost のポート 2222 に接続する事になると思いますが。
chiro_qok

2017/07/12 00:25

学習では192.168.33.10で MyCentOSでsessionを保存  ポート22で保存し、次回これをロードして・・・という風に言っています。 vagrant ssh Last login: Tue Jul 11 23:28:50 2017 from 192.168.33.1 ちなみに、 localhostまたは127.0.0.1  2222 でやってみても、フリーズするんですよね。。。 putty fatal error server unexpectedly closed network と返ってきます。
mattn

2017/07/12 01:18

あー、ドットインストールは private network を有効にするんですね。なんとなですが VirtualBox の NAT 設定で 2222 が空いてないのでは?
chiro_qok

2017/07/12 01:28

mattn様 ありがとうございます。 ちょっとそれを確認してみます。
mattn

2017/07/12 03:06

poderoza で接続出来ているのであれば、vagrant の再起動とかリロードの問題ではないと思っています。putty の何かしらの設定が間違ってるはずです。単純に IP とか間違ってないですか?
chiro_qok

2017/07/12 04:40

学習通り、そして1度目の接続の時と同じ192.168.33.10で、ポートは22で、session名をつけてセーブして、次回はloadするって感じでやってまして。IP学習の通りなので、そして学習サイト管理者に画面キャプチャーも送ってますので、そこは問題ないはずなのです。。。
mattn

2017/07/12 06:39

ですとおそらく Virtualbox の設定かなと思います。まず ping 192.168.33.10 で ping が通る事を確認して、通る様であれば VirtualBox 画面からゲストを右クリックして「設定」「ネットワーク」「高度」「ポートフォワーディング」で 22 が開いている事を確認して下さい。
chiro_qok

2017/07/12 08:06

ping 192.168.33.10 では通ってます。 VirtualBox 画面での設定、やってみます!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問