Created
May 1, 2018 06:39
-
-
Save glennswest/c094249c8c9daf6e0f13b05d6c21bb90 to your computer and use it in GitHub Desktop.
Windows net setup
This file contains hidden or 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
$INTERFACE_ALIAS="Ethernet 3" | |
Stop-Service ovs-vswitchd -force; Get-VMSwitch -SwitchType External | Disable-VMSwitchExtension "Cloudbase Open vSwitch Extension" | |
Get-VMSwitch -SwitchType External | Set-VMSwitch -AllowManagementOS $false | |
# Ignore the error from the first command | |
Get-VMSwitch -SwitchType External | Set-VMSwitch -AllowManagementOS $false | |
ovs-vsctl --no-wait --may-exist add-br br-ex | |
ovs-vsctl --no-wait add-port br-ex '$INTERFACE_ALIAS' | |
Get-VMSwitch -SwitchType External | Enable-VMSwitchExtension "Cloudbase Open vSwitch Extension"; sleep 2; Restart-Service ovs-vswitchd | |
# Clone the MAC Address of $INTERFACE_ALIAS on br-ex | |
$MAC_ADDRESS=$(Get-NetAdapter "$INTERFACE_ALIAS").MacAddress | |
$FAKE_MAC_ADDRESS=$MAC_ADDRESS.Substring(0,15)+"99" | |
Set-NetAdapter -Name "$INTERFACE_ALIAS" -MacAddress $FAKE_MAC_ADDRESS -Confirm:$false | |
Set-NetAdapter -Name br-ex -MacAddress $MAC_ADDRESS -Confirm:$false | |
# br-ex will get all the interface details from the DHCP server now | |
Enable-NetAdapter br-ex | |
$GUID = (New-Guid).Guid | |
ovs-vsctl set Open_vSwitch . external_ids:system-id="$($GUID)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment