Block category of sites (gaming) at certain times on a Ubiquity USG

I’m writing this as a reminder to myself, but it might also help others since it took me quite some time to figure out all the bits and pieces. It uses DPI (Deep Packet Inspection) to classify network traffic and therefor doesn’t work for everything. For example, it didn’t block Minecraft.

How to

Open a terminal and ssh to controller with username and password that you find under USG Settings -> Site

ssh <username>@

Enter configuration mode

<username>@ubnt:~$ configure

Save the configuration file

<username>@ubnt:~$ save file

Open another terminal and SFTP to controller

sftp <username>@

Download file

sftp > get /config file

Open file in text editor which can save with unix line endings, for example Notepad++.


name DPI {
    default-action accept
    rule 10 {
        action drop
        application {
            category Games
        time {
            starttime 09:00:00
            stoptime 14:59:59
            weekdays Mon,Tue,Wed,Thu,Fri

(mine is in between “name AUTHORIZED_GUESTS” and “name GUEST_IN”)

Upload the configuration file with SFTP

sftp> put file

It gets uploaded to /home/<username>/

In the first terminal, where you are in configuration mode, load your new file

<username>@ubnt:~$ load /home/<username>/file

Try out the settings by committing the change. Committing means that your config is applied until next reboot.

<username>@ubnt:~$ commit

If it works as intended, save the changes.

<username>@ubnt:~$ save


To view category for a site

<username>@ubnt:~$ sudo /usr/sbin/ubnt-dpi-util search-app amazon

I followed this guide first to create the rule for blocking according to DPI, then downloaded the config, added the time specifications and then uploaded and applied the modified config.

Here is where I found someone adding times

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s