Backup Proxy Traffic Throttling Rules

PowerShell script exchange

Backup Proxy Traffic Throttling Rules

Veeam Logoby Sergihire » Wed Dec 09, 2015 3:53 pm

Hi Veeam Community,

I would like to configure Network Traffic Throttling Rules using Powershell, but I can't find a way to do that.
In Get-VBRViProxy command I couldn't find a parameters to set it up.

So, could you please help me?
Sergihire
Lurker
 
Posts: 1
Liked: never
Joined: Wed Dec 09, 2015 3:43 pm
Full Name: Sergii Marchenko

Re: Backup Proxy Traffic Throttling Rules

Veeam Logoby v.Eremin » Wed Dec 09, 2015 4:17 pm

Unfortunately, throttling rules are not configurable via PowerShell. Thanks.
v.Eremin
Veeam Software
 
Posts: 13708
Liked: 1024 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Backup Proxy Traffic Throttling Rules

Veeam Logoby ryan.odwyer » Sat Feb 13, 2016 9:19 am

Hi,

Is this on the roadmap?

I'm keen to use it in this scenario:

Users login to RDS servers on weekends and out of normal business hours during the week.

With Backup Copy and Cloud Connect copy jobs the bandwidth to push offsite is impacting RDS users.

When there are no users logged in and active(can script a test through powershell already) then a script would configure the traffic shaping rules to not apply and run full speed to offsite locations.

When there are active users in RDS enable the traffic throttling rules with Veeam powershell commands so that their RDS is responsive.

If you haven't guessed the link is only a few Mb so every thing competes for bandwidth.

Thanks,
Ryan
ryan.odwyer
Service Provider
 
Posts: 3
Liked: never
Joined: Mon May 07, 2012 12:39 am
Full Name: Ryan O'Dwyer

Re: Backup Proxy Traffic Throttling Rules

Veeam Logoby tsightler » Sat Feb 13, 2016 11:08 pm

I know this is outside of "Veeam box", but does your network equipment have the ability to set any QoS rules or policies? If so, it might be a better and far simpler option to just tag Veeam traffic on the WAN as "bulk" and then it will use the bandwidth available but everything else will always get priority.
tsightler
Veeam Software
 
Posts: 4872
Liked: 1819 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Re: Backup Proxy Traffic Throttling Rules

Veeam Logoby tomkai » Tue Jun 21, 2016 6:45 am

Hello,

i would also rise this feature request to set Network traffic rules with power Shell. We have to set this rule for about 50 remote Locations and this would darmatically Speed up this process.
tomkai
Lurker
 
Posts: 1
Liked: never
Joined: Mon Nov 12, 2012 3:55 pm
Full Name: Thomas Kaiser

Configure network throttling

Veeam Logoby odruard » Fri Jan 27, 2017 3:30 pm

Hello

I'm looking for a way to configure network throttling rules using Powershell.
We'll need to configure tens of rules on several Veeam B&R servers, and it would be kind to script it.

I found this topic which says that throttling rules are not configurable via PowerShell.
powershell-f26/backup-proxy-traffic-throttling-rules-t31732.html
However, according to the date, the answer was for Veeam B&R v8.

Did the v9 or the v9.5 came with new cmdlets allowing to configure network throttling rules ?

Thanks for your help.
Olivier.
odruard
Enthusiast
 
Posts: 34
Liked: 2 times
Joined: Tue Jan 25, 2011 2:12 pm
Full Name: Olivier Druard

Re: Backup Proxy Traffic Throttling Rules

Veeam Logoby v.Eremin » Tue Jan 31, 2017 11:47 am

Unfortunately, those settings cannot be configured via PowerShell. Thanks.
v.Eremin
Veeam Software
 
Posts: 13708
Liked: 1024 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Backup Proxy Traffic Throttling Rules

Veeam Logoby toasty » Tue Feb 07, 2017 10:46 pm

Is there any way to at least see what the throttle settings are via PowerShell? I don't need to change them (though that would be nice), but I would like to be able to setup a notification if our throttle settings are changed.
toasty
Lurker
 
Posts: 1
Liked: never
Joined: Tue Feb 07, 2017 9:30 pm
Full Name: Randy Lucas

Re: Backup Proxy Traffic Throttling Rules

Veeam Logoby tsightler » Wed Feb 08, 2017 6:26 pm 2 people like this post

