Merge pull request #568 from man715/master

Fix for Issue #525
This commit is contained in:
Chris Long
2020-11-24 11:23:02 -08:00
committed by GitHub
3 changed files with 25 additions and 3 deletions

View File

@@ -29,9 +29,7 @@ By not having this line added to the Vagrantfile you will be required to put in
During the build you will also have to select the virtual switch you want to use for each server. This cannot be avoided. There is a option that can be used to force the network adapter to use a particular switch; however, using that option breaks this build process. During the build you will also have to select the virtual switch you want to use for each server. This cannot be avoided. There is a option that can be used to force the network adapter to use a particular switch; however, using that option breaks this build process.
A really hacky workaround is, if you are using the smb_username and smb_password options, would be to press the option number corresponding with the virtual switch you want to use then enter four times after `vagrant up`. So, if you know you want the virtual switch 1 `vagrant up` 1 enter 1 enter 1 enter 1 enter A really hacky workaround is, if you are using the smb_username and smb_password options, would be to press the option number corresponding with the virtual switch you want to use then enter four times after `vagrant up`. So, if you know you want the virtual switch 1 `vagrant up` 1 enter 1 enter 1 enter 1 enter
Yes, I know hacky but it works.
## How this build works ## How this build works
The majority of this build works the same as the VirtualBox build. The most notable difference is on the Windows builds. There is a script that will create an internal virtual switch called "NATSwitch." Throughout the build process, a script will create a second network adapter and attach it to the NATSwitch on the VM being built. After the machine is built the original network adapter will be removed from the VM. The majority of this build works the same as the VirtualBox build. The most notable difference is on the Windows builds. There is a script that will create an internal virtual switch called "NATSwitch." Throughout the build process, a script will create a second network adapter and attach it to the NATSwitch on the VM being built. After the machine is built the original network adapter will be removed from the VM.

1
HyperV/Vagrantfile vendored
View File

@@ -15,6 +15,7 @@ Vagrant.configure("2") do |config|
cfg.vm.provision "reload" cfg.vm.provision "reload"
cfg.vm.provision :shell, path: "check-eth0-ip.sh" cfg.vm.provision :shell, path: "check-eth0-ip.sh"
cfg.vm.provision :shell, path: "../Vagrant/logger_bootstrap.sh" cfg.vm.provision :shell, path: "../Vagrant/logger_bootstrap.sh"
cfg.vm.provision :shell, path: "reset-static-ip.sh"
cfg.vm.provision :shell, path: "fix-motd.sh" cfg.vm.provision :shell, path: "fix-motd.sh"

23
HyperV/reset-static-ip.sh Normal file
View File

@@ -0,0 +1,23 @@
reset_static_ip() {
# The bootstrap script assumes that there are two adapters and attempts to set the ip address
# to the eth1 adapter. This corrects the 01-netcfg.yaml file
MAC=$(ip a | grep "link/ether" | cut -d ' ' -f 6)
cat > /etc/netplan/01-netcfg.yaml << EOL
network:
ethernets:
eth0:
match:
macaddress: $MAC
dhcp4: no
addresses: [192.168.38.105/24]
gateway4: 192.168.38.1
nameservers:
addresses: [8.8.8.8,8.8.4.4]
set-name: eth1
version: 2
renderer: networkd
EOL
}
reset_static_ip