Skip to content

Anycast DNS

Anycast DNS allows there to be one dns address across the network and uses bgp to advertise the address to the rest of the network.

1.0 Service Build

1.1 VM

Provision a Windows VM to be used as the anycast server, and add it to the domain.

1.2 Loopback Adapter Installl

To install the Microsoft Loopback Adapter by using the Hardware Wizard, follow these steps:

  1. Open Device Manager.
  2. Select the root of the tree which will be the hostname of the server.
  3. Select Action in the top menu.
  4. Select Add Legacy Hardware
  5. At the Welcome to Add New Hardware Wizard Select Next.
  6. Select, Install the Hardware that I manually select from a list.
  7. Select Next
  8. Scroll down on the list and select Network Adapters.
  9. Select Next
  10. On the Manufacter list, Select Microsoft
  11. Scroll to the bottom of the Model List
  12. Select Microsoft KM-TEST Loopback Adapter
  13. Select Next
  14. Select Next
  15. Select Finish

1.3 Anycast Provisioning

#########SET TO IP OF SITE##########
$site_ip = "1"
#########SET TO IP OF SITE##########


$primary_interface = (Get-NetAdapter | Where-Object { $PSItem.InterfaceDescription -match "vmxnet3" }).Name
(Get-NetAdapter | Where-Object { $PSItem.InterfaceDescription -match "KM-TEST" }) | Rename-NetAdapter -NewName "Loopback"
if ($ENV:COMPUTERNAME -match "E..-NS-001v") {
    $loopback_ipv4 = '10.255.255.253'
}
if ($ENV:COMPUTERNAME -match "E..-NS-002v") {
    $loopback_ipv4 = '10.255.255.254'
}
$loopback_ipv4_length = '32'
$loopback_name = 'Loopback'

$interface_loopback = Get-NetAdapter -Name $loopback_name
$interface_main = Get-NetAdapter -Name $primary_interface
Set-NetIPInterface -InterfaceIndex $interface_loopback.ifIndex -InterfaceMetric "254" -WeakHostReceive Enabled -WeakHostSend Enabled -DHCP Disabled
Set-NetIPInterface -InterfaceIndex $interface_main.ifIndex -WeakHostReceive Enabled -WeakHostSend Enabled
Set-NetIPAddress -InterfaceIndex $interface_loopback.ifIndex -SkipAsSource $True
Get-NetAdapter $loopback_name | Set-DNSClient -RegisterThisConnectionsAddress $False
New-NetIPAddress -InterfaceAlias $loopback_name -IPAddress $loopback_ipv4 -PrefixLength $loopback_ipv4_length -AddressFamily ipv4
Disable-NetAdapterBinding -Name $loopback_name -ComponentID ms_msclient
Disable-NetAdapterBinding -Name $loopback_name -ComponentID ms_pacer
Disable-NetAdapterBinding -Name $loopback_name -ComponentID ms_server
Disable-NetAdapterBinding -Name $loopback_name -ComponentID ms_lltdio
Disable-NetAdapterBinding -Name $loopback_name -ComponentID ms_rspndr

$localIP = ((Get-NetIPAddress -InterfaceAlias $primary_interface -AddressFamily IPv4).IPAddress)

Install-WindowsFeature Routing -IncludeManagementTools
Import-Module RemoteAccess
Install-RemoteAccess -VpnType RoutingOnly
Add-BgpRouter -BgpIdentifier $localIP -LocalASN 64902
switch ($site_ip) {
    "10" {
        Add-BgpPeer -Name "DC-SVC-001s" -LocalIPAddress $localIP -PeerIPAddress "172.30.$site_ip.0" -PeerASN 64902 -LocalASN 64902  
    }
    "11" {
        Add-BgpPeer -Name "DC-SVC-001s" -LocalIPAddress $localIP -PeerIPAddress "172.30.$site_ip.0" -PeerASN 64902 -LocalASN 64902
    }
    Default {
        Add-BgpPeer -Name "DC-COR-001" -LocalIPAddress $localIP -PeerIPAddress "172.30.$site_ip.0" -PeerASN 64902 -LocalASN 64902
        Add-BgpPeer -Name "DC-COR-002" -LocalIPAddress $localIP -PeerIPAddress "172.30.$site_ip.1" -PeerASN 64902 -LocalASN 64902
    }
}

if ($ENV:COMPUTERNAME -match "E..-NS-001v") {
    Add-BgpCustomRoute -Network "10.255.255.253/32"
}
if ($ENV:COMPUTERNAME -match "E..-NS-002v") {
    Add-BgpCustomRoute -Network "10.255.255.254/32"
}