There is no cmdlet to do this, however, it is possible to get creative by calling the underlying .NET methods. For example, getting the existing rules is very easy:

Code: Select all
$ttr = [Veeam.Backup.Core.SBackupOptions]::GetTrafficThrottlingRules().GetRules()


After running this command $ttr will hold an array with all of the rules. But you can do more, the GetTrafficThrottlingRules() method returns a nice object that can be easily manipulated to add/remove rules, here's an example of adding a new rule to the existing ruleset (it should work even if the ruleset is empty):

Code: Select all
# Get existing traffic throttling rules
$ttr = [Veeam.Backup.Core.SBackupOptions]::GetTrafficThrottlingRules()

# Add a new default traffic throttling rule to existing rules
$nttr = $ttr.AddRule()

# Set options for the new traffic throttling rule
$nttr.SpeedLimit = 10
$nttr.SpeedUnit = "Mbps" # Options are Mbps, KBps, MBps
$nttr.AlwaysEnabled = $true
$nttr.EncryptionEnabled = $false
$nttr.ThrottlingEnabled = $true
$nttr.SetScheduleInfo($nttr.GetScheduleInfo())
$nttr.FirstDiapason.FirstIp = "192.168.10.1"
$nttr.FirstDiapason.LastIp = "192.168.10.255"
$nttr.SecondDiapason.FirstIp = "192.168.20.1"
$nttr.SecondDiapason.LastIp = "192.168.20.255"

# Save new traffic throttiling rules
[Veeam.Backup.Core.SBackupOptions]::SaveTrafficThrottlingRules($ttr)


Deleting a rule is pretty easy as well:

Code: Select all
# Get existing traffic throttling rules
$ttr = [Veeam.Backup.Core.SBackupOptions]::GetTrafficThrottlingRules()

# Find all rules where the source match would include this IP address
$ttr_to_delete = $ttr.GetRulesByFirstDiapason("192.168.0.1")

# Delete these rules
if ($ttr_to_delete) {
    foreach ($rule in $ttr_to_delete) {
        $ttr.RemoveRule($rule)
    }
}

# Save new traffic throttling rules
[Veeam.Backup.Core.SBackupOptions]::SaveTrafficThrottlingRules($ttr)


You can also search by target IP (GetRulesBySecondDiapason) and there are some other search criteria as well, but you can also just pipe and filter on any property of the rules. Of course, all of these methods are "unsupported" since we're calling directly into the backend code, but I tried to use the functions in the same ways the GUI would, and it seems to work OK in quick testing. Obviously it would be better to have supported cmdlets to do this, but sometimes you gotta do what you gotta do and this has come up often enough for me that I have these hacks lying around.
tsightler
Veeam Software
 
Posts: 4872
Liked: 1819 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Re: Backup Proxy Traffic Throttling Rules

Veeam Logoby odruard » Fri Mar 10, 2017 1:46 pm

Interesting.
I'll try your solution.
Thanks for the trick.
odruard
Enthusiast
 
Posts: 34
Liked: 2 times
Joined: Tue Jan 25, 2011 2:12 pm
Full Name: Olivier Druard

Re: Backup Proxy Traffic Throttling Rules

Veeam Logoby murdocmk » Thu Mar 30, 2017 7:00 am

We had a situation where we needed to generate throttling rules for 3 schedules (with different throttling rates) for 80-100 different IP ranges (remote sites). Because the sites were in different time zones we found that adding the throttling rules manually was time-consuming and error prone.

This is the script we used, which we wrapped in a powershell loop to generate the rules. We created a file that defined a site name, 2nd octet of the IP, GMT offset and bandwidth (in KBps) settings for 3 different schedules: weekday, evenings and weekends. Example file format:

Site1 50 -6 128 256 384
Site2 51 8 128 256 256

Then with a loop like this we can iterate the various entries in the file and run the script:
Code: Select all
$sites = Import-CSV -Delimiter "`t" -Header sitename,ip,offset,bw1,bw2,bw3 -Path .\sites.txt
foreach ($site in $sites) {
  Adding rules for site: " + $site.sitename;
  .\add-throttle.ps1 -SiteIP $site.ip -Offset $site.offset -DayBW $site.bw1 -EveningBW $site.bw2 -WeekendBW $site.bw3
}


And then, the script, which is largely based on tshightler's code example (thank you), but adds the 7AM - 5PM weekday, evening and weekend schedules (adjusted to be in local time for the site):

Code: Select all
param (
[Parameter(Mandatory=$true)]
[String] $SiteIP,
[Parameter(Mandatory=$true)]
[string] $Offset,
[Parameter(Mandatory=$true)]
[string] $DayBW,
[Parameter(Mandatory=$true)]
[string] $EveningBW,
[Parameter(Mandatory=$true)]
[string] $WeekendBW
)

Add-PSSnapin VeeamPSSnapin

Connect-VBRServer -Server MYSERVER.MYDOMAIN.COM

$gmt_weekdays = 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
$gmt_evenings = 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
$gmt_weekends = 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

function weekdays($offset) {
    # Slide the array by the GMT offset
    $newarr = @()
    if($offset -gt 0) {
        $newarr = $gmt_weekdays[$offset..(($gmt_weekdays.count) - 1)] + $gmt_weekdays[0..($offset - 1)]
    }
    Elseif($offset -lt 0) {
        $newarr = $gmt_weekdays[$offset..-1] + $gmt_weekdays[0..($gmt_weekdays.count - 1 + $offset)]
    }
    Else {
        $newarr = $gmt_weekdays
    }
    $return = "<scheduler><Sunday>" + ($newarr[0..23] -join ",") + "</Sunday>" + "<Monday>" + ($newarr[24..47] -join ",") + "</Monday>" +
        "<Tuesday>" + ($newarr[48..71] -join ",") + "</Tuesday>" + "<Wednesday>" + ($newarr[72..95] -join ",") + "</Wednesday>" +
        "<Thursday>" + ($newarr[96..119] -join ",") + "</Thursday>" + "<Friday>" + ($newarr[120..143] -join ",") + "</Friday>" +
        "<Saturday>" + ($newarr[144..167] -join ",") + "</Saturday></scheduler>"

    return $return
}

function evenings($offset) {
    # Slide the array by the GMT offset
    $newarr = @()
    if($offset -gt 0) {
        $newarr = $gmt_evenings[$offset..(($gmt_evenings.count) - 1)] + $gmt_evenings[0..($offset - 1)]
    }
    Elseif($offset -lt 0) {
        $newarr = $gmt_evenings[$offset..-1] + $gmt_evenings[0..($gmt_evenings.count - 1 + $offset)]
    }
    Else {
        $newarr = $gmt_evenings
    }
    $return = "<scheduler><Sunday>" + ($newarr[0..23] -join ",") + "</Sunday>" + "<Monday>" + ($newarr[24..47] -join ",") + "</Monday>" +
        "<Tuesday>" + ($newarr[48..71] -join ",") + "</Tuesday>" + "<Wednesday>" + ($newarr[72..95] -join ",") + "</Wednesday>" +
        "<Thursday>" + ($newarr[96..119] -join ",") + "</Thursday>" + "<Friday>" + ($newarr[120..143] -join ",") + "</Friday>" +
        "<Saturday>" + ($newarr[144..167] -join ",") + "</Saturday></scheduler>"

    return $return
}

function weekends($offset) {
    # Slide the array by the GMT offset
    $newarr = @()
    if($offset -gt 0) {
        $newarr = $gmt_weekends[$offset..(($gmt_weekends.count) - 1)] + $gmt_weekends[0..($offset - 1)]
    }
    Elseif($offset -lt 0) {
        $newarr = $gmt_weekends[$offset..-1] + $gmt_weekends[0..($gmt_weekends.count - 1 + $offset)]
    }
    Else {
        $newarr = $gmt_weekends
    }
    $return = "<scheduler><Sunday>" + ($newarr[0..23] -join ",") + "</Sunday>" + "<Monday>" + ($newarr[24..47] -join ",") + "</Monday>" +
        "<Tuesday>" + ($newarr[48..71] -join ",") + "</Tuesday>" + "<Wednesday>" + ($newarr[72..95] -join ",") + "</Wednesday>" +
        "<Thursday>" + ($newarr[96..119] -join ",") + "</Thursday>" + "<Friday>" + ($newarr[120..143] -join ",") + "</Friday>" +
        "<Saturday>" + ($newarr[144..167] -join ",") + "</Saturday></scheduler>"

    return $return
}

$ttr = [Veeam.Backup.Core.SBackupOptions]::GetTrafficThrottlingRules()
#$rules = $ttr.GetRules()

