@@ -53,6 +53,12 @@ const (
5353 // Name of the loopback adapter needed to create Host NC apipa network
5454 hostNCLoopbackAdapterName = "LoopbackAdapterHostNCConnectivity"
5555
56+ // Name of the loopback adapter created by HNS for Host NC apipa network
57+ vEthernethostNCLoopbackAdapterName = "vEthernet (" + hostNCLoopbackAdapterName + ")"
58+
59+ // HNS rehydration issue requires this GW to be different than the loopback adapter ip, so we set it to .2
60+ defaultHnsGwIPAddress = "169.254.128.2"
61+ hnsLoopbackAdapterIPAddress = "169.254.128.1"
5662 // protocolTCP indicates the TCP protocol identifier in HCN
5763 protocolTCP = "6"
5864
@@ -298,7 +304,16 @@ func createHostNCApipaNetwork(
298304 }
299305
300306 // Create loopback adapter needed for this HNS network
301- if interfaceExists , _ := networkcontainers .InterfaceExists (hostNCLoopbackAdapterName ); ! interfaceExists {
307+ // We need to fitst check the existence of either "LoopbackAdapterHostNCConnectivity" or the vEthernet(LoopbackAdapterHostNCConnectivity) interfaces
308+ // If neither exists, we create the loopback adapter with the specified IP configuration.
309+ loopbackInterfaceExists , _ := networkcontainers .InterfaceExists (hostNCLoopbackAdapterName )
310+ vethernetLoopbackInterfaceExists , _ := networkcontainers .InterfaceExists (vEthernethostNCLoopbackAdapterName )
311+ if loopbackInterfaceExists {
312+ logger .Printf ("%s already created, skipping loopback interface creation" , hostNCLoopbackAdapterName )
313+ }
314+ if vethernetLoopbackInterfaceExists {
315+ logger .Printf ("%s already created, skipping loopback interface creation" , vEthernethostNCLoopbackAdapterName )
316+ } else if ! loopbackInterfaceExists && ! vethernetLoopbackInterfaceExists {
302317 ipconfig := cns.IPConfiguration {
303318 IPSubnet : cns.IPSubnet {
304319 IPAddress : localIPConfiguration .GatewayIPAddress ,
0 commit comments