private static NetworkAdapterDetails GetManagementNetworkDetailsInternal(int serviceId) { // load service settings StringDictionary settings = ServerController.GetServiceSettings(serviceId); // create NIC object NetworkAdapterDetails nic = new NetworkAdapterDetails(); nic.NetworkId = settings["ManagementNetworkId"]; nic.IsDHCP = (String.Compare(settings["ManagementNicConfig"], "DHCP", true) == 0); if (!nic.IsDHCP) { nic.PreferredNameServer = settings["ManagementPreferredNameServer"]; nic.AlternateNameServer = settings["ManagementAlternateNameServer"]; } return nic; }
private static NetworkAdapterDetails GetPrivateNetworkDetailsInternal(int serviceId) { // load service settings StringDictionary settings = ServerController.GetServiceSettings(serviceId); // create NIC object NetworkAdapterDetails nic = new NetworkAdapterDetails(); string networkFormat = settings["PrivateNetworkFormat"]; if (String.IsNullOrEmpty(networkFormat)) { // custom format nic.NetworkFormat = settings["PrivateIPAddress"]; var v6 = IPAddress.Parse(nic.NetworkFormat).V6; nic.SubnetMask = GetPrivateNetworkSubnetMask(settings["PrivateSubnetMask"], v6); } else { // standard format string[] formatPair = settings["PrivateNetworkFormat"].Split('/'); nic.NetworkFormat = formatPair[0]; var v6 = IPAddress.Parse(nic.NetworkFormat).V6; nic.SubnetMask = GetPrivateNetworkSubnetMask(formatPair[1], v6); } nic.SubnetMaskCidr = GetSubnetMaskCidr(nic.SubnetMask); nic.DefaultGateway = settings["PrivateDefaultGateway"]; nic.PreferredNameServer = settings["PrivatePreferredNameServer"]; nic.AlternateNameServer = settings["PrivateAlternateNameServer"]; return nic; }
private static NetworkAdapterDetails GetExternalNetworkDetailsInternal(int serviceId) { // load service settings StringDictionary settings = ServerController.GetServiceSettings(serviceId); // create NIC object NetworkAdapterDetails nic = new NetworkAdapterDetails(); nic.NetworkId = settings["ExternalNetworkId"]; nic.PreferredNameServer = settings["ExternalPreferredNameServer"]; nic.AlternateNameServer = settings["ExternalAlternateNameServer"]; return nic; }