# We'll be creating 3 rules for 3 different schedules
$nttr1 = $ttr.AddRule()
$nttr2 = $ttr.AddRule()
$nttr3 = $ttr.AddRule()

# Set options for the new traffic throttling rule
$nttr1.SpeedLimit = $DayBW;
$nttr1.SpeedUnit = "KBps" # Options are Mbps, KBps, MBps
$nttr1.AlwaysEnabled = $false
$nttr1.EncryptionEnabled = $false
$nttr1.ThrottlingEnabled = $true
$nttr1.ScheduleInfoStr = weekdays($Offset)
$nttr1.FirstDiapason.FirstIp = "10." + $SiteIP + ".0.0"
$nttr1.FirstDiapason.LastIp = "10." + $SiteIP + ".255.255"
$nttr1.SecondDiapason.FirstIp = "10.0.0.0"
$nttr1.SecondDiapason.LastIp = "10.255.255.255"

$nttr2.SpeedLimit = $EveningBW
$nttr2.SpeedUnit = "KBps" # Options are Mbps, KBps, MBps
$nttr2.AlwaysEnabled = $false
$nttr2.EncryptionEnabled = $false
$nttr2.ThrottlingEnabled = $true
$nttr2.ScheduleInfoStr = evenings($Offset)
$nttr2.FirstDiapason.FirstIp = "10." + $SiteIP + ".0.0"
$nttr2.FirstDiapason.LastIp = "10." + $SiteIP + ".255.255"
$nttr2.SecondDiapason.FirstIp = "10.0.0.0"
$nttr2.SecondDiapason.LastIp = "10.255.255.255"

$nttr3.SpeedLimit = $WeekendBW
$nttr3.SpeedUnit = "KBps" # Options are Mbps, KBps, MBps
$nttr3.AlwaysEnabled = $false
$nttr3.EncryptionEnabled = $false
$nttr3.ThrottlingEnabled = $true
$nttr3.ScheduleInfoStr = weekends($Offset)
$nttr3.FirstDiapason.FirstIp = "10." + $SiteIP + ".0.0"
$nttr3.FirstDiapason.LastIp = "10." + $SiteIP + ".255.255"
$nttr3.SecondDiapason.FirstIp = "10.0.0.0"
$nttr3.SecondDiapason.LastIp = "10.255.255.255"

# Save new traffic throttiling rules
[Veeam.Backup.Core.SBackupOptions]::SaveTrafficThrottlingRules($ttr)

Disconnect-VBRServer


I'm going to clean that up some and combine the weekday/evening/weekend functions into a single function, but I wanted to get it out here for others to use while I was thinking of it. Hope it helps someone get over a couple of hurdles that I had to, a little quicker.
murdocmk
Influencer
 
Posts: 24
Liked: 4 times
Joined: Mon Dec 14, 2009 5:10 pm

[MERGED] Powershell to enable network encryption

Veeam Logoby signal » Wed Sep 20, 2017 11:50 am

Hello

Is it possible to use powershell to add a network traffic rule and enable encryption on it?

In GUI one would do it like this: https://helpcenter.veeam.com/docs/backu ... tml?ver=95
I can't find any cmdlets that look like they might do that.
signal
Influencer
 
Posts: 21
Liked: never
Joined: Thu Oct 06, 2016 1:19 pm

Re: Backup Proxy Traffic Throttling Rules

Veeam Logoby v.Eremin » Wed Sep 20, 2017 12:36 pm

Try the workaround suggested above. Thanks.
v.Eremin
Veeam Software
 
Posts: 13708
Liked: 1024 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Backup Proxy Traffic Throttling Rules

Veeam Logoby signal » Wed Sep 20, 2017 1:08 pm

Thank you.

If I set first IP to 0.0.0.0 and second ip to 255.255.255.255, will that work to always have encryption enabled?
signal
Influencer
 
Posts: 21
Liked: never
Joined: Thu Oct 06, 2016 1:19 pm

Re: Backup Proxy Traffic Throttling Rules

Veeam Logoby v.Eremin » Wed Sep 20, 2017 1:12 pm

It should as long as you set $True value for a corresponding property (EncryptionEnabled = $True). By the way, if you're concerned with traffic leaving your environment and want to have it encrypted, be aware that we encrypt it automatically without any rules specified. Thanks.
v.Eremin
Veeam Software
 
Posts: 13708
Liked: 1024 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Next

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 1 guest