LoginSignup
2
2

More than 5 years have passed since last update.

Vagrantのpublic networkのIP固定でもvagrant-hostsupdaterを効かせたい

Posted at

環境

  • vagrant-hostsupdater 0.0.11

コード変更

変更するファイル
"C:\Users\<username>\.vagrant.d\gems\gems\vagrant-hostsupdater-0.0.11\lib\vagrant-hostsupdater\HostsUpdater.rb"

HostsUpdater.rb
          key, options = network[0], network[1]
          ip = options[:ip] if key == :private_network
          ips.push(ip) if ip

これを

HostsUpdater.rb
          key, options = network[0], network[1]
          ip = options[:ip] if key == :private_network || key == :public_network
          ips.push(ip) if ip

こう。

簡単ですね。

尚、Win8.1などでは通常のコマンドプロンプトからではhostsファイルの変更ができないので、Vagrantの起動に使うコマンドプロンプトは管理者として実行したコマンドプロンプトを使おう。

2
2
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
2
2