Networks in StifleR

Default Basic Automation

StifleR automatically ‘learns’ about networks as the StifleR clients connect and report data to the server. The Server builds up a list of subnets with a default bandwidth limit set for each new one that is discovered. This information is stored in the StifleR Database file which is stored in the StifleR Server program data folder.

<add key="AutoAddLocations" value="1"/>

Manual Configuration

To manually “pre-configure” the StifleR Network Infrastructure you can load all of your network information into StifleR prior to deploying any clients. This can be achieved via automation through PowerShell/WMI scripting etc,.

Intelligent Automation of Location and Subnet Configuration

As mentioned above, in the default process, when a StifleR Client reports in from a subnet that does not exist, a new subnet is automatically created with default parameters applied.

There is however a much more intelligent method that uses PowerShell scripting to Generate and then Modify settings for these newly discovered locations. This feature is enabled within the StifleR.Service.exe.config file using the following parameters:

NOTE: The default setting for each of these options is disabled (0). Changing this to a value of “1” enables the feature. Location in this context is not referring to a StifleR Enterprise “Location” but rather discovered subnets.

NOTE: Sample Generate and Modify scripts can be found in the installation folder.

Generate New Location with PowerShell

  • Enable key

<add key="GenerateNewLocationsWithPowerShell" value="0"/>

  • Default path to the script for PS Generation of Sites

 <add key="PowerShellExtensionLocationCreateScriptPath" value="%PROGRAMDATA%\2Pint Software\StifleR\Server\GenerateLocation.ps1"/>

This first option is the most commonly used, as it allows you to set a default ‘template’ for a new subnet according to your preferences. For instance, the overall default Target Bandwidth for a new location may be 1024Mb/s, and you may want to set this to be higher (or lower).

PowerShell can generate any parameter for a new subnet and logic can be used to determine different settings depending on the incoming criteria (subnet, IP Address Range, Physical Location, Computer Name etc)

If the GenerateNewLocationsWithPowerShell setting is enabled, the script identified in the PowerShellExtensionLocationCreateScriptPath is executed as soon as a Client reports in a new subnet.

A basic script is as follows:

#always get the parameter data from the incoming request param($SessionData) 
 
#Next, instantiate the boot object, which is what you return back from this PowerShell Session 
$Location = new-object StifleR.Service.LocationItem.RootLocation  
 
This is an example of the SessionData typically returned to the PowerShell provider;  
#clientProtocol;1.4 
#transport;webSockets 
#connectionData;[{"Name":"StiflerHub"}] 
#connectionToken;AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAmrQEwkrggEKYwxYz++YeUQAAAAACAAAAAAAD
ZgAAwAAAABAAAADaO2indeSlBQTVPahgLP0kAAAAAASAAACgAAAAEAAAANtmbDDVdua96FFJYRerfPgoAAA AZ/X3q8t8kusojYoeYe2dcefqR2It+qUzbqalCJdvZEQcgUiHqZJopBQAAAC8eAnvyVfo/UMD00GEl3pI27tQTw== 
#networkId;192.168.138.0 
#GatewayMAC;B8-AE-ED-73-49-A6 ***USE THIS FOR A LOCATION GWMAC*** 
#OSBuild;Microsoft Windows NT 6.3.9600.0 
#version;1.6.1.5 
#ComputerName;NUC5 
#MachineGUID;28ac4bb5-97a9-4af2-8c45-f3668d3528ce 
#NotLeaderMaterial;False 
#ServerType;false 
#ServerAndClient;False 
#NetworkName;2PSTEST1.LOCAL 
#Status;Connected 
#Category;Authenticated 
#ConnectedTime;2018-02-18 10:47:22 
#CreatedTime;2015-05-20 14:42:24 
#Connectivity;IPv6NoTraffic, IPv4Internet 
#Description;2PSTEST1.LOCAL 
#DomainType;DomainAuthenticated 
#IsConnectedToInternet;True 
#Managed;True 
#Signature;010103000F0000F0A00000000F0000F0967D2CE4D1530F00FE1094B93C821F374E91CA96D62BE8
BEF8B7174D15FD45FD 
#MSGatewayMAC;04-DA-D2-84-AE-42 ***DONT USE THIS FOR A LOCATION GWMAC*** #Type;Ethernet 
#GeoPosition;11.9516:57.6967  

Once this data is returned you can then write some new data back to the new subnet

The new subnet must have a unique GUID

Once you have a way to identify the subnet you can edit configuration options. In the following snippet we set a Target Bandwidth of 4096 and setup the Delivery Optimization policy so that the clients in that subnet will only Peer within that subnet.

$Location.TargetBandwidth = 4096 #sets a default target bandwidth
$Location.DateAdded = [System.DateTime]::Now

$Location.Subnet = $SessionData["networkId"]

$Location.GatewayMAC = $SessionData["GatewayMAC"]

$Location.id = $locationId
#These Delivery Optimization parameters are set
#So that DO will only P2P within this subnet
#This should be changed for multiple subnet sites
#Do NOT set these DO params if you are managing DO via GPO/DHCP/SCCM etc
$Location.DOGroupID = $locationId
$Location.DODownloadMode = 2

Finally, we write the new subnet – job done!

return $Location

Modify New Location with Powershell

  • Enable Key:

<add key="ModifyNewLocationsWithPowerShell" value="0"/>
  • Default path to script for PS modification

<add key="PowerShellExtensionLocationModifyScriptPath" value="%PROGRAMDATA%\2Pint Software\StifleR\Server\ModifyLocation.ps1"/>

This option is similar to the Generate function but allows you to Modify a subnet once is has been created. This enables you to have your Generate script set some defaults for new subnets and then let the Modify script change some further parameters depending on other criteria.

If the ModifyNewLocationsWithPowerShell setting is enabled, the script identified in PowerShellExtensionLocationModifyScriptPath is executed as soon as a new subnet has been created

A basic script is as follows:

#always get the param data from request
param($SessionData)

#This section sets the variables from the SessionData
$LocationId = $SessionData["Id"]
$LocationSubnet = $SessionData["Subnet"]
$LocationGatewayMAC = $SessionData["GatewayMAC"]
$LocationName = $SessionData["LocationName"]

#Now get and modify the resource
$LocationToModify =
[wmi]"\root\StifleR:Subnets.subnetID='$LocationSubnet,$LocationGatewayMAC'"

Once we have the new location we can do some lookups, for example examine the IPAddress and set a new target bandwidth based on the Address Range – being in PowerShell land the sky is the limit! Here’s some pseudo code to give you an idea:

If subnet starts with 192 – then target bandwidth should be 10Mb

If subnet starts with 10 – then target bandwidth should be 2Mb

#Finally update the location with the new values
swmi -path $LocationToModify.path -Arguments
@{TargetBandwidth=$NewBandwidth;Description="Modified by PowerShell"}

Locations

Once subnets are known to StifleR you can then group local subnets together in Parent/Child relationships to form Locations. You can then use these Locations to control Bandwidth usage for the multiple subnets or VLANs as a single administrative unit. As part of your StifleR infrastructure planning you should gather as much information as you can regarding your geographic locations and associated WAN/LAN configurations, speed etc and then group your subnets into StifleR Locations as required. Please feel free to contact us for recommendations in this regard. This process can be automated as above.

Last updated