Enabling Plan Enforcement or Changing Default Plan Speeds

How do I enable plan enforcement (shaping with FQ-Codel shapers) and change default plan speeds in my Preseem?

This article describes how to enable plan enforcement in your Preseem device. The difficulty level for this task is intermediate. If you are not comfortable with Unix shell environments, feel free to contact Preseem for help and we will be happy to assist. You need to log in to the Preseem device via SSH or console to proceed. Changing the configuration file and restarting the service requires sudo / root access.

Check that the Preseem service is running

Run this command at a shell terminal prompt:

preseemctl system show

The Running and Healthy columns should contain Yes for each service, except for the Bypass services that only initialize the system when it starts. It is normal for Telegraf to have N/A in the healthy column. Here is a typical good output:

[root@preseem ~]# preseemctl system show
SERVICE | START ON BOOT | RUNNING | HEALTHY | UPTIME
+--------------------+---------------+---------+---------+-----------------+
BypassBoot | Yes | N/A | N/A | N/A
BypassShutdown | Yes | N/A | N/A | N/A
HealthManager | Yes | Yes | Yes | 25d:14h:43m:31s
NetdevManager | Yes | Yes | Yes | 25d:14h:43m:25s
NodeManager | Yes | Yes | Yes | 25d:14h:43m:31s
Telegraf | Yes | Yes | N/A | 25d:14h:43m:31s
SystemStatsManager | Yes | Yes | Yes | 25d:14h:43m:31s

Set the Enforcement Parameters

At this time, Preseem constrains bandwidth at two levels:

  • Interface level: when Preseem intersects a link, it is possible to constrain the overall speed of that link arbitrarily. Some customers limit it to the physical capacity, and some set a lower target limit to reflect natural limitations in their network and proactively manage them.
  • Subscriber level: once Preseem is integrated with your billing system and network, it will periodically (by default every 5 minutes) retrieve all subscriber information to be aware of any change to plans, plan speeds and network topology. This allows Preseem to automatically adapt the plan enforcement to new values.

IMPORTANT NOTE: the instructions provided are subject to change, so refer to this page often.

In the Preseem configuration text file (/etc/preseem/config.yaml), under each interface of interest, we have a qosTransmitPolicy section defined. Inside that section, you can find these parameters:

  • name: when set to "count", no enforcement shaping is applied, and when set to "subscriber", enforcement shaping is applied.  When set to "two-level", enforcement shaping is applied both for subscribers and Access Points (configure each access point in the online application; the default speed for the AP is that of the link itself).
  • rate: maximum rate for the link itself, expressed in kbps; this parameter may be deprecated in the future
  • defaultDownloadRate / defaultUploadRate / defaultLevel2DownloadRate / defaultLevel2UploadRate: maximum Download/Upload rates, in kbps, for a subscriber with no speed defined.  The former two apply in a "subscriber" context, the latter two apply in a "two-level" context.

As sudo / root user, change the parameters of interest, pay particular attention to the spacing, do not use tabs, and read about the YAML format if you are interested (https://en.wikipedia.org/wiki/YAML). Then save the file. Here is an example section with 970Mbps link speed and 100Mbps (downstream) x 60Mbps (upstream) default subscriber configuration.

links:
enp4s0:
ignore: true
enp5s0:
ignore: true
enp6s0:
internetFacing: true
qosTransmitPolicy:
name: two-level
rate: 9700000
subscriberConfig:
defaultDownloadRate: 100000
defaultUploadRate: 60000
twoLevelConfig:
defaultLevel2DownloadRate: 100000
defaultLevel2UploadRate: 60000
enp7s0:
internetFacing: false
qosTransmitPolicy:
name: two-level
rate: 9700000
subscriberConfig:
defaultDownloadRate: 100000
defaultUploadRate: 60000
twoLevelConfig:
defaultLevel2DownloadRate: 100000
defaultLevel2UploadRate: 60000

The qosTransmitPolicy line has 4 spaces at the beginning. The name, rate and subscriberConfig/twoLevelConfig lines have 6, and the default lines have 8. Veering from this requirement will prevent the configuration from being loaded.

Mini Quiz Questions:

  1. Is this configuration enforcing shaping or not?
  2. Which interface is configured to receive packets from the internet?

Apply the Changes

Once changes are made to accommodate your needs, restart the Network Device Manager service (requires sudo / root permission):

sudo systemctl restart preseem-netdev-manager

 

To check that the reload was successful, run:

systemctl status preseem-netdev-manager
[root@preseem ~]# systemctl status preseem-netdev-manager
● preseem-netdev-manager.service - Preseem NetdevManager service
Loaded: loaded (/usr/lib/systemd/system/preseem-netdev-manager.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2019-05-27 02:38:17 UTC; 3 weeks 4 days ago
Docs: https://www.preseem.com
Main PID: 2035 (preseem-netdev-)
Tasks: 14 (limit: 4915)
Memory: 54.9M
CGroup: /system.slice/preseem-netdev-manager.service
└─2035 /usr/sbin/preseem-netdev-manager

May 27 02:38:18 preseem preseem-netdev-manager[2035]: 2019/05/27 02:38:18 Populating IP network <removed> for address space default
May 27 02:38:18 preseem preseem-netdev-manager[2035]: 2019/05/27 02:38:18 Received NM entity loaded
May 27 02:38:18 preseem preseem-netdev-manager[2035]: 2019/05/27 02:38:18 Received NM reference entity loaded
May 27 02:38:19 preseem preseem-netdev-manager[2035]: 2019/05/27 02:38:19 Publishing configuration

To make sure that all services are up, run:

preseemctl system show