Last active
December 22, 2015 07:42
-
-
Save stknohg/2b033479e40c38d9912f to your computer and use it in GitHub Desktop.
VagrantでWindowsゲストのNIC名が日本語の場合でもIPアドレスの設定を行える様にするパッチ。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- ./guest_network.rb.orig 2015-01-06 13:42:26.000000000 +0900 | |
+++ ./guest_network.rb 2015-01-21 11:40:38.341846700 +0900 | |
@@ -40,8 +40,8 @@ | |
def configure_dhcp_interface(nic_index, net_connection_id) | |
@logger.info("Configuring NIC #{net_connection_id} for DHCP") | |
if !is_dhcp_enabled(nic_index) | |
- netsh = "netsh interface ip set address \"#{net_connection_id}\" dhcp" | |
- @communicator.execute(netsh) | |
+ command = "&{exit (Get-WMiObject Win32_NetworkAdapterConfiguration -Filter \"Index=#{nic_index}\").EnableDHCP().ReturnValue}" | |
+ @communicator.execute(command) | |
end | |
end | |
@@ -53,9 +53,8 @@ | |
# @param [String] The network mask to use with the static IP. | |
def configure_static_interface(nic_index, net_connection_id, ip, netmask) | |
@logger.info("Configuring NIC #{net_connection_id} using static ip #{ip}") | |
- #netsh interface ip set address "Local Area Connection 2" static 192.168.33.10 255.255.255.0 | |
- netsh = "netsh interface ip set address \"#{net_connection_id}\" static #{ip} #{netmask}" | |
- @communicator.execute(netsh) | |
+ command = "&{exit (Get-WMiObject Win32_NetworkAdapterConfiguration -Filter \"Index=#{nic_index}\").EnableStatic(@(\"#{ip}\"), @(\"#{netmask}\")).ReturnValue}" | |
+ @communicator.execute(command) | |
end | |
# Sets all networks on the guest to 'Work Network' mode. This is |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Vagrant 1.8.0でこの問題は解決した様です。
私の環境ではこのパッチが無くても日本語ネットワークアダプタ名の設定がうまくいく様になりました。