2016-08-23 21 views

回答

1

我相信在Appveyor VM上安裝腳本(使用Install-WindowsFeature)並配置標準MS DNS和DHCP並使用PowerShell配置它們非常容易。

這裏是有用的PowerShell命令:

https://technet.microsoft.com/en-us/library/jj590751(v=wps.630).aspx

https://technet.microsoft.com/en-us/library/jj649850.aspx

下面是示例安裝一節Appveyor.yml:

install: 
- ps: | 

    Install-WindowsFeature -Name DNS -IncludeManagementTools -WarningAction SilentlyContinue 

    Install-WindowsFeature -Name DHCP -IncludeManagementTools -WarningAction SilentlyContinue 

    Add-DnsServerPrimaryZone -Name foo.bar -ZoneFile foo.bar.dns 

    Add-DhcpServerv4Scope -Name TestScope -StartRange 192.168.1.100 -EndRange 192.168.1.110 -SubnetMask 255.255.255.0 

    $ip = (Get-NetIPAddress -AddressFamily IPv4 | Where-Object {$_.InterfaceAlias -like '*ethernet*'}).IPAddress 

    Set-DHCPServerv4OptionValue -DnsDomain foo.bar -DnsServer $ip 

但是,我不知道我完全理解場景。哪些機器將成爲這些服務的客戶? Appveyor構建正在單個虛擬機上執行,該虛擬機位於NAT後面,無法從公共Internet訪問。或者你的軟件會連接到本地機器的DNS/DHCP服務器,獲取專用IP並註冊一些名稱?

另外請注意,您可以configure hosts file,這可能是您的問題更簡單的解決方案。

謝謝,

伊利亞。

+0

hosts文件不會工作,因爲我需要通配符。 –