Skip to content
forked from nitram509/ntgrrc

ntgrrc (Netgear Remote Control) a command line (CLI) tool to manage Netgear GS3xx switch series.

License

Notifications You must be signed in to change notification settings

gherlein/ntgrrc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ntgrrc

ntgrrc (Netgear Remote Control) is a command line (CLI) tool to manage Netgear managed plus switches 300 series.

Project Origins and Evolution

This project is based on the original ntgrrc project created by nitram509. We've refactored the codebase to create a reusable Go library and improved CLI tools:

  • go-netgear - A Go library for programmatic control of Netgear switches
  • netgearcli - A modern CLI tool with enhanced features and better UX
  • ntgrrc (this project) - Maintains compatibility with the original ntgrrc interface

This version of ntgrrc provides the same functionality as the original program but is now built on the go-netgear library foundation.

Since Netgear does not offer a REST API, these tools use web scraping techniques to manage configuration and show status of the switch.

Supported firmware versions

A green tick means it was successfully tested.

Firmware GS305EP(P) GS308EP GS308EPP GS316EP(P)
V1.0.0.8 (likely) -
v1.0.0.10 (likely) -
V1.0.1.1 (likely) (likely) -
V1.0.3.4 - - -
V1.0.3.7 - - -
V1.0.4.4 - - -

Legend:
✅ = successfully tested
- = not available \

Architecture

This project has been restructured to use the go-netgear library as its foundation. The CLI tool is now a thin wrapper around the library functionality.

Project Structure

ntgrrc/
├── cmd/ntgrrc/          # CLI application (thin wrapper)
├── bin/                 # Built binaries
├── docs/                # Documentation
└── scripts/             # Build and utility scripts

Library Usage

For programmatic access to Netgear switches, use the go-netgear library:

import netgear "github.com/gherlein/go-netgear"

// The library provides command structures that can be used programmatically
var loginCmd netgear.LoginCommand
var poeCmd netgear.PoeCommand
// ... etc

CLI Compatibility

This version maintains full compatibility with the original ntgrrc command-line interface while being built on the modern go-netgear library foundation.

Download & Installation

This tool is built with the Go programming language. Pre-built binaries for Windows, Linux, and macOS are available for download.

Alternatively, you can build from source:

git clone https://github.com/gherlein/ntgrrc.git
cd ntgrrc
make build
# Binary will be created in bin/ntgrrc

Just download the fitting binary for your operating system and put it somewhere in your PATH.

usage

help

ntgrrc --help-all
Usage: ntgrrc <command> [flags]

Flags:
  -h, --help                  Show context-sensitive help.
      --help-all              advanced/full help
  -v, --verbose               verbose log messages
  -q, --quiet                 no log messages
  -f, --output-format="md"    what output format to use [md, json]
  -d, --token-dir=""          directory to store login tokens

Commands:
  version [flags]
    show version

  login --address=STRING [flags]
    create a session for further commands (requires admin console password)

  poe status --address=STRING
    show current PoE status for all ports

  poe settings --address=STRING
    show current PoE settings for all ports

  poe set --address=STRING --port=PORT,... [flags]
    set new PoE settings per each PORT number

  poe cycle --address=STRING --port=PORT,...
    power cycle one or more PoE ports

  port settings --address=STRING
    show switch port settings

  port set --address=STRING --port=PORT,... [flags]
    set properties for a port number

  debug-report --address=STRING [flags]
    show information from the switch communication, useful for supporting
    development and bug fixes

Run "ntgrrc <command> --help" for more information on a command.

login

For better performance, login first. The login action will store a token to a file called $TEMP/.config/ntgrrc/token-12345678 and thus subsequent actions will use it and are authenticated.

Note: if you have multiple Netgear switches, ntgrrc supports multiple parallel tokens/sessions, because the token file's name is derived from the provided --address device name.

ntgrrc login --address gs305ep --password secret

show port settings

Once a session is created, you can fetch port settings.

Settings

