Skip to content

nmc

ibox.nmc in the library, ibox nmc in the CLI.

Query the Network Management Controller for WAN, LAN, and system status.

status

status() -> str

Get NMC status

ip_conflicts

ip_conflicts() -> str

Get IP conflicts

wan_status

wan_status(details: bool = False) -> str

Get the internet connection's status: link type and state, protocol and connection state.

Parameters:

Name Type Description Default
details bool

also get the public IPv4 and IPv6 addresses, the delegated IPv6 prefix, the gateway and the provider's DNS servers. Needs the password. Default is False, which works without it.

False

Returns:

Name Type Description
str str

response content

wan_mtu

wan_mtu() -> str

Get the MTU of the internet connection: the largest packet, in bytes, it sends without splitting it.

The router answers per interface, e.g. {"veip0": 1500} for a fiber connection.

Returns:

Name Type Description
str str

response content

orientation

orientation() -> str

Get device orientation

lan_ip

lan_ip() -> str

Get LAN IP address

reboot

reboot(reason: str = 'pyinternetbox') -> str

Restart the router. Internet, Wi-Fi and phone are down for a few minutes.

Parameters:

Name Type Description Default
reason str

reason sent to the router (the web UI sends "WebUI"). Default is "pyinternetbox".

'pyinternetbox'

Returns:

Name Type Description
str str

response content

reboot_info

reboot_info() -> str

Get how often the router has started: BootCounter counts every start, and WatchdogRebootCounter and RebootSinceLastUpgrade count some of them. reboot_history() shows when and why it last started.

Returns:

Name Type Description
str str

response content

reboot_history

reboot_history() -> str

Get the router's last 10 starts: when and why it started (BootDate, BootReason) and shut down before.

The starts are numbered like BootCounter in reboot_info(), so the newest is the current one. BootReason is e.g. "POR" when it was switched on, also after a power cut, "NMC" after reboot() or a restart in the web UI, or "Watchdog". ShutdownReason is the reason given to reboot(), or "Upgrade" for a firmware upgrade. A ShutdownDate of 0001-01-01T00:00:00Z means no shutdown was recorded: the router lost power, or it's still running.

Returns:

Name Type Description
str str

response content

backup

backup() -> str

Download a backup of all settings, e.g. ibox nmc backup > internetbox.cfg

This is the file the web UI's "Save Current Configuration" button saves; restore() loads it back. The phone book isn't included. The router keeps the dates of the last two backups (History.backup_entries()).

Returns:

Name Type Description
str str

content of the backup file

restore

restore(path: str) -> str

Replace all settings with a backup file. The router restarts: internet, Wi-Fi and phone are down for a few minutes.

The phone book isn't in the file and stays as it is.

Parameters:

Name Type Description Default
path str

backup file saved with backup() or the web UI.

required

Returns:

Name Type Description
str str

response content

Raises:

Type Description
ValueError

if the file isn't a configuration backup or the router doesn't confirm the restore.

backup_to_swisscom

backup_to_swisscom() -> str

Upload a backup of the settings to Swisscom, as the web UI does when settings are saved.

Only if backup to Swisscom is turned on for this router; the web UI has no setting for it. The router answers straight away and uploads in the background, which takes about a minute: network_config() shows Saving, Uploading, then Uploaded, and History.backup_entries() lists the upload.

Returns:

Name Type Description
str str

response content

Raises:

Type Description
ValueError

if backup to Swisscom isn't turned on. Nothing is uploaded.

phonebook_backup

phonebook_backup() -> str

Get phonebook backup status

static_routes

static_routes() -> str

Get LAN static routes

set_static_route

set_static_route(destination: str, gateway: str) -> str

Add a static route, or change the gateway of the route to this network, like the web UI's static routes.

The router then sends traffic for the destination network to the gateway: a device in your network, such as a second router with that network behind it. Give the gateway a fixed IP address (dhcp.add_static_lease()), as the web UI suggests, so the route keeps working.

Parameters:

Name Type Description Default
destination str

a private network with a prefix length from /16 to /28, e.g. "192.168.10.0/24".

required
gateway str

IP address of a device in your network, e.g. "192.168.1.2".

required

Returns:

Name Type Description
str str

response content

Raises:

Type Description
ValueError

if the web UI would refuse the route: for instance a public network, one that overlaps your network, the guest Wi-Fi, the WireGuard clients or another route, a gateway outside your network, or an 11th route.

delete_static_route

delete_static_route(route: str) -> str

Delete a static route, and the port forwarding rules to devices behind it, like the web UI.

The port forwarding rules made in the web UI or with firewall.set_port_forwarding() for addresses in the route's network only reach their devices through the route, so the web UI deletes them too.

Parameters:

Name Type Description Default
route str

the route's destination network, e.g. "192.168.10.0/24", or its name in static_routes().

required

Returns:

Name Type Description
str str

response content

network_config

network_config() -> str

Get the status of backup to Swisscom: Enabled, or Saving, Uploading and Uploaded during an upload. Disabled means it's off.

bdd

bdd() -> str

Get NMC BDD (Broadband Device Database) information