The switch's port settings are printed in Markdown table format. This means, separated by | (pipe) and optional suffixes with blanks.

Use the --output-format=json flag, to get JSON output instead.

ntgrrc port settings --address gs305ep

| Port ID | Port Name | Speed | Ingress Limit | Egress Limit | Flow Control | Port Status | Link Speed |
|---------|-----------|-------|---------------|--------------|--------------|-------------|------------|
| 1       | XYZ       | Auto  | No Limit      | No Limit     | Off          | AVAILABLE   | No Speed   |
| 2       |           | Auto  | No Limit      | No Limit     | On           | CONNECTED   | 100M Half  |
| 3       |           | Auto  | No Limit      | No Limit     | On           | DISABLED    | No Speed   |
| 4       |           | Auto  | 1 Mbit/s      | No Limit     | On           | AVAILABLE   | No Speed   |

set port settings

ntgrrc is able to set various parameters on switch port(s).

Port Name

To change the port name (within the switch's limit of 1-16 characters), pass the name using -n and the desired name in quotes. More than one port number can be provided.

Use the --output-format=json flag, to get JSON output instead.

ntgrrc port set -p 1 -n 'port #1' --address gs305ep

| Port ID | Port Name | Speed | Ingress Limit | Egress Limit | Flow Control |
|---------|-----------|-------|---------------|--------------|--------------|
| 1       | port #1   | Auto  | No Limit      | No Limit     | Off          |

To clear the set name, supply an empty, but quoted string. More than one port number can be provided.

ntgrrc port set -p 1 -n '' --address gs305ep

| Port ID | Port Name | Speed | Ingress Limit | Egress Limit | Flow Control |
|---------|-----------|-------|---------------|--------------|--------------|
| 1       |           | Auto  | No Limit      | No Limit     | Off          |

Speed

To change the port speed, use -s and the desired speed ('100M full', '100M half', '10M full', '10M half', 'Auto', 'Disable') in quotes. More than one port number can be provided.

Use the --output-format=json flag, to get JSON output instead.

ntgrrc port set -p 1 -s '100M half' --address gs305ep

| Port ID | Port Name | Speed     | Ingress Limit | Egress Limit | Flow Control |
|---------|-----------|-----------|---------------|--------------|--------------|
| 1       |           | 100M half | No Limit      | No Limit     | Off          |

In Rate Limit

To change the in rate limit, use -i and the desired rate limit ('1 Mbit/s', '128 Mbit/s', '16 Mbit/s', '2 Mbit/s', '256 Mbit/s', '32 Mbit/s', '4 Mbit/s', '512 Kbit/s', '512 Mbit/s', '64 Mbit/s', '8 Mbit/s', 'No Limit') in quotes. More than one port number can be provided.

Use the --output-format=json flag, to get JSON output instead.

ntgrrc port set -p 1 -i '16 Mbit/s' --address gs305ep

| Port ID | Port Name | Speed | Ingress Limit | Egress Limit | Flow Control |
|---------|-----------|-------|---------------|--------------|--------------|
| 1       |           | Auto  | 16 Mbit/s     | No Limit     | Off          |

Out Rate Limit

To change the out rate limit, use -o and the desired rate limit ('1 Mbit/s', '128 Mbit/s', '16 Mbit/s', '2 Mbit/s', '256 Mbit/s', '32 Mbit/s', '4 Mbit/s', '512 Kbit/s', '512 Mbit/s', '64 Mbit/s', '8 Mbit/s', 'No Limit') in quotes. More than one port number can be provided.

Use the --output-format=json flag, to get JSON output instead.

ntgrrc port set -p 1 -o '16 Mbit/s' --address gs305ep

| Port ID | Port Name | Speed | Ingress Limit | Egress Limit | Flow Control |
|---------|-----------|-------|---------------|--------------|--------------|
| 1       |           | Auto  | 16 Mbit/s     | 16 Mbit/s    | Off          |

Flow Control

To change the flow control setting for a port, use --flow-control and the desired setting ('On', 'Off') in quotes. More than one port number can be provided.

Use the --output-format=json flag, to get JSON output instead.

ntgrrc port set -p 1 --flow-control 'On' --address gs305epp

ntgrrc port set -p 1 --flow-control 'On' --address test
| Port ID | Port Name | Speed | Ingress Limit | Egress Limit | Flow Control |
|---------|-----------|-------|---------------|--------------|--------------|
| 1       |           | Auto  | 16 Mbit/s     | 16 Mbit/s    | On           |

show Power Over Ethernet (POE)

Once a session is created, you can fetch POE settings and status.

Settings

The switch's PoE settings are printed in Markdown table format. This means, separated by | (pipe) and optional suffixes with blanks.

Use the --output-format=json flag, to get JSON output instead.

ntgrrc poe settings --address gs316ep

| Port ID | Port Name        | Port Power | Mode        | Priority | Limit Type | Limit (W) | Type                 | Longer Detection Time |
|---------|------------------|------------|-------------|----------|------------|-----------|----------------------|-----------------------|
| 1       | AGER 31 SUR Tech | enabled    | Legacy      | High     | User       | 30.0      | IEEE802              | Disable               |
| 2       | foobar           | enabled    | 802.3at     | Low      | User       | 30.0      | IEEE802              | Disable               |
| 3       | zzz              | enabled    | 802.3at     | Low      | User       | 30.0      | 4pt 802.3af + Legacy | Disable               |
| 4       | uuu              | enabled    | 802.3at     | Low      | User       | 30.0      | IEEE802              | Disable               |

Status

The switch's POE status are printed in Markdown table format. This means, separated by | (pipe) and optional suffixes with blanks.

Use the --output-format=json flag, to get JSON output instead.

ntgrrc poe status --address gs305ep

| Port ID | Port Name | Status           | PortPwr class | Voltage (V) | Current (mA) | PortPwr (W) | Temp. (°C) | Error status |
|---------|-----------|------------------|---------------|-------------|--------------|-------------|------------|--------------|
| 1       | Camera    | Delivering Power | 0             | 53          | 82           | 4.40        | 30         | No Error     |
| 2       |           | Searching        |               | 0           | 0            | 0.00        | 30         | No Error     |
| 3       |           | Searching        |               | 0           | 0            | 0.00        | 30         | No Error     |
| 4       |           | Searching        |               | 0           | 0            | 0.00        | 30         | No Error     |

set Power Over Ethernet (POE)

ntgrrc is able to set various parameters on PoE port(s).

Port Power

To enable or disable port power, pass the port number using -p and --power enable to enable power or --power disable to disable power. More than one port number can be provided.

Use the --output-format=json flag, to get JSON output instead.

ntgrrc poe set -p 3 -p 4 --power enable --address gs305ep

| Port ID | Port Name | Port Power | Mode        | Priority | Limit Type | Limit (W) | Type    | Longer Detection Time |
|---------|-----------|------------|-------------|----------|------------|-----------|---------|-----------------------|
| 3       |           | enabled    | Legacy      | High     | User       | 30.0      | IEEE802 | Disable               |
| 4       |           | enabled    | 802.3at     | Low      | User       | 30.0      | IEEE802 | Disable               |

Port Power Mode

To change the port power mode, pass the port number using -p and --mode with the desired power mode (802.3af, legacy, pre-802.3at, 802.3at). More than one port number can be provided.

Use the --output-format=json flag, to get JSON output instead.

ntgrrc poe set -p 3 -p 5 --mode legacy --address gs305ep

| Port ID | Port Name | Port Power | Mode        | Priority | Limit Type | Limit (W) | Type    | Longer Detection Time |
|---------|-----------|------------|-------------|----------|------------|-----------|---------|-----------------------|
| 3       |           | enabled    | Legacy      | High     | User       | 30.0      | IEEE802 | Disable               |
| 4       |           | enabled    | Legacy      | Low      | User       | 30.0      | IEEE802 | Disable               |

Port Priority

To change port priority, pass the port number using -p and --priority with the desired priority (low, high, critical). More than one port number can be provided.

Use the --output-format=json flag, to get JSON output instead.

ntgrrc poe set -p 3 -p 5 --priority critical --address gs305ep

| Port ID | Port Name | Port Power | Mode        | Priority | Limit Type | Limit (W) | Type    | Longer Detection Time |
|---------|-----------|------------|-------------|----------|------------|-----------|---------|-----------------------|
| 3       |           | enabled    | Legacy      | critical | User       | 30.0      | IEEE802 | Disable               |
| 5       |           | enabled    | Legacy      | critical | User       | 30.0      | IEEE802 | Disable               |

Power Limit

To change the power limit for a port, pass the port number using -p and --pwr-limit with the desired limit. More than one port number can be provided.

Use the --output-format=json flag, to get JSON output instead.

ntgrrc poe set -p 3 -p 5 --pwr-limit 5 --address gs305ep

| Port ID | Port Name | Port Power | Mode        | Priority | Limit Type | Limit (W) | Type    | Longer Detection Time |
|---------|-----------|------------|-------------|----------|------------|-----------|---------|-----------------------|
| 3       |           | enabled    | Legacy      | critical | User       | 5.0       | IEEE802 | Disable               |
| 5       |           | enabled    | Legacy      | critical | User       | 5.0       | IEEE802 | Disable               |

Power Limit Type

To change the power limit type for a port, pass the port number using -p and --limit-type with the desired limit type (none, class, user). More than one port number can be provided.

Use the --output-format=json flag, to get JSON output instead.

ntgrrc poe set -p 3 -p 5 --limit-type class --address gs305ep

| Port ID | Port Name | Port Power | Mode        | Priority | Limit Type | Limit (W) | Type    | Longer Detection Time |
|---------|-----------|------------|-------------|----------|------------|-----------|---------|-----------------------|
| 3       |           | enabled    | Legacy      | critical | class      | 30.0      | IEEE802 | Disable               |
| 5       |           | enabled    | Legacy      | critical | class      | 30.0      | IEEE802 | Disable               |

Detection type

To change the detection type for a port, pass the port number using -p and --detect-type with the desired detection type. More than one port can be provided.

Use the --output-format=json flag, to get JSON output instead.

ntgrrc poe set -p 3 -p 5 --detect-type "4pt 802.3af + Legacy" -a gs305ep

| Port ID | Port Name | Port Power | Mode        | Priority | Limit Type | Limit (W) | Type                 | Longer Detection Time |
|---------|-----------|------------|-------------|----------|------------|-----------|----------------------|-----------------------|
| 3       |           | enabled    | Legacy      | critical | User       | 30.0      | 4pt 802.3af + Legacy | Disable               |
| 5       |           | enabled    | Legacy      | critical | User       | 30.0      | 4pt 802.3af + Legacy | Disable               |

cycle Power Over Ethernet (POE)

ntgrrc is able to power cycle one or more PoE ports.

Use the --output-format=json flag, to get JSON output instead.

ntgrrc poe cycle -p 3 -p 5 --address gs305ep Alternativly, you can achieve the same request with this ntgrrc poe cycle --address gs305ep --port=3,5

| Port ID | Port Name        | Status           | PortPwr class | Voltage (V) | Current (mA) | PortPwr (W) | Temp. (°C) | Error status |
|---------|------------------|------------------|---------------|-------------|--------------|-------------|------------|--------------|
| 3       | Camera           | Delivering Power |               | 54          | 24           | 1.30        | 30         | No Error     |
| 5       | Sensor           | Searching        |               | 0           | 0            | 0.00        | 30         | Power Denied |

About

ntgrrc (Netgear Remote Control) a command line (CLI) tool to manage Netgear GS3xx switch series.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 59.1%
  • Makefile 40.9%